XPath for KHTML (Was: Re: XML rendering)

Tobias Anton TA at ESC-Electronics.de
Wed Jun 9 11:01:17 CEST 2004


On Dienstag, 8. Juni 2004 14:01, Zack Rusin wrote:
> On Tuesday 08 June 2004 06:32, Tobias Anton wrote:
> > Where is XPath support coming up?
>
> Rich and I started writting one for fun quite a while ago. The code is
> in kdenonbeta/xpath.
>
> > If there is already another solution, I'd consider to drop my
> > implementation - otherwise it could become a starting point for a
> > complete implementation. In that case, I'd propose moving my
> > repository to cvs.kde.org.
>
> How complete is yours? How good is it? :)

It is a complete parser and interpreter except for the following 
TODO-elements:

It lacks support for variables and is pointer-based. No refcounting, no 
*impl-classes.
Nodeset-Number comparison and evaluation for the "~" and "!"-operator are 
missing.
The functions "id", "local-name", "namespace-uri" and "name" can be neither 
evaluated nor parsed.
The "namespace"-axis is not implemented and yields an empty result.
No exceptions are thrown at all.

So, as you can see, it is mainly missing support for XML-specific namespace 
stuff and some functions. 

> But seriously look at the code in kdenonbeta/xpath and give me a holla
> if you think we should use your code (or just feel free to hack in
> whetever you need in our implementation).

Your code seems to consist mostly of skeleton files, but has a lot of those.

Mine is completely different: a lot of implementation, but in fewer files. All 
path elements (expressions, steps, functions...) reside in only one source 
file. As I already mentioned, there is no distinction between interface and 
*impl-classes and no refcounting. It uses a QValueList<DOM::Node>-derived 
class for the NodeSet and has a relatively simple interpreter context class.

So, if we switch to my code, some cleanup would be needed to accomodate to 
your coding style. A Makefile.am would have to be added, but nontheless, my 
interpreter can be used out-of-the-box for the vast majority of all 
real-world XPath-statements. Should we therefore add my "libkxpath" module to 
kde's CVS?

Cheers,
-- Tobias



More information about the Khtml-devel mailing list