Re: RE: [xml] clarification about "empty" text nodes

err, no.

Look at this example:


If I take the pointer to "Node" and do a xmlNodeGetContent() on it, I
get formatting stuff for the whole underlying tree. Same witha pointer
to "Node1" gives me "Value" as result. The problem is, that I can't
determinate it by the type as "Node" is type 1 (XML_ELEMENT_NODE) and it
has a child with the name "text" of type 3 (XML_TEXT_NODE) and it
contains the formatting stuff. "Node1" is the same type and has the same
type as child with the name "text" and it contains "Value". By simple
type-checking it doesn't work.

-> childs 
xmlNodeGetContent() result -> formatting chars for underlying tree
(always beginning with 0x0a???)

xmlNodeGetContent() result -> "Value"

Ron Ohmer <rohmer aisconsulting net> schrieb am 11.02.2004, 17:05:59:
Just check the type..

Type 3 is one of your "Empty" text nodes (i.e. Formatting Whitespace)
Type 1 is a value.

-----Original Message-----
From: xml-admin gnome org [mailto:xml-admin gnome org] On Behalf Of
oliverst online de
Sent: Wednesday, February 11, 2004 6:10 AM
To: xml gnome org
Subject: [xml] clarification about "empty" text nodes

I got a function, which gets a node and reads the content of it. The
problem is, that in some cases it might be a node, that has no text. In
that case I get the whole tree as formated text, because libxml2 stores
such formatting chars in the "empty" text nodes. And because that
content of the text nodes isn't empty I can just verify an empty text
node, when I check the first char of "content" for 0x0a. Is that right?
xml mailing list, project page
xml gnome org

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