Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Parsing and manipulating XML

by hippo (Bishop)
on Apr 09, 2018 at 08:27 UTC ( [id://1212566]=note: print w/replies, xml ) Need Help??


in reply to Parsing and manipulating XML

Here's an SSCCE:

use strict; use warnings; use Test::More tests => 2; use XML::LibXML; my $doc = <<EOT; <Build-Doc> <Build> text.mak <Targets>all</Targets> <Nmake></Nmake> </Build> </Build-Doc> EOT my $parser = XML::LibXML->new(); my $dom = $parser->load_xml (string => $doc); my @str; push @str, $dom->toString; my $content = $dom->getElementsByTagName ('Build')->pop->firstChild->t +extContent; like ($content, qr/^\s+text.mak\s+$/, 'Text matches'); push @str, $dom->toString; is ($str[0], $str[1], 'DOM untouched');

Not the most elegant, perhaps, but shows one approach.

Log In?
Username:
Password:

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

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

    No recent polls found