MCPcopy Create free account
hub / github.com/bruderstein/nppPluginManager / Identify

Method Identify

TinyXml/src/tinyxmlparser.cpp:502–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500
501
502TiXmlNode* TiXmlNode::Identify( const TCHAR* p )
503{
504 TiXmlNode* returnNode = 0;
505
506 p = SkipWhiteSpace( p );
507 if( !p || !*p || *p != '<' )
508 {
509 return 0;
510 }
511
512 TiXmlDocument* doc = GetDocument();
513 p = SkipWhiteSpace( p );
514
515 if ( !p || !*p )
516 {
517 return 0;
518 }
519
520 // What is this thing?
521 // - Elements start with a letter or underscore, but xml is reserved.
522 // - Comments: <!--
523 // - Decleration: <?xml
524 // - Everthing else is unknown to tinyxml.
525 //
526
527 const TCHAR* xmlHeader = { TEXT("<?xml") };
528 const TCHAR* commentHeader = { TEXT("<!--") };
529
530 if ( StringEqual( p, xmlHeader, true ) )
531 {
532 #ifdef DEBUG_PARSER
533 TIXML_LOG( "XML parsing Declaration\n" );
534 #endif
535 returnNode = new TiXmlDeclaration();
536 }
537 else if ( isalpha( *(p+1) )
538 || *(p+1) == '_' )
539 {
540 #ifdef DEBUG_PARSER
541 TIXML_LOG( "XML parsing Element\n" );
542 #endif
543 returnNode = new TiXmlElement( TEXT("") );
544 }
545 else if ( StringEqual( p, commentHeader, false ) )
546 {
547 #ifdef DEBUG_PARSER
548 TIXML_LOG( "XML parsing Comment\n" );
549 #endif
550 returnNode = new TiXmlComment();
551 }
552 else
553 {
554 #ifdef DEBUG_PARSER
555 TIXML_LOG( "XML parsing Unknown\n" );
556 #endif
557 returnNode = new TiXmlUnknown();
558 }
559

Callers

nothing calls this directly

Calls 1

SetErrorMethod · 0.80

Tested by

no test coverage detected