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

Function xmlconfTestValid

ThirdParty/libxml2/vtklibxml2/runxmlconf.c:205–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205static int
206xmlconfTestValid(const char *id, const char *filename, int options) {
207 xmlDocPtr doc;
208 xmlParserCtxtPtr ctxt;
209 int ret = 1;
210
211 ctxt = xmlNewParserCtxt();
212 if (ctxt == NULL) {
213 test_log("test %s : %s out of memory\n",
214 id, filename);
215 return(0);
216 }
217 xmlCtxtSetErrorHandler(ctxt, testErrorHandler, NULL);
218 doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
219 if (doc == NULL) {
220 test_log("test %s : %s failed to parse a valid document\n",
221 id, filename);
222 nb_errors++;
223 ret = 0;
224 } else {
225 /* validity should be reported both in the context and in the document */
226 if ((ctxt->valid == 0) || ((doc->properties & XML_DOC_DTDVALID) == 0)) {
227 test_log("test %s : %s failed to validate a valid document\n",
228 id, filename);
229 nb_errors++;
230 ret = 0;
231 }
232 xmlFreeDoc(doc);
233 }
234 xmlFreeParserCtxt(ctxt);
235 return(ret);
236}
237
238static int
239xmlconfTestNotNSWF(const char *id, const char *filename, int options) {

Callers 1

xmlconfTestItemFunction · 0.85

Calls 6

xmlNewParserCtxtFunction · 0.85
xmlCtxtSetErrorHandlerFunction · 0.85
xmlCtxtReadFileFunction · 0.85
xmlFreeDocFunction · 0.85
xmlFreeParserCtxtFunction · 0.85
test_logFunction · 0.70

Tested by

no test coverage detected