Re: LIBXML- Auto-Indent - How do it?

From: Date: Mon, 17 Dec 2001 17:14:17 +0000
Subject: Re: LIBXML- Auto-Indent - How do it?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77963@lists.php.net to get a copy of this message
Hello, Ricardo Junior wrote: > > Hi All, > I would like to know if there is any way to auto-indent the XML file when I > add a new node in a docxml object and export the string of the created XML > file with dumpmem() function... This PHP Class generates properly indented XML as you need. http://phpclasses.upperdesign.com/browse.html/package/250 Regards, Manuel Lemos > > For example: > $new = new_xmldoc("1.0"); > $root = $new->add_root("ROOT"); > $level1 = $root->new_child("LEVEL-1", ""); > $level1->new_child("LEVEL2", ""); > $new_xml_file = fopen ("test.xml", "w"); > fwrite($new_xml_file, $new->dumpmem()); > fclose ($new_xml_file); > > The result in test.xml file is: > <?xml version="1.0"?> > <ROOT><LEVEL-1><LEVEL2/></LEVEL-1></ROOT> > > But I'm needing it like this: > > <?xml version="1.0"?> > > <ROOT> > <LEVEL-1> > <LEVEL2/> > </LEVEL-1> > </ROOT> > > Could someone help me on this?! > Thanks. > _________________________________ > Ricardo J. A. Júnior, Software Engineer Trainee > Bowne Global Solutions > > Phone +55 21 2515 7713 > ricardo.junior@bowneglobal.com.br > <mailto:ricardo.junior@bowneglobal.com.br> > > www.bowneglobal.com.br <http://www.bowneglobal.com.br/>

« previous php.general (#77963) next »