How to search XML? Are there special libs?

Diez B. Roggisch deets at nospam.web.de
Fri Mar 17 05:08:30 EST 2006


Sullivan WxPyQtKinter wrote:

> I am now using XML to record my lab records in quite a complex way, in
> which about 80 tags are used to identify different types of data. I
> think it is  a good idea to search for a popular and mature XML search
> engine before I started to program it myself:
> 
> I need the following functions:
> Search and get all the records that share the same tree structures.
> Search records containing a specific node or sub tree structres.
> 
> Does anyone know about something suitable? Or other powerful XML search
> engine in Python?
> Thank you so much for help.

XPath is your friend. Available at least in the 4suite-xml-libraries. I'm
not aware of anything that resembles a more database-like approach, but at
least you can issue queries against the xml.

However you might reconsider your choice of a persistence model. Queries is
what SQL is for, and you very well might be better off using e.g. sqlite
and a XML-im/export if that is what you need.

Diez



More information about the Python-list mailing list