C++ tinyxml2::XMLElement::Parse()














































C++ tinyxml2::XMLElement::Parse()




Parse() is used to parse an XML file from a character string.Returns XML_SUCCESS(0) on success,or an errorID. You may optionally pass in the 'nBytes', which is the number of bytes which will be parsed. If not specified, TinyXML-2 will assume 'xml' points to a null terminated string.

Syntax:-
XMLDocument::Parse(const char * xml,size_ nbytes=(size_t)(-1))


Example:- Parse_Example.cpp(Filename)

#include "tinyxml2.h"
using namespace std;
int main()
{
    static const char* xml =
    "<XML_FILE>"
    "<xml_data>Simple Block of Code to demonstrate Working of Parse() func. of tinyxml2</xml_data>"
    "</XML_FILE>";
    tinyxml2::XMLDocument doc;
    doc.Parse(xml);
printf("Parsing of XML Successful");
return doc.ErrorID();
}


Output:-

                    
     

Comments