* 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. */
| 4664 | * if non NULL it need to be freed by the caller. |
| 4665 | */ |
| 4666 | xmlChar * |
| 4667 | xmlTextReaderLocatorBaseURI(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: |
nothing calls this directly
no test coverage detected