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

Function xmlParseBalancedChunkMemoryRecover

ThirdParty/libxml2/vtklibxml2/parser.c:12589–12635  ·  view source on GitHub ↗

* xmlParseBalancedChunkMemoryRecover: * @doc: the document the chunk pertains to (must not be NULL) * @sax: the SAX handler block (possibly NULL) * @user_data: The user data returned on SAX callbacks (possibly NULL) * @depth: Used for loop detection, use 0 * @string: the input string in UTF8 or ISO-Latin (zero terminated) * @listOut: the return value for the set of parsed nodes * @rec

Source from the content-addressed store, hash-verified

12587 * some extent.
12588 */
12589int
12590xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
12591 void *user_data, int depth, const xmlChar *string, xmlNodePtr *listOut,
12592 int recover) {
12593 xmlParserCtxtPtr ctxt;
12594 xmlParserInputPtr input;
12595 xmlNodePtr list;
12596 int ret;
12597
12598 if (listOut != NULL)
12599 *listOut = NULL;
12600
12601 if (string == NULL)
12602 return(XML_ERR_ARGUMENT);
12603
12604 ctxt = xmlNewSAXParserCtxt(sax, user_data);
12605 if (ctxt == NULL)
12606 return(XML_ERR_NO_MEMORY);
12607
12608 xmlCtxtInitializeLate(ctxt);
12609
12610 ctxt->depth = depth;
12611 ctxt->myDoc = doc;
12612 if (recover) {
12613 ctxt->options |= XML_PARSE_RECOVER;
12614 ctxt->recovery = 1;
12615 }
12616
12617 input = xmlNewStringInputStream(ctxt, string);
12618 if (input == NULL)
12619 return(ctxt->errNo);
12620
12621 list = xmlCtxtParseContent(ctxt, input, /* hasTextDecl */ 0, 1);
12622 if (listOut != NULL)
12623 *listOut = list;
12624 else
12625 xmlFreeNodeList(list);
12626
12627 if (!ctxt->wellFormed)
12628 ret = ctxt->errNo;
12629 else
12630 ret = XML_ERR_OK;
12631
12632 xmlFreeInputStream(input);
12633 xmlFreeParserCtxt(ctxt);
12634 return(ret);
12635}
12636
12637/**
12638 * xmlSAXParseEntity:

Callers 1

Calls 7

xmlNewSAXParserCtxtFunction · 0.85
xmlCtxtInitializeLateFunction · 0.85
xmlNewStringInputStreamFunction · 0.85
xmlCtxtParseContentFunction · 0.85
xmlFreeNodeListFunction · 0.85
xmlFreeInputStreamFunction · 0.85
xmlFreeParserCtxtFunction · 0.85

Tested by

no test coverage detected