* xmlTextReaderGetRemainder: * @reader: the xmlTextReaderPtr used * * Method to get the remainder of the buffered XML. this method stops the * parser, set its state to End Of File and return the input stream with * what is left that the parser did not use. * * The implementation is not good, the parser certainly progressed past * what's left in reader->input, and there is an allocation pr
| 2502 | * in case of error. |
| 2503 | */ |
| 2504 | xmlParserInputBufferPtr |
| 2505 | xmlTextReaderGetRemainder(xmlTextReaderPtr reader) { |
| 2506 | xmlParserInputBufferPtr ret = NULL; |
| 2507 | |
| 2508 | if (reader == NULL) |
| 2509 | return(NULL); |
| 2510 | if (reader->node == NULL) |
| 2511 | return(NULL); |
| 2512 | |
| 2513 | reader->node = NULL; |
| 2514 | reader->curnode = NULL; |
| 2515 | reader->mode = XML_TEXTREADER_MODE_EOF; |
| 2516 | if (reader->ctxt != NULL) { |
| 2517 | xmlStopParser(reader->ctxt); |
| 2518 | if (reader->ctxt->myDoc != NULL) { |
| 2519 | if (reader->preserve == 0) |
| 2520 | xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc); |
| 2521 | reader->ctxt->myDoc = NULL; |
| 2522 | } |
| 2523 | } |
| 2524 | if (reader->allocs & XML_TEXTREADER_INPUT) { |
| 2525 | ret = reader->input; |
| 2526 | reader->input = NULL; |
| 2527 | reader->allocs -= XML_TEXTREADER_INPUT; |
| 2528 | } else { |
| 2529 | /* |
| 2530 | * Hum, one may need to duplicate the data structure because |
| 2531 | * without reference counting the input may be freed twice: |
| 2532 | * - by the layer which allocated it. |
| 2533 | * - by the layer to which would have been returned to. |
| 2534 | */ |
| 2535 | return(NULL); |
| 2536 | } |
| 2537 | return(ret); |
| 2538 | } |
| 2539 | |
| 2540 | /** |
| 2541 | * xmlTextReaderLookupNamespace: |
nothing calls this directly
no test coverage detected