Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Add attribute to xml with XML::LibXML

by ikegami (Pope)
on Jul 31, 2013 at 01:35 UTC ( #1047152=note: print w/replies, xml ) Need Help??


in reply to Add attribute to xml with XML::LibXML

Or using XPaths:
use strict; use warnings; use XML::LibXML; my $parser = XML::LibXML->new(); my $doc = $parser->load_xml(location => 'input.xml'); my %types = ( courbe => 'conifere', droite => 'resineux' ); for my $branch_node ($doc->findnodes('/arbre/branche')) { $branch_node->setAttribute(type => $types{$branch_node->getAttribu +te('name')}); } print $doc->toString;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1047152]
help
Chatterbox?
[dazz]: At present, I am saving the Image::Grab image to disk, then creating a new Image::Magick object that reads the disk file.
[dazz]: .
[choroba]: Discipulus Sounds interesting. Any pictures of the puppets or paintings?

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-03-27 07:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (317 votes). Check out past polls.