MCPcopy Create free account
hub / github.com/OpenMW/openmw / Identify

Method Identify

extern/oics/tinyxml/tinyxmlparser.cpp:810–897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

808
809
810TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
811{
812 TiXmlNode* returnNode = 0;
813
814 p = SkipWhiteSpace( p, encoding );
815 if( !p || !*p || *p != '<' )
816 {
817 return 0;
818 }
819
820 TiXmlDocument* doc = GetDocument();
821 p = SkipWhiteSpace( p, encoding );
822
823 if ( !p || !*p )
824 {
825 return 0;
826 }
827
828 // What is this thing?
829 // - Elements start with a letter or underscore, but xml is reserved.
830 // - Comments: <!--
831 // - Decleration: <?xml
832 // - Everthing else is unknown to tinyxml.
833 //
834
835 const char* xmlHeader = { "<?xml" };
836 const char* commentHeader = { "<!--" };
837 const char* dtdHeader = { "<!" };
838 const char* cdataHeader = { "<![CDATA[" };
839
840 if ( StringEqual( p, xmlHeader, true, encoding ) )
841 {
842 #ifdef DEBUG_PARSER
843 TIXML_LOG( "XML parsing Declaration\n" );
844 #endif
845 returnNode = new TiXmlDeclaration();
846 }
847 else if ( StringEqual( p, commentHeader, false, encoding ) )
848 {
849 #ifdef DEBUG_PARSER
850 TIXML_LOG( "XML parsing Comment\n" );
851 #endif
852 returnNode = new TiXmlComment();
853 }
854 else if ( StringEqual( p, cdataHeader, false, encoding ) )
855 {
856 #ifdef DEBUG_PARSER
857 TIXML_LOG( "XML parsing CDATA\n" );
858 #endif
859 TiXmlText* text = new TiXmlText( "" );
860 text->SetCDATA( true );
861 returnNode = text;
862 }
863 else if ( StringEqual( p, dtdHeader, false, encoding ) )
864 {
865 #ifdef DEBUG_PARSER
866 TIXML_LOG( "XML parsing Unknown(1)\n" );
867 #endif

Callers

nothing calls this directly

Calls 2

SetCDATAMethod · 0.80
SetErrorMethod · 0.80

Tested by

no test coverage detected