Python sax parser skips exception

Is there a way to skip a string using a SAX XML parser?

I have a non-validating XML document, which is a concatenation of valid XML documents, and therefore appears for each document <?xml ...?>. Also note that I need to use the SAX parser as input documents are huge.

I tried to create the user stream class as a feeder for the analyzer, but quickly realized that SAX uses the method readand thus reads data in byte arrays, thereby exploding the complexity of this project.

thank!

UPDATE: I know there is a way around this with help csplit, but I am getting a Python based solution if reasonably possible.

Update2: Perhaps I should have said “go to the next document”, which would make more sense. Anyway, this is what I need: a way to analyze multiple documents from one input stream.

+3
source share
1 answer

When you combine documents together, just replace the beginning of <? and? > with <! - and →, this will comment out the xml declarations.

0
source

All Articles