Using XMLWriter writer directly is stream based and will not help you here.
In Pharo 2.0 load "Pastell" (ConfigurationOfPastell) from the config browser.
It also loads ConfigurationOfXMLSupport as a single dependency.
This "XMLSupport" package is usually used for parsing XML and with "Pastell"
you can easily access nodes like in XPath
see
http://www.youtube.com/watch?v=6fUtdQ0-5yA for a pastell video
Havent tried but with "XMLSupport" I'm sure you can also manually instantiate/connect/build the
nodes and document, manipulate the object tree and write out the contents as XML file later.
At least there are methods like #writeXMLOn: aWriter in classes like XMLDocument
XMLNodeWithChildren, ...
Bye
T.