[xml] Possible bug in xmlGetNodePath

Hi All,

I have notice thatÂxmlGetNodePath doesn't return the right path if the same namespace has different prefixes in the document.

For example for calling xmlGetNodePath on any of the following nodes in this document will return "/root/l_0:l1"

/************** Document with multiple prefixes for the same namespace ****************/
<root xmlns:a="http://a.b/c">
 <l_0:l1 xmlns:l_0="http://ns.org/ns/" id="id_0"/>
 <l_1:l1 xmlns:l_1="http://ns.org/ns/" id="id_1"/>
 <l_2:l1 xmlns:l_2="http://ns.org/ns/" id="id_2"/>
 <l_3:l1 xmlns:l_3="http://ns.org/ns/" id="id_3"/>
 <l_4:l1 xmlns:l_4="http://ns.org/ns/" id="id_4"/>
 <l_5:l1 xmlns:l_5="http://ns.org/ns/" id="id_5"/>
 <l_6:l1 xmlns:l_6="http://ns.org/ns/" id="id_6"/>
 <l_7:l1 xmlns:l_7="http://ns.org/ns/" id="id_7"/>
 <l_8:l1 xmlns:l_8="http://ns.org/ns/" id="id_8"/>
 <l_9:l1 xmlns:l_9="http://ns.org/ns/" id="id_9"/>
/************** End ****************/

However if I use the same prefix for all nodes,ÂxmlGetNodePath will return the correct xpath for each node (/root/ns:l1[1],Â/root/ns:l1[2], etc...)

/************** Document with one prefix per namespace ****************/
<root xmlns:a="http://a.b/c">
 <ns:l1 xmlns:ns="http://ns.org/ns/" id="id_0"/>
 <ns:l1 xmlns:ns="http://ns.org/ns/" id="id_1"/>
 <ns:l1 xmlns:ns="http://ns.org/ns/" id="id_2"/>
 <ns:l1 xmlns:ns="http://ns.org/ns/" id="id_3"/>
 <ns:l1 xmlns:ns="http://ns.org/ns/" id="id_4"/>
 <ns:l1 xmlns:ns="http://ns.org/ns/" id="id_5"/>
 <ns:l1 xmlns:ns="http://ns.org/ns/" id="id_6"/>
 <ns:l1 xmlns:ns="http://ns.org/ns/" id="id_7"/>
 <ns:l1 xmlns:ns="http://ns.org/ns/" id="id_8"/>
 <ns:l1 xmlns:ns="http://ns.org/ns/" id="id_9"/>
/************** End ****************/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]