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

Function xmlSAXUserParseFile

ThirdParty/libxml2/vtklibxml2/parser.c:12988–13023  ·  view source on GitHub ↗

* xmlSAXUserParseFile: * @sax: a SAX handler * @user_data: The user data returned on SAX callbacks * @filename: a file name * * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile. * * parse an XML file and call the given SAX handler routines. * Automatic support for ZLIB/Compress compressed document is provided * * Returns 0 in case of success or a error number otherwise */

Source from the content-addressed store, hash-verified

12986 * Returns 0 in case of success or a error number otherwise
12987 */
12988int
12989xmlSAXUserParseFile(xmlSAXHandlerPtr sax, void *user_data,
12990 const char *filename) {
12991 int ret = 0;
12992 xmlParserCtxtPtr ctxt;
12993
12994 ctxt = xmlCreateFileParserCtxt(filename);
12995 if (ctxt == NULL) return -1;
12996 if (sax != NULL) {
12997 if (sax->initialized == XML_SAX2_MAGIC) {
12998 *ctxt->sax = *sax;
12999 } else {
13000 memset(ctxt->sax, 0, sizeof(*ctxt->sax));
13001 memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
13002 }
13003 ctxt->userData = user_data;
13004 }
13005
13006 xmlParseDocument(ctxt);
13007
13008 if (ctxt->wellFormed)
13009 ret = 0;
13010 else {
13011 if (ctxt->errNo != 0)
13012 ret = ctxt->errNo;
13013 else
13014 ret = -1;
13015 }
13016 if (ctxt->myDoc != NULL) {
13017 xmlFreeDoc(ctxt->myDoc);
13018 ctxt->myDoc = NULL;
13019 }
13020 xmlFreeParserCtxt(ctxt);
13021
13022 return ret;
13023}
13024#endif /* LIBXML_SAX1_ENABLED */
13025
13026/************************************************************************

Callers

nothing calls this directly

Calls 4

xmlCreateFileParserCtxtFunction · 0.85
xmlParseDocumentFunction · 0.85
xmlFreeDocFunction · 0.85
xmlFreeParserCtxtFunction · 0.85

Tested by

no test coverage detected