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

On Sun, May 09, 2004 at 03:39:47PM -0400, Daniel Veillard wrote:
  the para node has a list of children. The childens are a doubly
linked list (prev/next) . 
  what you want is the serialization of that list. You can serialize
each children independantly and concatenate the result.

I think, that I did exactly this in the first place :-)  As
I wrote in my initial mail,
I did:

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

I got:

"Then, shalt thou count to

, no more, no less."

So my question was/is: How can I get rid of the 'three'
(second last line)?  Sorry for being not clear about the

W. Borgert <debacle debian org>,

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