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

Function xmlXPathErr

ThirdParty/libxml2/vtklibxml2/xpath.c:661–721  ·  view source on GitHub ↗

* xmlXPathErr: * @ctxt: a XPath parser context * @code: the error code * * Handle an XPath error */

Source from the content-addressed store, hash-verified

659 * Handle an XPath error
660 */
661void
662xmlXPathErr(xmlXPathParserContextPtr ctxt, int code)
663{
664 xmlStructuredErrorFunc schannel = NULL;
665 xmlGenericErrorFunc channel = NULL;
666 void *data = NULL;
667 xmlNodePtr node = NULL;
668 int res;
669
670 if (ctxt == NULL)
671 return;
672 if ((code < 0) || (code > MAXERRNO))
673 code = MAXERRNO;
674 /* Only report the first error */
675 if (ctxt->error != 0)
676 return;
677
678 ctxt->error = code;
679
680 if (ctxt->context != NULL) {
681 xmlErrorPtr err = &ctxt->context->lastError;
682
683 /* Don't overwrite memory error. */
684 if (err->code == XML_ERR_NO_MEMORY)
685 return;
686
687 /* cleanup current last error */
688 xmlResetError(err);
689
690 err->domain = XML_FROM_XPATH;
691 err->code = code + XML_XPATH_EXPRESSION_OK - XPATH_EXPRESSION_OK;
692 err->level = XML_ERR_ERROR;
693 if (ctxt->base != NULL) {
694 err->str1 = (char *) xmlStrdup(ctxt->base);
695 if (err->str1 == NULL) {
696 xmlXPathPErrMemory(ctxt);
697 return;
698 }
699 }
700 err->int1 = ctxt->cur - ctxt->base;
701 err->node = ctxt->context->debugNode;
702
703 schannel = ctxt->context->error;
704 data = ctxt->context->userData;
705 node = ctxt->context->debugNode;
706 }
707
708 if (schannel == NULL) {
709 channel = xmlGenericError;
710 data = xmlGenericErrorContext;
711 }
712
713 res = __xmlRaiseError(schannel, channel, data, NULL, node, XML_FROM_XPATH,
714 code + XML_XPATH_EXPRESSION_OK - XPATH_EXPRESSION_OK,
715 XML_ERR_ERROR, NULL, 0,
716 (const char *) ctxt->base, NULL, NULL,
717 ctxt->cur - ctxt->base, 0,
718 "%s", xmlXPathErrorMessages[code]);

Callers 11

xmlXPatherrorFunction · 0.85
xmlXPathCheckOpLimitFunction · 0.85
xmlXPathCompStepFunction · 0.85
xmlXPathNodeSetFilterFunction · 0.85
xmlXPathRunStreamEvalFunction · 0.85
xmlXPathRunEvalFunction · 0.85
xmlXPathEvalFunction · 0.85

Calls 4

xmlResetErrorFunction · 0.85
xmlStrdupFunction · 0.85
xmlXPathPErrMemoryFunction · 0.85
__xmlRaiseErrorFunction · 0.85

Tested by

no test coverage detected