Thread XML::LibXML - toString: Ersetzen von childNodes (1 answers)
Opened by AcidOverflow at 2006-01-26 14:42

esskar
 2006-01-26 21:34
#62323 #62323
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
du machst wohl was falsch

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
use warnings;

use XML::LibXML;

my $xc = XML::LibXML->new;
my $node = $xc->parse_string('<?xml version="1.0" encoding="UTF-8"?><xData><xID>28344</xID><mType>s</mType></xData>');

print $node->toString;

my $path = '//xID';
my $value = '123';
if (my $subnode = $node->findnodes($path)->[0]) {
$subnode->removeChildNodes();
$subnode->appendTextNode( $value );
}

print $node->toString;

View full thread XML::LibXML - toString: Ersetzen von childNodes