According to your question I need to "print $doc->toString" -->  to string and 
then to manipulate it in order to get the real XML
Can you please give me real example for this
Thx
Uri



XML documents are better off including the declaration. I don't know of an API 
in libxml to suppress it, but if you care enough, write your document to a 
string variable and strip it out with a regular expression before writing to 
disk.


######################################################################################################################################
My perl script:
######################################################################################################################################
#!/usr/bin/perl
use warnings;
use XML::LibXML;
local $XML::LibXML::skipXMLDeclaration = 1;
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 @myNames=` ls /var/tmp | grep FILE.xml | sed "s/.FILE.*//" `;
foreach (@myNames) {
my $objVar = $doc->createElement('UnitType');
$install->appendChild($objVar);
$objVar->setAttribute('Name' , $_ );
$objVar->setAttribute('UponError' , Stop );
$objVar->setAttribute('ExecutionOrder' , 1 );
}
open (MYFILE, '>data.xml');
print MYFILE $doc->toString;
close (MYFILE);



  ________________________________
"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: secur...@comverse.com. Thank You."
_______________________________________________
Perl mailing list
Perl@perl.org.il
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to