MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / Parse

Method Parse

3rdparty/tinyxml2/tinyxml2.cpp:2447–2475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2445
2446
2447XMLError XMLDocument::Parse( const char* xml, size_t nBytes )
2448{
2449 Clear();
2450
2451 if ( nBytes == 0 || !xml || !*xml ) {
2452 SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
2453 return _errorID;
2454 }
2455 if ( nBytes == static_cast<size_t>(-1) ) {
2456 nBytes = strlen( xml );
2457 }
2458 TIXMLASSERT( _charBuffer == 0 );
2459 _charBuffer = new char[ nBytes+1 ];
2460 memcpy( _charBuffer, xml, nBytes );
2461 _charBuffer[nBytes] = 0;
2462
2463 Parse();
2464 if ( Error() ) {
2465 // clean up now essentially dangling memory.
2466 // and the parse fail can put objects in the
2467 // pools that are dead and inaccessible.
2468 DeleteChildren();
2469 _elementPool.Clear();
2470 _attributePool.Clear();
2471 _textPool.Clear();
2472 _commentPool.Clear();
2473 }
2474 return _errorID;
2475}
2476
2477
2478void XMLDocument::Print( XMLPrinter* streamer ) const

Callers 4

loadFromTextMethod · 0.80
VerifyXMLFunction · 0.80
writeTreeXSDFunction · 0.80
createTreeFromTextMethod · 0.80

Calls 4

ErrorFunction · 0.85
NoChildrenFunction · 0.85
SkipWhiteSpaceFunction · 0.85
ClearMethod · 0.45

Tested by

no test coverage detected