XML_ELEMENT_DEPTH_EXCEEDED while trying to parse an xml document
I've tried to use tinyxml2 to parse some simple (but unfortunately with a recursive structure) xmls, but some of them fails to parse with something like this:
Error=XML_ELEMENT_DEPTH_EXCEEDED ErrorID=18 (0x12) Line number=1: Element nesting is too deep.
(trying to pass that xml to xmltest gives the same ErrorID=18).
Now, there's a TINYXML2_MAX_ELEMENT_DEPTH constant in tinyxml2.h, but it looks like the only way to change it is to patch the file, not too ideal. Could it be made somehow configurable, or at least increase the default? Right now I have to set it to at least 115 to successfully parse all the test xmls I have at the moment, but I'll need probably a higher value to be safe.
Of course, determining when recursion is too much is a bit of a russian roulette, on Linux typically you have 8MB stack which is a lot, but on other OSes you might have less.
I'm pretty burned out on chasing down stack overflow errors. Although a configurable depth is a good suggestion. I worry people might use a configurable depth imprudently and cause bugs they would attribute to TinyXML2.
Yeah, I can't blame you after issues like #832, but it also seems excessive having to practically fork tinyxml2 just to adjust a single parameter. (My code itself is not recursive, so I'm only being limited by tinyxml2 here, but I guess people usually process recursive structures with recursive functions, so it's easy to shoot themselves in the foot. I think libxml2 can handle arbitrary recursion, but that would be a huge bloat in my use-case...)