Pass the argument 1 to toString: $doc->toString(1);
FYI, the way I found this out was looking up this method in the docs for this class, e.g. here: http://search.cpan.org/~pajas/XML-LibXML-1.70/lib/XML/LibXML/Document.pod Hope this helps. On Wed, Jul 14, 2010 at 5:59 PM, Barih Uri <[email protected]> wrote: > Dear Gaal & Sawyer > Sorry but I need to clarify my question , you right about your example , its > good example to remove the XML version by shift > But my final target is to create right XML format > Please look on the following perl example: createXML.pl script > > #!/usr/bin/perl > > use warnings; > use XML::LibXML; > > > my $doc = XML::LibXML::Document->new; > my $root = $doc->createElement('LEVEL1'); > $doc->setDocumentElement($root); > > my $system = $doc->createElement('LEVEL2'); > $root->appendChild($system); > > my $install = $doc->createElement('LEVEL3'); > $system->appendChild($install); > > my @lines = split /\n/, $doc->toString; > shift @lines; > > foreach (@lines) { > print "$_ \n"; > } > > The output from createXML.pl script is: > <LEVEL1><LEVEL2><LEVEL3/></LEVEL2></LEVEL1> > > But we want the following XML format: > <LEVEL1> > <LEVEL2> > <LEVEL3/> > </LEVEL2> > </LEVEL1> > I add the: > my @lines = split /\n/, $doc->toString; > shift @lines; > > foreach (@lines) { > print "$_ \n"; > } > > but as you see the XML format still as: > <LEVEL1><LEVEL2><LEVEL3/></LEVEL2></LEVEL1> > Please advice > THX > Uri > > > ________________________________ > “This e-mail message may contain confidential, commercial or privileged > information that constitutes proprietary information of Comverse Technology > or its subsidiaries. If you are not the intended recipient of this message, > you are hereby notified that any review, use or distribution of this > information is absolutely prohibited and we request that you delete all > copies and contact us by e-mailing to: [email protected]. Thank You.” > > _______________________________________________ > Perl mailing list > [email protected] > http://mail.perl.org.il/mailman/listinfo/perl > -- Gaal Yahas <[email protected]> http://gaal.livejournal.com/ _______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl
