I need to read a large XML document from the web and split it into smaller XML documents. In particular, the stream I'm reading from the network looks something like this:
<a> <b> ... </b> <b> ... </b> <b> ... </b> <b> ... </b> .... </a>
I need to break it into pieces
<a> <b> ... </b> <a>
(I really need the <b> .... </b> parts if the names of the name objects declared above (for example, in <a> ) move to <b> if that makes it easier).
The file is too large for the DOM style parser, it must be streaming. Is there an XML library that can do this?
[change]
I think that what I am ideally looking for is something like the ability to make XPath queries in an XML stream, where the stream analyzer only analyzes how necessary it is to return the next element to the node set result (and all its attributes and children ) It is not necessary to be XPath, but something on this idea.
Thanks!
source share