I am storing a delimiter for a csv file, usually a comma, but they occasionally want a tab to separate values. The tab is being stored in the file (by TinyXml) thusly:
<Delimiter>	</Delimiter>
(if this gets translated in posting, the characters between > and < are ampersand, pound, ecks, zero, nine.)
My knowledge of XML is not sufficient for me to know that this is correct. When this value is read in, it is correctly assigned to a string, length 1, value 0x09. However at this point in the function:
if ( !textNode->Blank() )
LinkEndChild( textNode );
else
delete textNode;
the Blank() call returns true, and the text node is not appended. Again, I don't know if this is correct behavior, but it looks fishy to me.
I'm going to encode this delimiter differently, ("comma"/"tab"), but I thought I would report it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On one hand, I've mentioned here before that text nodes should be left exactly as they are when reading or writing XML -- or have a switch to operate like that, because some people care about whitespace (like you) or others who don't.
I'd say that you're better off encoding the delimiter as a word anyway, as you have. Its clearer and more visible. If you could save the xml with a real tab char, then load the file, it wouldn't be immediately clear to the viewer what that character was - or it would look like there was nothing there. This way it is 100% clear.
HTH
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am storing a delimiter for a csv file, usually a comma, but they occasionally want a tab to separate values. The tab is being stored in the file (by TinyXml) thusly:
<Delimiter>	</Delimiter>
(if this gets translated in posting, the characters between > and < are ampersand, pound, ecks, zero, nine.)
My knowledge of XML is not sufficient for me to know that this is correct. When this value is read in, it is correctly assigned to a string, length 1, value 0x09. However at this point in the function:
if ( !textNode->Blank() )
LinkEndChild( textNode );
else
delete textNode;
the Blank() call returns true, and the text node is not appended. Again, I don't know if this is correct behavior, but it looks fishy to me.
I'm going to encode this delimiter differently, ("comma"/"tab"), but I thought I would report it.
Hmm.
On its own, this does not look like a bug to me.
A bit tricky, to be sure, but not a bug.
On one hand, I've mentioned here before that text nodes should be left exactly as they are when reading or writing XML -- or have a switch to operate like that, because some people care about whitespace (like you) or others who don't.
I'd say that you're better off encoding the delimiter as a word anyway, as you have. Its clearer and more visible. If you could save the xml with a real tab char, then load the file, it wouldn't be immediately clear to the viewer what that character was - or it would look like there was nothing there. This way it is 100% clear.
HTH