OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

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

What is an XPath API?



The recent discussion on an XPath API gives a good occasion to report
on the XPath API we've been developing for the Python XML libraries.

When integrating 4XSLT, we found the need for different parsers for
XPath expressions. One is based on flex and bison; it is quite fast,
but not thread-safe, and does not support Unicode input. The other one
is written in pure Python using the sre regular expression engine.

To use the same XPath implementation (i.e. set of classes representing
XML expressions, and evaluation routines), we've defined an API which
the parser can use to create a tree representation of an XPath
expression. This API involves interfaces to the expression nodes, and
factory operations to create instances of expression nodes. This API
is available at

http://www.informatik.hu-berlin.de/~loewis/xml/xpath.idl

It is defined closely to the XPath grammar, and designed to follow the
style of the DOM API; it uses OMG IDL to define the API in a
language-independent manner. A Python implementation of that API is
available in

http://www.informatik.hu-berlin.de/~loewis/xml/PyXPath-1.3.tgz
(you need 4XSLT which provides the actual implementation classes)

Since this is an API between parser and expression implementation, it
does not deal at all with evaluation (which is provided by expression
implementations to an application). Scott Boag once produced a
proposal for an API that does evaluation, but keeps the expression's
structure opaque.

I'd appreciate any comments on the parser API; if you find it useful
for your application area, just go ahead an use it.

Regards,
Martin