MCPcopy Create free account
hub / github.com/crossuo/crossuo / ParseDeep

Method ParseDeep

external/tinyxml2.cpp:1020–1132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1018
1019
1020char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
1021{
1022 // This is a recursive method, but thinking about it "at the current level"
1023 // it is a pretty simple flat list:
1024 // <foo/>
1025 // <!-- comment -->
1026 //
1027 // With a special case:
1028 // <foo>
1029 // </foo>
1030 // <!-- comment -->
1031 //
1032 // Where the closing element (/foo) *must* be the next thing after the opening
1033 // element, and the names must match. BUT the tricky bit is that the closing
1034 // element will be read by the child.
1035 //
1036 // 'endTag' is the end tag for this node, it is returned by a call to a child.
1037 // 'parentEnd' is the end tag for the parent, which is filled in and returned.
1038
1039 XMLDocument::DepthTracker tracker(_document);
1040 if (_document->Error())
1041 return 0;
1042
1043 while( p && *p ) {
1044 XMLNode* node = 0;
1045
1046 p = _document->Identify( p, &node );
1047 TIXMLASSERT( p );
1048 if ( node == 0 ) {
1049 break;
1050 }
1051
1052 const int initialLineNum = node->_parseLineNum;
1053
1054 StrPair endTag;
1055 p = node->ParseDeep( p, &endTag, curLineNumPtr );
1056 if ( !p ) {
1057 DeleteNode( node );
1058 if ( !_document->Error() ) {
1059 _document->SetError( XML_ERROR_PARSING, initialLineNum, 0);
1060 }
1061 break;
1062 }
1063
1064 const XMLDeclaration* const decl = node->ToDeclaration();
1065 if ( decl ) {
1066 // Declarations are only allowed at document level
1067 //
1068 // Multiple declarations are allowed but all declarations
1069 // must occur before anything else.
1070 //
1071 // Optimized due to a security test case. If the first node is
1072 // a declaration, and the last node is a declaration, then only
1073 // declarations have so far been added.
1074 bool wellLocated = false;
1075
1076 if (ToDocument()) {
1077 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
SetTrackedMethod · 0.80
GetStrMethod · 0.80
ParseTextMethod · 0.80
ParseNameMethod · 0.80
ValueMethod · 0.45

Tested by

no test coverage detected