#65 TextNode with all spaces or \n

open
nobody
None
5
2010-04-19
2010-04-19
Anonymous
No

In my project I need to create text storage in XML. Sometimes it contain only whitespaces. TinyXml deletes text nodes with whitespases only. Even though condenseWhiteSpace is false.

May you add something like

if ( *p != '<' || pWithWhiteSpace != p)
{
// Take what we have, make a text element.
TiXmlText* textNode = new TiXmlText( "" );

if ( !textNode )
{
return 0;
}

if ( TiXmlBase::IsWhiteSpaceCondensed() )
{
p = textNode->Parse( p, data, encoding );
}
else
{
// Special case: we want to keep the white space
// so that leading spaces aren't removed.
p = textNode->Parse( pWithWhiteSpace, data, encoding );
}

if ( !textNode->Blank() || !TiXmlBase::IsWhiteSpaceCondensed())
LinkEndChild( textNode );
else
delete textNode;

in TiXmlElement::ReadValue to solve that problem?

Discussion


Log in to post a comment.