[xml] Indentation ?

Date view Thread view Subject view Author view

From: Thomas Poindessous (poinde_t@epita.fr)
Date: Thu Aug 31 2000 - 16:54:06 EDT


I know this isn't a bug but how can I indent my xml files ?
Juste a example:

int main()
{
  xmlDocPtr doc;
  xmlNodePtr pere;
  xmlNodePtr fils;
  xmlNodePtr petit_fils;
  
  doc = xmlNewDoc("1.0");
  doc->xmlRootNode = xmlNewDocNode(doc, NULL, "Test", NULL);
  pere = doc->xmlRootNode;
  fils = xmlNewChild(pere, NULL, "Fils", NULL);
  xmlSetProp(fils, "type", "val");
  petit_fils = xmlNewChild(fils, NULL, "Fils2", NULL);
  xmlSetProp(petit_fils, "type2", "val");
  xmlSaveFile("toto.test", doc);
}

and I get that:

<?xml version="1.0"?>
<Test>
<Fils type="val">
<Fils2 type2="val"/>
</Fils>
</Test>

It looks a little ugly ...

-- 
Thomas Poindessous
EpX asso GNU/Linux de l'Epita
epx@epita.fr && http://www.epita.fr/~epx
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 22:34:53 EDT