[XML-SIG] 'searching' XML documents to extract 'chunks' of XML
Wed, 10 Mar 1999 22:29:29 -0700
> Hi all,
> I've recently fallen onto 'XML in python' from a 'XML in Perl/PHP'
> perspective and after downloading and playing with the XML-0.5
> release I'm mightily impressed!. As I'm new to Python, I keep finding
> things that make me go 'ooo, thats neat!'.
> One thing I really need to do is to 'query' XML documents, and
> extract portions of them. In Perl I would use the XQL module, based
> on the XQL http://www.w3.org/TandS/QL/QL98/pp/xql.html W3C note,
> which allows you to select tags, and optionally, their children
> based upon quite a few search criteria (eg value of attribute or
> whether the parent has an attribute or content that matches your
> search term).
> Is there anything like this in the XML-Python world?
> any pointers gratefully received!
Well, speaking of "pointers", you might want to look at Lars Garshol's
PyPointers package for the purpose. It implements part of the XPointer spec,
allowing you to point to portions of a document, and if you combine this with
a DOM representation of your doc, you might be able to get what you need. It
really depends on what exactly you need to extract/query: XPointer is not as
ambitious as XQL.
The package is at
It comes with examples that use PyDOM, and 4DOM ships with a modified xptr.py
with support for 4DOM, so you have choice (ever a lovely thing).
FourThought LLC, IT Consultants
Software engineering, project management, Intranets and Extranets