Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: XML::LibXML problem...

by lestrrat (Deacon)
on Mar 08, 2002 at 20:05 UTC ( [id://150410]=note: print w/replies, xml ) Need Help??


in reply to XML::LibXML problem...

This seems to work for me:

use strict; use XML::LibXML; my $xml =<<'EOM'; <?xml version="1.0" encoding="ISO-8859-1" ?> <form> <method>POST</method> <action>/cgi/process.cgi</action> <input> <type>text</type> <name>name1</name> <required>0</required> <value></value> <comment>This field is not required.</comment> </input> <input> <type>text</type> <name>name3</name> <required>1</required> <value></value> <comment>Put three words here!</comment> <test> my @tmp = split(/\ /, shift()); return 1 if ( $#tmp == 2 ); return 0; </test> </input> </form> EOM my $parser = XML::LibXML->new(); my $dom = $parser->parse_string( $xml ); my $info = $dom->createElement( 'info' ); my $failure = $dom->createElement( 'failure' ); my $reason = $dom->createTextNode( 'blah' ); $failure->appendChild( $reason ); $info->appendChild( $failure ); my $form = $dom->getDocumentElement; $form->appendChild( $info ); print $dom->toString;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://150410]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-19 08:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found