Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Print specific attributes "not their values" of an XML file using Perl

by runrig (Abbot)
on Sep 11, 2015 at 18:08 UTC ( [id://1141701]=note: print w/replies, xml ) Need Help??


in reply to Print specific attributes "not their values" of an XML file using Perl

If you're up to using a different library, then:
use warnings; use strict; use XML::Rules; my $xml = <<XML; <root> <Validation byCluster="true" byOtherPop="false" byHapMap="true" by1000 +G="true"/> </root> XML my @rules = ( Validation => sub { my $d = $_[1]; my @v = grep { $d->{$_} eq 'true' } keys %$d; print join(",", @v), "\n"; }, _default => undef, ); my $xr = XML::Rules->new( rules => \@rules ); $xr->parse($xml);
  • Comment on Re: Print specific attributes "not their values" of an XML file using Perl
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-18 01:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found