You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Brian Delahunty <bd...@tssg.org> on 2003/06/18 17:10:54 UTC
XML Parsing + SAX
Hey,
I have a String that contains an XML file [not a URL/URI that points to an XML file but the actual XML itself].
I'm tying to use this string in a custom generator to produce sa exents. I'm using this code so far:
XMLReader xmlr = XMLReaderFactory.createXMLReader();
xmlr.setContentHandler(this.contentHandler);
xmlr.parse( <don't know what goes here> );
I can't get parse to work with a String.
Any ideas?
Brian
Re: XML Parsing + SAX
Posted by Martin Holz <ho...@fiz-chemie.de>.
"Brian Delahunty" <bd...@tssg.org> writes:
> Hey,
>
>
>
> I have a String that contains an XML file [not a URL/URI that points to an XML
> file but the actual XML itself].
>
>
>
> I'm tying to use this string in a custom generator to produce sa exents. I'm
> using this code so far:
>
> XMLReader xmlr = XMLReaderFactory.createXMLReader();
> xmlr.setContentHandler(this.contentHandler);
> xmlr.parse( <don't know what goes here> );
>
>
>
> I can't get parse to work with a String.
StringReader reader = new java.io.StringReader(myString);
InputSource src = new org.xml.sax.InputSource(reader);
xmlr.parse(src);
However in Cocooon I would not lookup the XMLReader throught XMLReaderFactory, but try
to lookup a instance of org.apache.excalibur.xml.sax.SAXParser.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org