[lxml-dev] DOM2 range() support?
Stefan Behnel
stefan_ml at behnel.de
Sun Jul 15 21:13:31 CEST 2007
Hi,
just continuing this discussion on the right mailing list (from XML-SIG).
Gloria W wrote:
> I need to be able to do DOM2 range() functionality, to meet the
> requirements of a back end Dojo interface I have written in Python.
> I have already written my own DOM2 compliant node schema, out of
> necessity, but without the range functionality, since it is so tedious.
> I have forced a requirement on my Dojo developer colleague to not make
> use of range() for the time being.
> I wish it were properly supported in Python, but for the time being, I
> seem to be the only person needing it.
This is actually the first time I come across the concept of DOM2 ranges.
http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html
Please correct me, but from a quick look at this:
http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Definitions
isn't that simply a tuple of two positions, where each position contains an
Element and optionally one of the following:
- an attribute "{ns}name" and a string position in the attribute value
- a string position in the text
- a string position in the tail
Admittedly, the DOM2 interface on top of that is a little more complex and
(should I say it?) DOM-ishly obfuscated, but there shouldn't be more to it
than that, right? I mean, the respective W3C spec is only some 13 sections
long, there *can't* be more than that. :)
Hmm, now that we have cool HTML support and CSS selection, I wouldn't mind
having a Range class hanging around in some (lxml.range?) module. Doesn't even
sound like you'd have to implement it in Pyrex, Python code should be enough here.
Stefan
More information about the lxml-dev
mailing list