How can I use a TreeWalker to dump out the DOM
Posted
by michael
on Stack Overflow
See other posts from Stack Overflow
or by michael
Published on 2010-04-04T23:31:19Z
Indexed on
2010/04/04
23:33 UTC
Read the original article
Hit count: 437
Hi,
In w3c dom interface, there is DOMTreeWalker to traverse the DOM. I find this example which uses DOMTreeWalker:
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>
© Stack Overflow or respective owner