File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems parsing a string with SAX

 
mcore
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic