Re: [xml] #text element between nodes

Hi Rob

On Thu, Oct 6, 2011 at 1:12 PM, Rob Eisink  wrote:

 use the xmlNewTextReaderFilename to process a xml file.

I walk through the nodes with  xmlTextReaderRead, during this I get
elememts with the name #text, the attribute is

What is the need of these kind of elements and why do I get them?

You get them because the XML standard says so.
The libxml2 library can't know whether its caller (your code) is
interested in whitespace or not, so it has to return it.

If you type "xml significant whitespace" into Google, the first link
leads to:  which contains the
following sentence:

"White space in any other location must be passed on to the processing
application, according to the XML specification."

Here's what the standard says:

I don't see why skipping whitespace nodes is a problem. I suspect you
are already skipping other node types, e.g. XML_READER_TYPE_COMMENT,
by concentrating on the "interesting" ones (ELEMENT, END_ELEMENT,

Hope this helps,
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

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