Also, When I send in an xml document like this:
<!-- SENT(09:12:57.130) -->
<FinHdr>
<Instrument Act="Subscribe" Dest=":Instrument:">
<Exchange>Test</Exchange>
</Instrument>
</FinHdr>
<!-- SENT(09:12:57.131) -->
<FinHdr>
<InstrumentList Act="Subscribe" Dest=":InstrumentList:"></InstrumentList>
</FinHdr>
After the first </FinHdr>, I get another startDocument() callback ( this is
SAX, reading a stream of input, as per the FAQ ), I get the following exception:
org.xml.sax.SAXParseException: The root element is required in a well-formed
document.
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at org.xml.sax.SAXException.<init>(SAXException.java:45)
at org.xml.sax.SAXParseException.<init>(SAXParseException.java:56)
at
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1150)
at
org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocumentScanner.java:626)
at
org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.endOfInput(XMLDocumentScanner.java:846)
at
org.apache.xerces.framework.XMLDocumentScanner.endOfInput(XMLDocumentScanner.java:418)
at
org.apache.xerces.validators.common.XMLValidator.sendEndOfInputNotifications(XMLValidator.java:698)
at
org.apache.xerces.readers.DefaultEntityHandler.changeReaders(DefaultEntityHandler.java:1026)
at
org.apache.xerces.readers.XMLEntityReader.changeReaders(XMLEntityReader.java:168)
at org.apache.xerces.readers.StreamingCharReader.changeReaders(Compiled
Code)
at org.apache.xerces.readers.StreamingCharReader.lookingAtChar(Compiled
Code)
at
org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.dispatch(XMLDocumentScanner.java:742)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(Compiled
Code)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035)
at com.db.ged.ovgw.main.OVStreamReader.parseInput(Compiled Code)
at com.db.ged.ovgw.main.OVStreamReader.main(OVStreamReader.java:91)
Any pointers? Do I need to reset something after the first 'document' is
finished.
I'm not doing any schema validation here... ( well I dont want to be doing any )
I'm initialising/running the parser like this:
SAXParser parser = (SAXParser)
Class.forName("org.apache.xerces.parsers.SAXParser").newInstance();
parser.setContentHandler( new DocProcessor() );
//StreamingChar factory given in FAQ
parser.setReaderFactory( new StreamingCharFactory());
while ( true ) {
try {
parser.parse( new InputSource ( new NoCloseBufferedReader (
new InputStreamReader ( inputStream ) ) ) );
}
//SAXParseFinishedException is thrown in endElement callback
catch ( SAXParseFinishedException e ) {
CAT.debug ( "Finished node. Loop for next" );
}
}
Thanks so much for any help!
James
--
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any unauthorised
copying, disclosure or distribution of the material in this e-mail is strictly
forbidden.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]