MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / ParseDeep

Method ParseDeep

Dependencies/tinyxml2/src/tinyxml2.cpp:985–1097  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

983
984
985char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
986{
987 // This is a recursive method, but thinking about it "at the current level"
988 // it is a pretty simple flat list:
989 // <foo/>
990 // <!-- comment -->
991 //
992 // With a special case:
993 // <foo>
994 // </foo>
995 // <!-- comment -->
996 //
997 // Where the closing element (/foo) *must* be the next thing after the opening
998 // element, and the names must match. BUT the tricky bit is that the closing
999 // element will be read by the child.
1000 //
1001 // 'endTag' is the end tag for this node, it is returned by a call to a child.
1002 // 'parentEnd' is the end tag for the parent, which is filled in and returned.
1003
1004 XMLDocument::DepthTracker tracker(_document);
1005 if (_document->Error())
1006 return 0;
1007
1008 while( p && *p ) {
1009 XMLNode* node = 0;
1010
1011 p = _document->Identify( p, &node );
1012 TIXMLASSERT( p );
1013 if ( node == 0 ) {
1014 break;
1015 }
1016
1017 int initialLineNum = node->_parseLineNum;
1018
1019 StrPair endTag;
1020 p = node->ParseDeep( p, &endTag, curLineNumPtr );
1021 if ( !p ) {
1022 DeleteNode( node );
1023 if ( !_document->Error() ) {
1024 _document->SetError( XML_ERROR_PARSING, initialLineNum, 0);
1025 }
1026 break;
1027 }
1028
1029 XMLDeclaration* decl = node->ToDeclaration();
1030 if ( decl ) {
1031 // Declarations are only allowed at document level
1032 //
1033 // Multiple declarations are allowed but all declarations
1034 // must occur before anything else.
1035 //
1036 // Optimized due to a security test case. If the first node is
1037 // a declaration, and the last node is a declaration, then only
1038 // declarations have so far been addded.
1039 bool wellLocated = false;
1040
1041 if (ToDocument()) {
1042 if (FirstChild()) {

Callers 1

ParseAttributesMethod · 0.80

Calls 15

ToDocumentFunction · 0.85
FirstChildFunction · 0.85
LastChildFunction · 0.85
StringEqualFunction · 0.85
SkipWhiteSpaceFunction · 0.85
IdentifyMethod · 0.80
SetErrorMethod · 0.80
TransferToMethod · 0.80
SetTrackedMethod · 0.80
EmptyMethod · 0.80
GetStrMethod · 0.80
ParseTextMethod · 0.80

Tested by

no test coverage detected