How can I use a TreeWalker to dump out the DOM
- by michael
Hi,
In w3c dom interface, there is DOMTreeWalker to traverse the DOM. I find this example which uses DOMTreeWalker:
http://www.java-tips.org/java-se-tips/org.w3c.dom/how-to-traverse-the-dom-tree-using-treewalker-2.html
But my question is How can I use the DOMTreeWalk to dump the dom structure and value to a file?
i.e. I need to know when a parent start and a parent end so that I can do when I dump the dom to a file (i need to insert after each parent dumps its children:
<parent>
<child a1="1" a2="2"/>
<child a3="1" a4="3"/>
<child a5="1" a6="5"/>
</parent>