how to print html dom tree?

???? mike lol

New member
i have a DOM tree of a parsed html file. the tree is made of nodes which hold a string and an arraylist of children nodes.
i'm stumped on how to print out the html code equivalent of the tree.
for simplicity, the DOM tree doesn't have any complicated stuff, just a few tags and some text.
for example:
html
----body
--------center
------------the
------------em
----------------quick
------------brown fox

this tree should be printed like:
<html>
<body>
<center>
the
<em>
quick
</em>
brown fox
</center>
</body>
</html>

i can't get the tree to print out the closing tags correctly. any help?
 
Back
Top