MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / Identify

Method Identify

cpp/tinyxml/tinyxmlparser.cpp:819–906  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

IsAlphaFunction · 0.85
SetCDATAMethod · 0.80
SetErrorMethod · 0.80

Tested by

no test coverage detected