* xmlCtxtReadFd: * @ctxt: an XML parser context * @fd: an open file descriptor * @URL: base URL (optional) * @encoding: the document encoding (optional) * @options: a combination of xmlParserOption * * Parse an XML document from a file descriptor and build a tree. * * NOTE that the file descriptor will not be closed when the * context is freed or reset. * * @URL is used as base to
| 14137 | * Returns the resulting document tree |
| 14138 | */ |
| 14139 | xmlDocPtr |
| 14140 | xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd, |
| 14141 | const char *URL, const char *encoding, int options) |
| 14142 | { |
| 14143 | xmlParserInputPtr input; |
| 14144 | |
| 14145 | if (ctxt == NULL) |
| 14146 | return(NULL); |
| 14147 | |
| 14148 | xmlCtxtReset(ctxt); |
| 14149 | xmlCtxtUseOptions(ctxt, options); |
| 14150 | |
| 14151 | input = xmlNewInputFd(ctxt, URL, fd, encoding, 0); |
| 14152 | |
| 14153 | return(xmlCtxtParseDocument(ctxt, input)); |
| 14154 | } |
| 14155 | |
| 14156 | /** |
| 14157 | * xmlCtxtReadIO: |