MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCOLLADA / xmlReaderForFd

Function xmlReaderForFd

Externals/LibXML/xmlreader.c:5216–5237  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

5214 * Returns the new reader or NULL in case of error.
5215 */
5216xmlTextReaderPtr
5217xmlReaderForFd(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:

Callers

nothing calls this directly

Calls 4

xmlNewTextReaderFunction · 0.85
xmlFreeParserInputBufferFunction · 0.85
xmlTextReaderSetupFunction · 0.85

Tested by

no test coverage detected