Perl XML::DOM

J

jlord7040

is there any way to write the xml data to a formated output, like the
standard tree structure for xlm.

when I append a record it slaps it at the end with any (CR) so the
whole think looks like one big line, below is a sample of the code:




$objXMLNodeList = $objXMLDoc->getElementsByTagName("title");

$objXMLNode = $objXMLDoc->createElement("list");
$objXMLNode->setAttribute ("link",$links);
$objXMLNode->setAttribute ("desc",$desc);


$objXMLDocElem = $objXMLDoc->getDocumentElement();
$objXMLDocElem->appendChild($objXMLNode);

print $objXMLDoc->toString;
$objXMLDoc->printToFile($file);


Thanks
 
P

Paul Lalli

is there any way to write the xml data to a formated output, like the
standard tree structure for xlm.

when I append a record it slaps it at the end with any (CR) so the
whole think looks like one big line

A cursory examination of the XML::DOM docs doesn't reveal any obvious
formatting routine. However, have you considered using another module
to re-format the file once it's written?

http://search.cpan.org/~pip/XML-Tidy-1.2.54HJnFa/Tidy.pm

Paul Lalli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top