Re: [xml] PATCH: XPOINTER and friends



On Fri, Sep 29, 2006 at 05:39:08PM -0500, Ross J. Reedstrom wrote:
Daniel and all:

  Hi,

 I finally had time to work on it.

I'm writing on behalf of Brian West, Stefan Anca and myself.  By merging
all our brains, we've come up with a candidate implementation of python
wrapper code for returning XPATH_POINT, XPATH_RANGE, XPATH_LOCATIONSET.
We've choosen to represent a POINT as a tuple of a node and an integer
offset into the content of the node. A RANGE then is a list of POINTs,
and a LOCATIONSET is a list of RANGEs.

I've attached a diff against CVS head (from repository at
anoncvs.gnome.org:/cvs/gnome/libxml2 ), with new files as separate
attachements.

  The patch looks just fine to me, I applied it and commited it to CVS,
thanks a lot !

There's a bit of impedance mis-match between xpointer's 1 based offsets
to points between characters, and python 0 based indexes into character
array-like strings. We chose not to attempt to adjust those.

The final hurdle was to fixup xpathObjectRet() to not assume any list
was a list of nodes (since we've got ints in there as well). This did
cause one change in the API from the python side: previously, tuples of 
nodes were returned as a list. We preserve the tupleness of those now.
Looks like all other uses of python tuples are in error handlers or as
arguments to PyEval: none were passed to xpathObjectRet.

A student working with us even coded up some tests, which I've attached
as well: they need to be dropped in python/tests. They may need fixing
up to match your test machinery. Right now, they're a bit chatty.

  Right the test as is can't really be commited since it breaks the no output
assumption of 'make tests' in python. Basically the python code would have
to embbed the logic of checking the output, instead of relying on the user
to garantee it's correct (and honnestly it's really not trivial). Can you
please fix tstxpointer.py to work that way and send it back ?
I also had to roll back the python/test/Makefile.am change to not reference
tstxpointer.py since I can't commit it as is.

  thanks !

  thanks !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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