Suggestions for Python XML library which can search and insert
Robert Kern
rkern at ucsd.edu
Tue Jul 26 01:19:54 EDT 2005
More information about the Python-list mailing list
Tue Jul 26 01:19:54 EDT 2005
- Previous message (by thread): [Pythoncard-users] Grid problems
- Next message (by thread): Suggestions for Python XML library which can search and insert
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
lainedacier at gmail.com 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('//ipython-log[@id="default-log"]')[0] In [28]: etree.SubElement(log, 'cell') Out[28]: <Element cell at d668> -- Robert Kern rkern at ucsd.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter
- Previous message (by thread): [Pythoncard-users] Grid problems
- Next message (by thread): Suggestions for Python XML library which can search and insert
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list