Re: [xml] Question about parent/child (python-libxml2)



On Mon, May 10, 2004 at 06:30:27PM +0200, I wrote:
(*) The following code works for me:

Sorry, there were two lines of cruft, now for real:

#!/usr/bin/env python
import libxml2
dom = libxml2.parseDoc('''<?xml version="1.0"?>
<para>Then, shalt thou count to
<emphasis>three</emphasis>, no more, no less.</para>''')
nodes = dom.xpathEval("//para")
for n in nodes:
    if n.children:
        c = n.children
        while c != None:
            print c.serialize()
            c = c.next

Cheers,
-- 
W. Borgert <debacle debian org>, http://people.debian.org/~debacle/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]