cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rong <...@cs.umbc.edu>
Subject parse XML String in java code
Date Thu, 13 Apr 2000 18:49:03 GMT

Hi,

If i want to parse a String(in a piece of java code), which is in form of
XML document, what should i do? The String can be in form of:

String s1 = " <POEM> <AUTHOR> Ogden Nash </AUTHOR> <TITLE> Fleas </TITLE>
<LINE> Adam had'em. </LINE></POEM> ";

In SAXParser, the function: 

 Parser parser = ParserFactory.makeParser("com.ibm.xml.parsers.SAXParser"); 
 parser.setDocumentHandler(titleFinder); 
 parser.parse(new InputSource(args[0]));

can take an instance of File class(args[0]="*.xml") and parse it according
to an instance usr-defined class(titleFinder). This method basically parse
a xml file, not a String in the code.

Is there a way to parse a XML String in cocoon or another way?

Thanks,

Rong


Mime
View raw message