A couple things. (1) it appears that this has been fixed in 7.0. I reproduced your problem in 6.1 but not in 7.0 (All testing done on WinXP).
(2) OpenG has a Flatten/Unflatten to/from XML tool that is written entirely in G. You can find more information here: <a href="http://www.openg.org/tiki/tiki-index.php?page=EXAMPLE+-+OpenG+Flatten+to+XML">OpenG.org : EXAMPLE - OpenG Flatten to XML</a>