B
brightoceanlight
I'm trying to parse an XML string with Java's SaxParser. The program
fails at the end of an element or at the beginning of a new element.
Is my XML string okay?
<?xml version="1.0" encoding="utf-8"
?><DTYPE>OVL</DTYPE><DTYPE>IMG</DTYPE>. . .
If fails after </DTYPE> and before the next <DTYPE>
The Sax Parser works fine on files.
Here is the code I use to send the string to the parser :
// Parse the input
SAXParser saxParser = factory.newSAXParser();
InputStream is = new ByteArrayInputStream(stringToParse.getBytes());
saxParser.parse( is, handler );
Here is the error message I get :
org.xml.sax.SAXParseException: Unzulässiges Zeichen am Dokumentende,
<
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3370)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:673)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:143)
at EchoSaxParser.parse(EchoSaxParser.java:51)
at StringParser.parse(StringParser.java:23)
at Servant.stringparse(Servant.java:30)
at TEST._TestImplBase._invoke(_TestImplBase.java:43)
at
com.sun.corba.se.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:353)
at com.sun.corba.se.internal.iiop.ORB.process(ORB.java:280)
at
com.sun.corba.se.internal.iiop.RequestProcessor.process(RequestProcessor.java:81)
at
com.sun.corba.se.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:106)
Any help would be greatly appreciated!
Thank you!
Gil
fails at the end of an element or at the beginning of a new element.
Is my XML string okay?
<?xml version="1.0" encoding="utf-8"
?><DTYPE>OVL</DTYPE><DTYPE>IMG</DTYPE>. . .
If fails after </DTYPE> and before the next <DTYPE>
The Sax Parser works fine on files.
Here is the code I use to send the string to the parser :
// Parse the input
SAXParser saxParser = factory.newSAXParser();
InputStream is = new ByteArrayInputStream(stringToParse.getBytes());
saxParser.parse( is, handler );
Here is the error message I get :
org.xml.sax.SAXParseException: Unzulässiges Zeichen am Dokumentende,
<
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3370)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:673)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:143)
at EchoSaxParser.parse(EchoSaxParser.java:51)
at StringParser.parse(StringParser.java:23)
at Servant.stringparse(Servant.java:30)
at TEST._TestImplBase._invoke(_TestImplBase.java:43)
at
com.sun.corba.se.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:353)
at com.sun.corba.se.internal.iiop.ORB.process(ORB.java:280)
at
com.sun.corba.se.internal.iiop.RequestProcessor.process(RequestProcessor.java:81)
at
com.sun.corba.se.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:106)
Any help would be greatly appreciated!
Thank you!
Gil