[EMAIL PROTECTED] wrote:
> Hi,
> 
> I'm looking for a library that can search through an XML document tree,
> locate an element by attribute (ideally this can be done through
> XPath), and insert an element (as its child).

Try lxml:

   http://codespeak.net/lxml/

In [25]: from lxml import etree

In [26]: nbk = etree.parse('tut-2.3.5-db.nbk')

In [27]: log = root.xpath('//[EMAIL PROTECTED]"default-log"]')[0]

In [28]: etree.SubElement(log, 'cell')
Out[28]: <Element cell at d668>

-- 
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to