[xml] Possible Problem|Bug in the XPath Subsystem



Hello,

While preparing XML::LibXML for a release I added some tests for XPath 
statements. I stumbled over some strange issues with XPath statements.
It looks pretty much like a inconsisty in the XPath engine to me.

I give some example documents. All statements are executed on the
document node or the document element node.

     <C:A xmlns:C="D"><C:A><C:B/></C:A><C:A><C:B/></C:A></C:A>

delivers with the following XPath statement the expected results:

     descendant-or-self::node()/C:A

all three nodes are returned as expected if run on the root element.

This is allright if the following documents and statements won't fail, 
but they do. :(

Case a) with default namespaces

    <A xmlns="D"><A><B/></A><A><B/></A></A>

and the stantement 

   descendant-or-self::node()/A

doesn't return anything

Case b) no namespace but a 'prefix'

    <C:A><C:A><C:B/></C:A><C:A><C:B/></C:A></C:A>

and the statement 

    descendant-or-self::node()/C:A

returns no nodes

funny enough the statement 

    descendant-or-self::*[local-name()='A']

returns three nodes on the same document, although there is no localname 'A'
in the first place. and the statement

    descendant-or-self::*[local-name()='C:A']

again returns nothing, although I expect no namespace prefix present.

Because of this inconsisty I am a bit confused ... is it just me or is it a
bug?

Christian



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