http://qs321.pair.com?node_id=1212566


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.