At the moment, parsing from XML and generating XML is handled by functions making use of recursion.
In theory the parser does not fall in the class of "tail recursion", so some types of documents can fail due to buffer overflows regardless of how much memory the system has. Dynamic allocation is probably the only way forward here.
The XML serialization on the other hand is using recursion out of convenience, but as the tree has full context for each node, we don't need a stack to navigate it. Hence, it can be optimized to operate with $$O\left (1\right )$$ .
At the moment, parsing from XML and generating XML is handled by functions making use of recursion.
In theory the parser does not fall in the class of "tail recursion", so some types of documents can fail due to buffer overflows regardless of how much memory the system has. Dynamic allocation is probably the only way forward here.
The XML serialization on the other hand is using recursion out of convenience, but as the tree has full context for each node, we don't need a stack to navigate it. Hence, it can be optimized to operate with$$O\left (1\right )$$ .