[xml] xpath selection of node with namespace



Hi all,

I've being tring out the example given on xmlsoft website
http://www.xmlsoft.org/gjobs.xml (with the windows binaries and a
linux version built from a fairly recent cvs copy) and viewing with
xmllint using the --shell option. Even though you can select a node within
this example by matching content eg

/>cat //*[text() ="Open"]
<gjob:Status>Open</gjob:Status>

selecting a namespace node doesn't

/ > cat gjob:Helping
Error E:\igor\src\libxml2-2.4.2\xpath.c:8056: Undefined namespace prefix
gjob:Helping
            ^
xmlXPathEval: evaluation failed
gjob:Helping: no such node
/ > cat /gjob:Helping
Error E:\igor\src\libxml2-2.4.2\xpath.c:8056: Undefined namespace prefix
/gjob:Helping
             ^
xmlXPathEval: evaluation failed
/gjob:Helping: no such node
/ >

I've look at the source at home and it seems that since the root node 
doesn't have namespace information (in the example "gjob:Helping"
holds it) the child can't be found. 

If you try selecting without the namespace prefix eg
/> cat /Helping 

It doesn't succeed either because the child has a namespace

This occurs also under a version I've taken from the cvs.kde.org 

I appreciate the complexity of this libxml2 project and hope this helps.

bye,

Keith Isdale


e-mail: z1462441 cit-student gu edu au
post : 30 Pointer court, Shailer Park, Australia : zip code 4128 
ph: +617 3801 4797






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