All the examples in libxml2 documentation libxml tutorial are mentioned using external XML files. What if I need to parse a string with XML content in it? Is it really possible in libxml2 C library, or the only solution would be taking the string saving it to the file and sending that file name as argument to the below function. But it would seriously effect the performance.
doc = xmlParseFile(docname);
Are there any inbuilt functions in libxml2 to parse character arrays?
You can use xmlParseDoc()
, which will take a null terminated string (of xmlChar / unsigned char) and parse it exactly as if it were read from a file using xmlParseFile()
.