I am using a piece of code extracted from the DOMPrint sample in order to
dump a DOM tree into a XML file. I have also taken a look at the serializer
at the following address:
http://www.xs4all.nl/~ewh/DOMSerializer
Both solutions generate a XML file which is very difficult to be read by a
human. Does anybody know of a solution to generate a formatted output?
IMHO, there are two ways to get a pretty print:
a) Adding "text nodes" between every two "element nodes" in the DOM tree
(either having a sibling relation or parent/child relation). The value of
the text node should be a carriage return ("\n") followed by a number of
blank spaces (" ") depending on the indentation of every line in the XML
file. After that, the DOM tree would be dumped into the XML file.
b) Reformating the XML file by using a program which takes an XML file, and
after some processing it writes into another different XML file. In that
case, any change in the DOM tree would require dumping and reformatting
again.
I am not sure if you will understand what I mean. I have not found any
previous work on that subject, so any hints would be appreciated.
Thanks in advance,
David Ruana
_________________________________________________________________
MSN Photos es la manera m�s sencilla de compartir e imprimir sus fotos:
http://photos.msn.com/support/worldwide.aspx
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]