MCPcopy Create free account
hub / github.com/JayXon/Leanify / ParseDeep

Method ParseDeep

lib/tinyxml2/tinyxml2.cpp:850–924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

848
849
850char* XMLNode::ParseDeep( char* p, StrPair* parentEnd )
851{
852 // This is a recursive method, but thinking about it "at the current level"
853 // it is a pretty simple flat list:
854 // <foo/>
855 // <!-- comment -->
856 //
857 // With a special case:
858 // <foo>
859 // </foo>
860 // <!-- comment -->
861 //
862 // Where the closing element (/foo) *must* be the next thing after the opening
863 // element, and the names must match. BUT the tricky bit is that the closing
864 // element will be read by the child.
865 //
866 // 'endTag' is the end tag for this node, it is returned by a call to a child.
867 // 'parentEnd' is the end tag for the parent, which is filled in and returned.
868
869 while( p && *p ) {
870 XMLNode* node = 0;
871
872 p = _document->Identify( p, &node );
873 if ( node == 0 ) {
874 break;
875 }
876
877 StrPair endTag;
878 p = node->ParseDeep( p, &endTag );
879 if ( !p ) {
880 DeleteNode( node );
881 if ( !_document->Error() ) {
882 _document->SetError( XML_ERROR_PARSING, 0, 0 );
883 }
884 break;
885 }
886
887 XMLElement* ele = node->ToElement();
888 if ( ele ) {
889 // We read the end tag. Return it to the parent.
890 if ( ele->ClosingType() == XMLElement::CLOSING ) {
891 if ( parentEnd ) {
892 ele->_value.TransferTo( parentEnd );
893 }
894 node->_memPool->SetTracked(); // created and then immediately deleted.
895 DeleteNode( node );
896 return p;
897 }
898
899 // Handle an end tag returned to this level.
900 // And handle a bunch of annoying errors.
901 bool mismatch = false;
902 if ( endTag.Empty() ) {
903 if ( ele->ClosingType() == XMLElement::OPEN ) {
904 mismatch = true;
905 }
906 }
907 else {

Callers 1

ParseAttributesMethod · 0.80

Calls 9

IdentifyMethod · 0.80
SetErrorMethod · 0.80
TransferToMethod · 0.80
SetTrackedMethod · 0.80
GetStrMethod · 0.80
ValueMethod · 0.80
ParseTextMethod · 0.80
ParseNameMethod · 0.80
EmptyMethod · 0.45

Tested by

no test coverage detected