in reply to XML to XML

How are you simplifying it? Removing attributes and/or fields? This could be done most efficiently using a stream if you do not need to see the whole tree before you prune the xml. That is to say: i each time you encounter attribute x, you do not want to put it into the new xml, but you do want to put attribute y, then you might use SAX. This way you could include/exclude elements as you come to them.

However, if you need to analyze the whole tree before you decide how to simplify it, then you should use DOM.

The difference is that SAX parsers are event based and return items as they finds them, whereas DOM parsers read the entire document and then builds the tree. You then querry the tree.

Both of the links ( to SAX and DOM ) include links to documentation and sample code.