I'm not sure, but it sounds like you might have invalid XML which means a "real" XML parser isn't going to work.
But, in any case, since you've already spent a ton of time fighting against a variety of full-fledged parsers, I'd just write my own parser. It actually is quite easy to write a real parser for whatever subset of XML one has to deal with. And that makes it trivial to deal with unusual things (that might not even strictly be valid XML) and trivial to get access to whatever matters to you.
Re^2: parsing XML fragments (xml log files) with... a regex shows how easy it was for me to deal with the types of XML I ran into. And the code is trivial to extend to cover more parts of XML to meet your needs.
Note that, as written, my code expects the full XML string. But it would be easy to modify it to just read a reasonably large chunk of text and, when pos gets 1/2 way through (or when an unclosed < is encountered), to just strip what has been parsed so far and append more.
- tye
In reply to Re: Seeking for advice: XML parsing with special requirements (regex)
by tye
in thread Seeking for advice: XML parsing with special requirements [Solved]
by Nocturnus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |