[XML-SIG] XPath in Python 2
Mike Olson
Mike.Olson@fourthought.com
Mon, 10 Jul 2000 11:45:12 -0600
Paul Prescod wrote:
>
>
> 4XPath is cleaner from a user's point of view, but it requires a lot bit
> of C/lex code for parsing the XPaths. I don't know if we would have to
> go back to the BDFL to get permission for that code to go into Python.
Or we could re write the parser in C/python. There has been some talk
of doing it with SRE....
>
> We also have the option of creating a new XPath implementation also. The
> primary virtue of doing so would be the opportunity to implement a tiny
> subset of XPath in a much smaller amount of code. The two existing
> implementations probably have more code than the rest of the Python 1.6
> XML package. And in 4XPath's case, a lot of that is C code.
Actually, very little is in C. The generated C is quite large (you've
all seen bison output before), but the "other" c is a very small amount.
Almost all of the functionality is written in python....
Mike
>
> ---
>
> My feeling is that implementing 10% of XPath in 10% of the code would
> get us 80% of the benefit. Those that need the rest can download 4XPath.
> I also think that 4XPath should be part of the pyxml distribution.
>
> The 10% that is most interesting:
>
> * a/b/c
> * a//b
> * ../
>
> Actually, that's probably not even 10% and it can be "parsed" mostly
> with a "string.split" on "/". Things like positional predicates can be
> implemented with Python sequence syntax. Attribute access can use DOM
> syntax. All in all, this looks like an afternoon's work, if we agree
> that it should go into Python.
>
> --
> Paul Prescod - Not encumbered by corporate consensus
> "Computer Associates is expected to come in with better than expected
> earnings." Bob O'Brien, quoted in
> - http://www.fool.com/news/2000/foth000316.htm
>
> _______________________________________________
> XML-SIG maillist - XML-SIG@python.org
> http://www.python.org/mailman/listinfo/xml-sig
--
Mike Olson Principal Consultant
mike.olson@fourthought.com (303)583-9900 x 102
Fourthought, Inc. http://Fourthought.com
Software-engineering, knowledge-management, XML, CORBA, Linux, Python