Skip Menu |
 

This queue is for tickets about the XML-XPath CPAN distribution.

Report information
The Basics
Id: 80277
Status: resolved
Priority: 0/
Queue: XML-XPath

People
Owner: MANWAR [...] cpan.org
Requestors: chelpanov [...] yandex.ru
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.13
Fixed in: 1.22



Subject: createNode and namespaces
Download (untitled) / with headers
text/plain 1.2k
Nodes are created without namespace script1: ----- use strict; use XML::XPath; my $xp = new XML::XPath(xml => '<?xml version="1.0" encoding="UTF-8" ?> <root> <a> </a> </root>'); $xp->createNode('/root/b/@aaa'); $xp->setNodeText('/root/b/@aaa','aaa'); $xp->createNode('/root/b/@ccc'); $xp->setNodeText('/root/b/@ccc','ccc'); $xp->setNodeText('/root/b','xxx'); print $xp->getNodeAsXML(); ----- result (correct) is: ----- <root> <a> </a> <b aaa="aaa" ccc="ccc">xxx</b></root> ----- script2: ----- use strict; use XML::XPath; my $xp = new XML::XPath(xml => '<?xml version="1.0" encoding="UTF-8" ?> <n1:root xmlns:n1="http://n1.zzz.ru" xmlns:n2="http://n2.zzz.ru" xmlns:n3="http://n3.zzz.ru"> <n2:a> </n2:a> </n1:root>'); $xp->createNode('/n1:root/n3:b/@aaa'); $xp->setNodeText('/n1:root/n3:b/@aaa','aaa'); $xp->createNode('/n1:root/n3:b/@ccc'); $xp->setNodeText('/n1:root/n3:b/@ccc','ccc'); $xp->createNode('/n1:root/n3:b'); $xp->setNodeText('/n1:root/n3:b','xxx'); print $xp->getNodeAsXML(); ----- result (bug) is: ----- <n1:root xmlns:n1="http://n1.zzz.ru" xmlns:n2="http://n2.zzz.ru" xmlns:n3="http://n3.zzz.ru"> <n2:a> </n2:a> <n3:b aaa="" /><n3:b ccc="" /><n3:b /></n1:root> ----- The proposed patch attached
Subject: XPath.pm
Download XPath.pm
text/x-perl 16.8k

Message body is not shown because it is too large.

Download (untitled) / with headers
text/plain 119b
Hi, Thanks for reporting the issue and the patch as well. I will soon patch the code. Best Regards, Mohammad S Anwar
Resolved.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.