MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / ParseDeep

Method ParseDeep

native/thirdpart/tinyxml2/tinyxml2.cpp:1042–1154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1040
1041
1042char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
1043{
1044 // This is a recursive method, but thinking about it "at the current level"
1045 // it is a pretty simple flat list:
1046 // <foo/>
1047 // <!-- comment -->
1048 //
1049 // With a special case:
1050 // <foo>
1051 // </foo>
1052 // <!-- comment -->
1053 //
1054 // Where the closing element (/foo) *must* be the next thing after the opening
1055 // element, and the names must match. BUT the tricky bit is that the closing
1056 // element will be read by the child.
1057 //
1058 // 'endTag' is the end tag for this node, it is returned by a call to a child.
1059 // 'parentEnd' is the end tag for the parent, which is filled in and returned.
1060
1061 XMLDocument::DepthTracker tracker(_document);
1062 if (_document->Error())
1063 return 0;
1064
1065 while( p && *p ) {
1066 XMLNode* node = 0;
1067
1068 p = _document->Identify( p, &node );
1069 TIXMLASSERT( p );
1070 if ( node == 0 ) {
1071 break;
1072 }
1073
1074 const int initialLineNum = node->_parseLineNum;
1075
1076 StrPair endTag;
1077 p = node->ParseDeep( p, &endTag, curLineNumPtr );
1078 if ( !p ) {
1079 DeleteNode( node );
1080 if ( !_document->Error() ) {
1081 _document->SetError( XML_ERROR_PARSING, initialLineNum, 0);
1082 }
1083 break;
1084 }
1085
1086 const XMLDeclaration* const decl = node->ToDeclaration();
1087 if ( decl ) {
1088 // Declarations are only allowed at document level
1089 //
1090 // Multiple declarations are allowed but all declarations
1091 // must occur before anything else.
1092 //
1093 // Optimized due to a security test case. If the first node is
1094 // a declaration, and the last node is a declaration, then only
1095 // declarations have so far been added.
1096 bool wellLocated = false;
1097
1098 if (ToDocument()) {
1099 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