Re: [xml] Pretty print in libxml2



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 23.04.2013 20:56, shtil comcast net wrote:
I wonder if there is a way to pretty print xml.
You can use xmlTextWriterWriteString() to write "\n" into the file at
appropriate places. Or even some spaces, if you want indentation
(obviously, you'll have to track tree depth yourself somehow).

Note that text between elements is, in fact, part of the XML file, and
any conformant XML reader will read it appropriately (i.e. a reader
will produce:
Start of a tag: EXAMPLE
Text (child of EXAMPLE):'\n'
Comment (child of EXAMPLE):'<!--This is a comment with special chars:
<äöü>-->'
Text (child of EXAMPLE):'\n'
Start of a tag: ORDER, with attributes version="1.0", xml:lang="de"
Text (child of ORDER):'\n'
etc)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRdsG8AAoJEOs4Jb6SI2CweQwIAL6X2LZJIEynZIgu5cFG6/o6
s+On77FUH5v09ygtpvKryp3Hl4Z4zFkMygoYkGSdm1CeRZ5f+Ne4+zSRutLgh+9W
cPE8AjP8seqYXvZ06z3V+OskIu3kXKqpoUAIMtH7r6qornx+sZBczcMXnlm9AbaH
yUUMTk7l1ulFMM+VqiGxSpPelaX4b0HVupuvNOmlF8eiKln4Rz/R/WBZj5f6Zz/M
F0s5RmiUMn+Vmd7ri+CBA5013DB9ZUn/srp+3SScKoOZ9dgb0umK/mM2g0Tl2hO+
m3ZnA40EQ6TB4a6e+XKbBsDqSZBUKBz+SHqpGQlRItmiBjsVGB4ZnjFd5G2F9w4=
=IBte
-----END PGP SIGNATURE-----


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]