MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlCtxtParseDocument

Function xmlCtxtParseDocument

ThirdParty/libxml2/vtklibxml2/parser.c:13786–13822  ·  view source on GitHub ↗

* xmlCtxtParseDocument: * @ctxt: an XML parser context * @input: parser input * * Parse an XML document and return the resulting document tree. * Takes ownership of the input object. * * Available since 2.13.0. * * Returns the resulting document tree or NULL */

Source from the content-addressed store, hash-verified

13784 * Returns the resulting document tree or NULL
13785 */
13786xmlDocPtr
13787xmlCtxtParseDocument(xmlParserCtxtPtr ctxt, xmlParserInputPtr input)
13788{
13789 xmlDocPtr ret = NULL;
13790
13791 if ((ctxt == NULL) || (input == NULL))
13792 return(NULL);
13793
13794 /* assert(ctxt->inputNr == 0); */
13795 while (ctxt->inputNr > 0)
13796 xmlFreeInputStream(inputPop(ctxt));
13797
13798 if (inputPush(ctxt, input) < 0) {
13799 xmlFreeInputStream(input);
13800 return(NULL);
13801 }
13802
13803 xmlParseDocument(ctxt);
13804
13805 if ((ctxt->wellFormed) ||
13806 ((ctxt->recovery) && (ctxt->errNo != XML_ERR_NO_MEMORY))) {
13807 ret = ctxt->myDoc;
13808 } else {
13809 if (ctxt->errNo == XML_ERR_OK)
13810 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, "unknown error\n");
13811
13812 ret = NULL;
13813 xmlFreeDoc(ctxt->myDoc);
13814 }
13815 ctxt->myDoc = NULL;
13816
13817 /* assert(ctxt->inputNr == 1); */
13818 while (ctxt->inputNr > 0)
13819 xmlFreeInputStream(inputPop(ctxt));
13820
13821 return(ret);
13822}
13823
13824/**
13825 * xmlReadDoc:

Callers 12

xmlSAXParseFileWithDataFunction · 0.85
xmlReadDocFunction · 0.85
xmlReadFileFunction · 0.85
xmlReadMemoryFunction · 0.85
xmlReadFdFunction · 0.85
xmlReadIOFunction · 0.85
xmlCtxtReadDocFunction · 0.85
xmlCtxtReadFileFunction · 0.85
xmlCtxtReadMemoryFunction · 0.85
xmlCtxtReadFdFunction · 0.85
xmlCtxtReadIOFunction · 0.85

Calls 5

xmlFreeInputStreamFunction · 0.85
inputPopFunction · 0.85
inputPushFunction · 0.85
xmlParseDocumentFunction · 0.85
xmlFreeDocFunction · 0.85

Tested by

no test coverage detected