http://www.perlmonks.org?node_id=420406


in reply to Incremental parsing of multiple XML streams?

One of the major selling points of XML is that it is well structured: an XML parser can determine if the data is well-formed.

It sounds like the right way to go would be to use a buffer that captures the XML as it comes in, then when it gets the closing tag that matches the first opening tag, cut the buffer off and send it to be parsed.

Perhaps the reason you're having a hard time is because you're fighting all of the things that have been done to make XML in Perl easy and reliable.


--
Spring: Forces, Coiled Again!