N
Nobody
I'm trying to put together code to deal with a SOAP with attachements response, and I'd like to process the response in a single pass. The SOAP with attachments specification returns XML in a MIME message, so it looks like this:
--4389012.48390
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> ....snip... </soap-env:Envelope>
--4389012.48390
Content-Type: text/xml
Content-Id: RootNode
<?xml version="1.0" encoding="UTF-8"?><RootNode>
... snip ...
</RootNode>
--4389012.48390--
So what I'd LIKE to be able to do is to parse the incoming input stream up to the <?xml> declaration, hand the input stream over to a SAX parser, let it parse to the end of the document, and then have it return at the end so I can continue parsing the same input stream.
The problem is that "SAXParser.parse( new InputSource( inputStream ), handler );" appears to want to consume the input stream until it reaches EOF on the input stream (which, when given the input stream above, fails with the error message "Content is not allowed in trailing section."). Is this something I can work around in Xerces, or is there a better SAX implementation that will let me tell the parser to stop when it reaches the last element?
--4389012.48390
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> ....snip... </soap-env:Envelope>
--4389012.48390
Content-Type: text/xml
Content-Id: RootNode
<?xml version="1.0" encoding="UTF-8"?><RootNode>
... snip ...
</RootNode>
--4389012.48390--
So what I'd LIKE to be able to do is to parse the incoming input stream up to the <?xml> declaration, hand the input stream over to a SAX parser, let it parse to the end of the document, and then have it return at the end so I can continue parsing the same input stream.
The problem is that "SAXParser.parse( new InputSource( inputStream ), handler );" appears to want to consume the input stream until it reaches EOF on the input stream (which, when given the input stream above, fails with the error message "Content is not allowed in trailing section."). Is this something I can work around in Xerces, or is there a better SAX implementation that will let me tell the parser to stop when it reaches the last element?