[XML-SIG] XPathGrammar question

Martijn Faassen faassen@vet.uu.nl
Fri, 21 Dec 2001 04:52:51 +0100


Hi there,

I'm currently exploring various XML query techniques and am looking
into doing an XPath implementation that takes advantage of them. 
Though I'd have to write a parser myself and was already looking at
Yapps, when I discovered there was already a parser (made with Yapps
no less) right there in the pyxml distribution.

So now I'm trying to use it. Late last year Martin posted an IDL
description of a pluggable parser system, and I can also find a new
IDL description adding some interfaces to support XSLT. Looking at the
sources however I think the interfaces have evolved a bit since then;
is there a more up to date IDL somewhere?

I also discovered something that looks like a bug, though since I'm
so new to it I'm not sure. I've implemented a simple ExprFactory class
with the interfaces gleaned from the IDL and sources that basically just
prints out stuff so I can see what's going on. 

However, when I try to parse the expression:

  //foo

I get the following output:

createAxisSpecifier 4
createNameTest None foo
createStep 4 (None, 'foo') []
createAbbreviatedAbsoluteLocationPath (4, (None, 'foo'), [])

i.e. createAxisSpecifier() gets as its 'name' argument the number 4, which
indicates the CHILD axis. // should get me the DESCENDANT_OR_SELF (6) axis
however. Placing // in the middle such as with foo//bar still seems to 
get me child. Using non-abbreviated spelling does get me a 6:

createAxisSpecifier 6
createNameTest None foo
createStep 6 (None, 'foo') []
createAbsoluteLocationPath (6, (None, 'foo'), [])

Shouldn't I be getting the same in both cases? Is this a bug or am I
missing something?

Regards,

Martijn