Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Parsing and manipulating XML

by hippo (Chancellor)
on Apr 09, 2018 at 08:27 UTC ( #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
Node Status?
node history
Node Type: note [id://1212566]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2020-11-28 14:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?