* xmlReaderForFd: * @fd: an open file descriptor * @URL: the base URL to use for the document * @encoding: the document encoding, or NULL * @options: a combination of xmlParserOption * * Create an xmltextReader for an XML from a file descriptor. * The parsing flags @options are a combination of xmlParserOption. * NOTE that the file descriptor will not be closed when the * reader
| 5214 | * Returns the new reader or NULL in case of error. |
| 5215 | */ |
| 5216 | xmlTextReaderPtr |
| 5217 | xmlReaderForFd(int fd, const char *URL, const char *encoding, int options) |
| 5218 | { |
| 5219 | xmlTextReaderPtr reader; |
| 5220 | xmlParserInputBufferPtr input; |
| 5221 | |
| 5222 | if (fd < 0) |
| 5223 | return (NULL); |
| 5224 | |
| 5225 | input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); |
| 5226 | if (input == NULL) |
| 5227 | return (NULL); |
| 5228 | input->closecallback = NULL; |
| 5229 | reader = xmlNewTextReader(input, URL); |
| 5230 | if (reader == NULL) { |
| 5231 | xmlFreeParserInputBuffer(input); |
| 5232 | return (NULL); |
| 5233 | } |
| 5234 | reader->allocs |= XML_TEXTREADER_INPUT; |
| 5235 | xmlTextReaderSetup(reader, NULL, URL, encoding, options); |
| 5236 | return (reader); |
| 5237 | } |
| 5238 | |
| 5239 | /** |
| 5240 | * xmlReaderForIO: |
nothing calls this directly
no test coverage detected