There is no such thing as "behaviour of XML itself". XML is just bytes, in a file, over a stream, etc. If the byte array contains spaces (or other whitespace chars) then there are spaces/whitespace in the byte array. End of story.
However - its up to the parser how it interprets those bytes, and some choose the HTML approach - condense the whitespace.
Personally, I find any manipulation of my data inappropriate. In TinyXml try turning it off with SetCondenseWhiteSpace(false).
HTH
Ellers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I believe - I haven't looked at that part of the code in a while - that white space condensing only applies to the interior space, not the space before or after the element text. There was quite a bit of debate about this a couple of years ago and that was settled on as the least offensive solution.
is not clear on the topic. Apparently putting examples or clarifying points in specs is considered by W3C to be pandering to the technologically unworthy.
In any case, this is an area of future improvement for TinyXML.
lee
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have been using TiXML without any problem for couple of my projects now but I just came upon an issue.
I have data like:
<a> data</a>
But:
TiXmlText* text->Value()
always seems to return:
data (the leading and trailing white spaces are removed.
It happens the same with IE too so I think its a behavior of XML itself.
I have even set SetCondenseWhiteSpace (...) to false but of no avail. It always returns data with leading and trailing white space removed.
Anyway, I can keep the space intact? Its kinda important in what I am doing.
Karam
There is no such thing as "behaviour of XML itself". XML is just bytes, in a file, over a stream, etc. If the byte array contains spaces (or other whitespace chars) then there are spaces/whitespace in the byte array. End of story.
However - its up to the parser how it interprets those bytes, and some choose the HTML approach - condense the whitespace.
Personally, I find any manipulation of my data inappropriate. In TinyXml try turning it off with SetCondenseWhiteSpace(false).
HTH
Ellers
I believe - I haven't looked at that part of the code in a while - that white space condensing only applies to the interior space, not the space before or after the element text. There was quite a bit of debate about this a couple of years ago and that was settled on as the least offensive solution.
The current XML spec:
http://www.w3.org/TR/2004/REC-xml-20040204/#sec-white-space
is not clear on the topic. Apparently putting examples or clarifying points in specs is considered by W3C to be pandering to the technologically unworthy.
In any case, this is an area of future improvement for TinyXML.
lee