#19 closed enhancement (fixed)
Support for unions in XPath expressions
Reported by: | cmlenz | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.1 |
Component: | XPath support | Version: | |
Keywords: | Cc: |
Description
The XPath support in Markup is currently limited to a single path expression. The top-level expression should actually be a union expression that may define multiple path expressions, for example:
*|text()
That would match both child elements and text nodes.
Change History (4)
comment:1 Changed 18 years ago by michele
comment:2 Changed 18 years ago by cmlenz
Michele, thanks for the feedback. I'm aware of lxml. While I haven't yet used it myself, I am a big fan of the libxml2/libxslt duo, and agree that lxml looks like a very nice library for heavy XML processing. However, I wanted to avoid depending on any library that would require native code and bindings. The primary reason I wrote Markup was that we need a new template engine for Trac, and the C-based ClearSilver is already too much of a pain to install for many users.
In addition, the XPath support in Markup is rather special as it operates on streams and not on trees, similar to e.g. Sequentual XPath.
comment:3 Changed 18 years ago by cmlenz
- Resolution set to fixed
- Status changed from new to closed
Okay, back to this ticket, support for union expressions was added in [123], along with many other improvements to the XPath support.
comment:4 Changed 18 years ago by michele
Thanks to you cmlenz, this definitely clear things out.
I think your decision is pretty reasonable given the fact that markup only depends on python 2.3/2.4.
Again keep up the great work and thanks for it!
Hi cmlenz,
Reading MarkupVsKid it seems you decided to not use ElementTree since it lacks position reporting, I was just wondering if you've considered using lxml instead, it doesn't use expat but libxml2 and libxslt this provides great error reporting and even full xpath support.
You can find more info here: http://codespeak.net/lxml/
Keep up the great work.