MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Parse

Method Parse

ogsr_engine/xrCore/XML_Parser/tinyxmlparser.cpp:677–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675#endif
676
677const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding)
678{
679 ClearError();
680
681 // Parse away, at the document level. Since a document
682 // contains nothing but other tags, most of what happens
683 // here is skipping white space.
684 if (!p || !*p)
685 {
686 SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN);
687 return 0;
688 }
689
690 // Note that, for a document, this needs to come
691 // before the while space skip, so that parsing
692 // starts from the pointer we are given.
693 location.Clear();
694 if (prevData)
695 {
696 location.row = prevData->cursor.row;
697 location.col = prevData->cursor.col;
698 }
699 else
700 {
701 location.row = 0;
702 location.col = 0;
703 }
704 TiXmlParsingData data(p, TabSize(), location.row, location.col);
705 location = data.Cursor();
706
707 if (encoding == TIXML_ENCODING_UNKNOWN)
708 {
709 // Check for the Microsoft UTF-8 lead bytes.
710 const unsigned char* pU = (const unsigned char*)p;
711 if (*(pU + 0) && *(pU + 0) == TIXML_UTF_LEAD_0 && *(pU + 1) && *(pU + 1) == TIXML_UTF_LEAD_1 && *(pU + 2) && *(pU + 2) == TIXML_UTF_LEAD_2)
712 {
713 encoding = TIXML_ENCODING_UTF8;
714 useMicrosoftBOM = true;
715 }
716 }
717
718 p = SkipWhiteSpace(p, encoding);
719 if (!p)
720 {
721 SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN);
722 return 0;
723 }
724
725 while (p && *p)
726 {
727 TiXmlNode* node = Identify(p, encoding);
728 if (node)
729 {
730 p = node->Parse(p, &data, encoding);
731 LinkEndChild(node);
732 }
733 else
734 {

Callers 4

LoadMethod · 0.80
InitMethod · 0.80
tinyxml.cppFile · 0.80
ReadValueMethod · 0.80

Calls 15

xr_deleteFunction · 0.85
EncodingMethod · 0.80
SetErrorMethod · 0.80
StampMethod · 0.80
line_existMethod · 0.80
r_boolMethod · 0.80
SetDocumentMethod · 0.80
xr_strlenFunction · 0.50
ClearMethod · 0.45
ToDeclarationMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected