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

Function xmlTextReaderLocatorBaseURI

ThirdParty/libxml2/vtklibxml2/xmlreader.c:4666–4692  ·  view source on GitHub ↗

* xmlTextReaderLocatorBaseURI: * @locator: the xmlTextReaderLocatorPtr used * * Obtain the base URI for the given locator. * * Returns the base URI or NULL in case of error, * if non NULL it need to be freed by the caller. */

Source from the content-addressed store, hash-verified

4664 * if non NULL it need to be freed by the caller.
4665 */
4666xmlChar *
4667xmlTextReaderLocatorBaseURI(xmlTextReaderLocatorPtr locator) {
4668 /* we know that locator is a xmlParserCtxtPtr */
4669 xmlParserCtxtPtr ctx = (xmlParserCtxtPtr)locator;
4670 xmlChar *ret = NULL;
4671
4672 if (locator == NULL)
4673 return(NULL);
4674 if (ctx->node != NULL) {
4675 ret = xmlNodeGetBase(NULL,ctx->node);
4676 }
4677 else {
4678 /* inspired from error.c */
4679 xmlParserInputPtr input;
4680 input = ctx->input;
4681 if ((input->filename == NULL) && (ctx->inputNr > 1))
4682 input = ctx->inputTab[ctx->inputNr - 2];
4683 if (input != NULL) {
4684 ret = xmlStrdup(BAD_CAST input->filename);
4685 }
4686 else {
4687 ret = NULL;
4688 }
4689 }
4690
4691 return ret;
4692}
4693
4694/**
4695 * xmlTextReaderSetErrorHandler:

Callers

nothing calls this directly

Calls 2

xmlNodeGetBaseFunction · 0.85
xmlStrdupFunction · 0.85

Tested by

no test coverage detected