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

Method Parse

cpp/tinyxml/tinyxmlparser.cpp:705–797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

tinyxml.cppFile · 0.80
ReadValueMethod · 0.80

Calls 13

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

Tested by

no test coverage detected