Re: Suggestions for Python XML library which can search and insert

2005-07-29 Thread uche . ogbuji
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). Simple? Yes? ...but the code I've seen so far which does this uses 'nested for loops' for trees which are

Re: Suggestions for Python XML library which can search and insert

2005-07-26 Thread Steven D'Aprano
[EMAIL PROTECTED] wrote: Simple? Yes? ...but the code I've seen so far which does this uses 'nested for loops' for trees which are relatively shallow compared to mine. So I'm wondering if you could give me some suggestions as to which XML library could do this without resorting to nested for

Re: Suggestions for Python XML library which can search and insert

2005-07-26 Thread lainedacier
Why do you care if they are nested for loops? What is the problem you are experiencing that is caused by for loops? The nested loops which I speak of are highly dependent on the structure of the document tree. The examples which I've seen using DOM or ElementTree deal with shallow trees, but

Suggestions for Python XML library which can search and insert

2005-07-25 Thread lainedacier
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). Simple? Yes? ...but the code I've seen so far which does this uses 'nested for loops' for trees which are

Re: Suggestions for Python XML library which can search and insert

2005-07-25 Thread Robert Kern
[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