MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlReaderForFd

Function xmlReaderForFd

ThirdParty/libxml2/vtklibxml2/xmlreader.c:5228–5252  ·  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

5226 * Returns the new reader or NULL in case of error.
5227 */
5228xmlTextReaderPtr
5229xmlReaderForFd(int fd, const char *URL, const char *encoding, int options)
5230{
5231 xmlTextReaderPtr reader;
5232 xmlParserInputBufferPtr input;
5233
5234 if (fd < 0)
5235 return (NULL);
5236
5237 input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
5238 if (input == NULL)
5239 return (NULL);
5240 input->closecallback = NULL;
5241 reader = xmlNewTextReader(input, URL);
5242 if (reader == NULL) {
5243 xmlFreeParserInputBuffer(input);
5244 return (NULL);
5245 }
5246 reader->allocs |= XML_TEXTREADER_INPUT;
5247 if (xmlTextReaderSetup(reader, NULL, URL, encoding, options) < 0) {
5248 xmlFreeTextReader(reader);
5249 return (NULL);
5250 }
5251 return (reader);
5252}
5253
5254/**
5255 * xmlReaderForIO:

Callers 1

streamFileFunction · 0.85

Calls 5

xmlNewTextReaderFunction · 0.85
xmlFreeParserInputBufferFunction · 0.85
xmlTextReaderSetupFunction · 0.85
xmlFreeTextReaderFunction · 0.85

Tested by

no test coverage detected