[xml] Pretty print in libxml2
- From: shtil comcast net
- To: xml gnome org
- Subject: [xml] Pretty print in libxml2
- Date: Tue, 23 Apr 2013 16:56:42 +0000 (UTC)
Hi,
I wonder if there is a way to pretty print xml.
Referring to the examples for xmlWriter I want <?xml version="1.0" encoding="ISO-8859-1"?>
<EXAMPLE><!--This is a comment with special chars: <äöü>--><ORDER version="1.0" xml:lang="de"><!--This is another comment with special chars: <äöü>--><HEADER><X_ORDER_ID>0000053535</X_ORDER_ID><CUSTOMER_ID>1010</CUSTOMER_ID><NAME_1>Müller</NAME_1><NAME_2>Jörg</NAME_2></HEADER><ENTRIES><ENTRY><ARTICLE><Test></ARTICLE><ENTRY_NO>10</ENTRY_NO></ENTRY><ENTRY><ARTICLE><Test 2></ARTICLE><ENTRY_NO>20</ENTRY_NO></ENTRY></ENTRIES><FOOTER><TEXT>This is a text.</TEXT></FOOTER></ORDER></EXAMPLE>
to look like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<EXAMPLE>
<!--This is a comment with special chars: <äöü>-->
<ORDER version="1.0" xml:lang="de">
<!--This is another comment with special chars: <äöü>-->
<HEADER>
<X_ORDER_ID>0000053535</X_ORDER_ID>
<CUSTOMER_ID>1010</CUSTOMER_ID>
<NAME_1>Müller</NAME_1>
<NAME_2>Jörg</NAME_2>
</HEADER>
<ENTRIES>
<ENTRY>
<ARTICLE><Test></ARTICLE>
<ENTRY_NO>10</ENTRY_NO>
</ENTRY>
<ENTRY>
<ARTICLE><Test 2></ARTICLE>
<ENTRY_NO>20</ENTRY_NO>
</ENTRY>
</ENTRIES>
<FOOTER>
<TEXT>This is a text.</TEXT>
</FOOTER>
</ORDER>
</EXAMPLE>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]