MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / ReadValue

Method ReadValue

cpp/tinyxml/tinyxmlparser.cpp:1178–1247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1176
1177
1178const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
1179{
1180 TiXmlDocument* document = GetDocument();
1181
1182 // Read in text and elements in any order.
1183 const char* pWithWhiteSpace = p;
1184 p = SkipWhiteSpace( p, encoding );
1185
1186 while ( p && *p )
1187 {
1188 if ( *p != '<' )
1189 {
1190 // Take what we have, make a text element.
1191 TiXmlText* textNode = new (std::nothrow) TiXmlText( "" );
1192
1193 if ( !textNode )
1194 {
1195 if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding );
1196 return 0;
1197 }
1198
1199 if ( TiXmlBase::IsWhiteSpaceCondensed() )
1200 {
1201 p = textNode->Parse( p, data, encoding );
1202 }
1203 else
1204 {
1205 // Special case: we want to keep the white space
1206 // so that leading spaces aren't removed.
1207 p = textNode->Parse( pWithWhiteSpace, data, encoding );
1208 }
1209
1210 if ( !textNode->Blank() )
1211 LinkEndChild( textNode );
1212 else
1213 delete textNode;
1214 }
1215 else
1216 {
1217 // We hit a '<'
1218 // Have we hit a new element or an end tag? This could also be
1219 // a TiXmlText in the "CDATA" style.
1220 if ( StringEqual( p, "</", false, encoding ) )
1221 {
1222 return p;
1223 }
1224 else
1225 {
1226 TiXmlNode* node = Identify( p, encoding );
1227 if ( node )
1228 {
1229 p = node->Parse( p, data, encoding );
1230 LinkEndChild( node );
1231 }
1232 else
1233 {
1234 return 0;
1235 }

Callers

nothing calls this directly

Calls 3

SetErrorMethod · 0.80
ParseMethod · 0.80
BlankMethod · 0.80

Tested by

no test coverage detected