Re: [xml] find out wether a node is a leaf or contains other elements



--- Ursprüngliche Nachricht ---
Von: Daniel Veillard <veillard redhat com>
An: klemens letulé <klemens_letule gmx de>
Kopie: xml gnome org
Betreff: Re: [xml] find out wether a node is a leaf or contains other
elements
Datum: Tue, 7 Jun 2005 04:40:11 -0400

On Tue, Jun 07, 2005 at 10:35:27AM +0200, "klemens letulé" wrote:
Hello,

I just started to use libxml and am already stuck. The question is more
or
less in the subject. I want to restrict the deletion of nodes who have
no 
child elements.

  Have you read the docs ? 
    http://xmlsoft.org/tree.html
No child element may mean various things, your question is ambiguous.
Node->children == NULL might be the test you want ... or not.

Daniel


Yes, i read the docs... maybe it was too much input in a short time! 
I try to make it more clear what i want. As an element i mean now an
element as in the DTD.

<!ELEMENT fw-input-rule (action, protocol, from-ip, from-port, to-ip,
to-port, log)>
<!ELEMENT action (#PCDATA)>
<!ELEMENT protocol (#PCDATA)>
<!ELEMENT from-ip (#PCDATA)>
.
.
.

So it should be possible to delete a "fw-input-rule node" but not an 
"action node".

Is there an easy way to distinguish between elements who have other "child 
elements" and elements who are just a leaf?


-- 
Weitersagen: GMX DSL-Flatrates mit Tempo-Garantie!
Ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl



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