Re: [xml] #text element between nodes



Hi Rob

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

 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
XML_READER_TYPE_SIGNIFICANT_WHITESPACE.

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:  http://www.usingxml.com/Basics/XmlSpace  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:
http://www.w3.org/TR/xml11/#sec-white-space

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,
ATTRIBUTE).

Hope this helps,
Csaba
-- 
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]