Modify Document in-place
I was looking at the docs about the writer:
"A XML writer. Can be nested with readers if you want to transform XMLs. Especially for nested XML elements, the user must keep track where (how deep) in the XML document the current event is located."
I was looking and there is no documentation or an example regarding this. Is there an example that can show this happening?
We do not have much examples of writing yet. Basically, the example from Writer is the one example of writing which also shows how to transform document (it is not "in place", but "streaming"). In that example you can see that we just check the tag name to see if we need to replace it. In case of document like
<this_tag>
<this_tag>
<this_tag>
</this_tag>
</this_tag>
</this_tag>
we will replace all three of them, while you may want to replace, say, only most nested. So you additionally should keep track the nesting level, which is increasing before procession of each Start event and decreasing after processing of the End event.
Ah ok, so we can't really use this method to modify a document in place really, we must make a new file?
Yes, you need to write new document