you can serialize the
doc. check out e. r. harold's
Output from DOM Chapter in his "Processing XML with
Java " book
note: far-and-away one of the best technical books i've ever read - and he made the entire text available online! he's a real hero ...