MCPcopy Create free account
hub / github.com/cjcliffe/CubicSDR / Parse

Method Parse

external/tinyxml/tinyxmlparser.cpp:704–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

702#endif
703
704const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding )
705{
706 ClearError();
707
708 // Parse away, at the document level. Since a document
709 // contains nothing but other tags, most of what happens
710 // here is skipping white space.
711 if ( !p || !*p )
712 {
713 SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
714 return 0;
715 }
716
717 // Note that, for a document, this needs to come
718 // before the while space skip, so that parsing
719 // starts from the pointer we are given.
720 location.Clear();
721 if ( prevData )
722 {
723 location.row = prevData->cursor.row;
724 location.col = prevData->cursor.col;
725 }
726 else
727 {
728 location.row = 0;
729 location.col = 0;
730 }
731 TiXmlParsingData data( p, TabSize(), location.row, location.col );
732 location = data.Cursor();
733
734 if ( encoding == TIXML_ENCODING_UNKNOWN )
735 {
736 // Check for the Microsoft UTF-8 lead bytes.
737 const unsigned char* pU = (const unsigned char*)p;
738 if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
739 && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
740 && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 )
741 {
742 encoding = TIXML_ENCODING_UTF8;
743 useMicrosoftBOM = true;
744 }
745 }
746
747 p = SkipWhiteSpace( p, encoding );
748 if ( !p )
749 {
750 SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
751 return 0;
752 }
753
754 while ( p && *p )
755 {
756 TiXmlNode* node = Identify( p, encoding );
757 if ( node )
758 {
759 p = node->Parse( p, &data, encoding );
760 LinkEndChild( node );
761 }

Callers 3

tinyxml.cppFile · 0.80
mainFunction · 0.80
ReadValueMethod · 0.80

Calls 12

EncodingMethod · 0.80
SetErrorMethod · 0.80
StampMethod · 0.80
c_strMethod · 0.80
SetDocumentMethod · 0.80
FindMethod · 0.80
NameMethod · 0.80
AddMethod · 0.80
ClearMethod · 0.45
ToDeclarationMethod · 0.45
lengthMethod · 0.45
ValueMethod · 0.45

Tested by 1

mainFunction · 0.64