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

Method Identify

ogsr_engine/xrCore/XML_Parser/tinyxmlparser.cpp:788–874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

786}
787
788TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding)
789{
790 TiXmlNode* returnNode = 0;
791
792 p = SkipWhiteSpace(p, encoding);
793 if (!p || !*p || *p != '<')
794 {
795 return 0;
796 }
797
798 TiXmlDocument* doc = GetDocument();
799 p = SkipWhiteSpace(p, encoding);
800
801 if (!p || !*p)
802 {
803 return 0;
804 }
805
806 // What is this thing?
807 // - Elements start with a letter or underscore, but xml is reserved.
808 // - Comments: <!--
809 // - Decleration: <?xml
810 // - Everthing else is unknown to tinyxml.
811 //
812
813 const char* xmlHeader = {"<?xml"};
814 const char* commentHeader = {"<!--"};
815 const char* dtdHeader = {"<!"};
816 const char* cdataHeader = {"<![CDATA["};
817
818 if (StringEqual(p, xmlHeader, true, encoding))
819 {
820#ifdef DEBUG_PARSER
821 TIXML_LOG("XML parsing Declaration\n");
822#endif
823 returnNode = xr_new<TiXmlDeclaration>();
824 }
825 else if (StringEqual(p, commentHeader, false, encoding))
826 {
827#ifdef DEBUG_PARSER
828 TIXML_LOG("XML parsing Comment\n");
829#endif
830 returnNode = xr_new<TiXmlComment>();
831 }
832 else if (StringEqual(p, cdataHeader, false, encoding))
833 {
834#ifdef DEBUG_PARSER
835 TIXML_LOG("XML parsing CDATA\n");
836#endif
837 TiXmlText* text = xr_new<TiXmlText>("");
838 text->SetCDATA(true);
839 returnNode = text;
840 }
841 else if (StringEqual(p, dtdHeader, false, encoding))
842 {
843#ifdef DEBUG_PARSER
844 TIXML_LOG("XML parsing Unknown(1)\n");
845#endif

Callers

nothing calls this directly

Calls 2

SetCDATAMethod · 0.80
SetErrorMethod · 0.80

Tested by

no test coverage detected