Hi Sawyer
THX allot for your excellent answer
Another little remark
Now I get:
Document:
<?xml version="1.0"?>
<books>
<computer/>
</books>
Actually I not need the title "<?xml version="1.0"?>"
All I want is to create XML DOM as the following
<books>
<computer/>
</books>
.
.
Yael
#####################################################################################
How to change the perl script in order to create element lines without "<?xml
version="1.0"?>" >
Yael
Hi!
Welcome!
Regarding your question: the major problem with XML::LibXML (which is the most
recommended module, as far as I know), is the documentation of it.
What you were missing is setDocumentElement, which sets the root for the XML.
This does what you wanted:
----
#!/usr/bin/perl
use strict;
use warnings;
use XML::LibXML;
my $doc = XML::LibXML::Document->new('1.0');
my $root = $doc->createElement('books');
$doc->setDocumentElement($root);
my $computer = $doc->createElement('computer');
$root->appendChild($computer);
# or change this to toFile()
print "Document: ", $doc->toString, "\n";
----
Sawyer.
________________________________
"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