* xmlTextReaderLocatorLineNumber: * @locator: the xmlTextReaderLocatorPtr used * * Obtain the line number for the given locator. * * Returns the line number or -1 in case of error. */
| 4627 | * Returns the line number or -1 in case of error. |
| 4628 | */ |
| 4629 | int |
| 4630 | xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator) { |
| 4631 | /* we know that locator is a xmlParserCtxtPtr */ |
| 4632 | xmlParserCtxtPtr ctx = (xmlParserCtxtPtr)locator; |
| 4633 | int ret = -1; |
| 4634 | |
| 4635 | if (locator == NULL) |
| 4636 | return(-1); |
| 4637 | if (ctx->node != NULL) { |
| 4638 | ret = xmlGetLineNo(ctx->node); |
| 4639 | } |
| 4640 | else { |
| 4641 | /* inspired from error.c */ |
| 4642 | xmlParserInputPtr input; |
| 4643 | input = ctx->input; |
| 4644 | if ((input->filename == NULL) && (ctx->inputNr > 1)) |
| 4645 | input = ctx->inputTab[ctx->inputNr - 2]; |
| 4646 | if (input != NULL) { |
| 4647 | ret = input->line; |
| 4648 | } |
| 4649 | else { |
| 4650 | ret = -1; |
| 4651 | } |
| 4652 | } |
| 4653 | |
| 4654 | return ret; |
| 4655 | } |
| 4656 | |
| 4657 | /** |
| 4658 | * xmlTextReaderLocatorBaseURI: |
nothing calls this directly
no test coverage detected