* htmlReadFd: * @fd: an open file descriptor * @URL: the base URL to use for the document * @encoding: the document encoding, or NULL * @options: a combination of htmlParserOption(s) * * parse an XML from a file descriptor and build a tree. * * Returns the resulting document tree */
| 6064 | * Returns the resulting document tree |
| 6065 | */ |
| 6066 | htmlDocPtr |
| 6067 | htmlReadFd(int fd, const char *URL, const char *encoding, int options) |
| 6068 | { |
| 6069 | htmlParserCtxtPtr ctxt; |
| 6070 | xmlParserInputBufferPtr input; |
| 6071 | xmlParserInputPtr stream; |
| 6072 | |
| 6073 | if (fd < 0) |
| 6074 | return (NULL); |
| 6075 | |
| 6076 | xmlInitParser(); |
| 6077 | input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); |
| 6078 | if (input == NULL) |
| 6079 | return (NULL); |
| 6080 | ctxt = xmlNewParserCtxt(); |
| 6081 | if (ctxt == NULL) { |
| 6082 | xmlFreeParserInputBuffer(input); |
| 6083 | return (NULL); |
| 6084 | } |
| 6085 | stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); |
| 6086 | if (stream == NULL) { |
| 6087 | xmlFreeParserInputBuffer(input); |
| 6088 | xmlFreeParserCtxt(ctxt); |
| 6089 | return (NULL); |
| 6090 | } |
| 6091 | inputPush(ctxt, stream); |
| 6092 | return (htmlDoRead(ctxt, URL, encoding, options, 0)); |
| 6093 | } |
| 6094 | |
| 6095 | /** |
| 6096 | * htmlReadIO: |
nothing calls this directly
no test coverage detected