aspose file tools*
The moose likes XML and Related Technologies and the fly likes Problems parsing a string with SAX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Problems parsing a string with SAX" Watch "Problems parsing a string with SAX" New topic
Author

Problems parsing a string with SAX

mcore
Greenhorn

Joined: Jul 13, 2001
Posts: 13
i'm attempting to parse a string object like so:
SAXParser parser = new SAXParser();
parser.setContentHandler ( this );
parser.setErrorHandler ( this );
StringReader stringReader = new StringReader(xmlString);
InputSource inputSource = new InputSource(xmlString);
parser.parse(inputSource);
but i keep getting a SAXParseException: File <xmlString> Not Found.
what am i doing wrong?
all i want to do is simply recieve a String Object from a method, and parse the string with SAX. any ideas?
i'm using xerces java 1.
many thanks,
-MCore
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
It thinks your String is the name of a file. You need to turn the string into a Reader with StringReader or byte InputStream with StringBufferInputStream (deprecated).
Bill

------------------
author of:


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems parsing a string with SAX
 
Similar Threads
Parsing of a String using DOM or SAX
DOMParser
Converting String to XML file?
xml parsing from a string
Parsing input from a string using JAXP, Xerces 1.4.1 with Visual Age