Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Using Perl XML::SAX to modify XML documents

by mirod (Canon)
on Apr 20, 2012 at 12:29 UTC ( #966187=note: print w/replies, xml ) Need Help??

in reply to Using Perl XML::SAX to modify XML documents

Also cross-posted from SO, an efficient solution with XML::Twig:

#!/usr/bin/perl use strict; use warnings; use XML::Twig; XML::Twig->new( twig_roots => { span => sub { $_->set_tag( 'naps +')->flush; }, expandable => sub { XML::Twig::Elt->ne +w( expanded => 'this is an expanded element')->print; }, }, twig_print_outside_roots => 1, ) ->parsefile( \*DATA); __DATA__ <?xml version="1.0" encoding="UTF-8"?> <html xmlns="" xmlns:wicket="http://wicket"> <body> <wicket:panel> <form wicket:id="mvpForm"> <span>Edit Information: </span> <input type="checkbox" wicket:id="editForm"/> <span>Name: </span> <span wicket:id="name"></span> <input type="text" wicket:id="nameEdit"/> <span>Last Name: </span> <span wicket:id="lastName"></span> <input type="text" wicket:id="lastNameEdit"/> <span>DOB: </span> <span wicket:id="dob"></span> <input type="text" wicket:id="dobEdit"/> <span>Occupation: </span> <span wicket:id="occupation"></span> <input type="text" wicket:id="occupationEdit"/> <span>Gender: </span> <span wicket:id="gender"></span> <span wicket:id="genderEdit"/> <input type="submit" wicket:id="submit"/> </form> <xmltag> <expandable/> </xmltag> </wicket:panel> </body> </html>

Replies are listed 'Best First'.
Re^2: Using Perl XML::SAX to modify XML documents
by dryajov (Initiate) on Apr 20, 2012 at 19:30 UTC
    Thanks, I've accepted your responce on stackoverflow. This seems the most straigh forward way of working with XML for the example I provided.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2021-09-19 12:24 GMT
Find Nodes?
    Voting Booth?

    No recent polls found