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



On Wed, Feb 11, 2004 at 07:54:33PM +0100, Igor Zlatkovic wrote:
oliverst online de wrote:
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?

Function: xmlIsBlankNode
 int xmlIsBlankNode (xmlNodePtr node)

Or am I misunderstanding something?

  That's the closest you can get. But basically, *any* text in element
content is significant. Only the application can tell if a TEXT_NODE
is significant or not:

<p>
   <b>important</b>
</p>

  There is no way to say that what may look like as formatting text
isn't part of the informations that the author expected to provide the
reader of the document. If you have a DTD content model you may be
able to guess it, but without it you just can't assume anything.
  The content of <p> is not empty, and you have no way to decide
unless you have other specific knowledge if this is equivalent to

<p><b>important</b></p>

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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