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

Function xmlconfTestInvalid

ThirdParty/libxml2/vtklibxml2/runxmlconf.c:174–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172 ************************************************************************/
173
174static int
175xmlconfTestInvalid(const char *id, const char *filename, int options) {
176 xmlDocPtr doc;
177 xmlParserCtxtPtr ctxt;
178 int ret = 1;
179
180 ctxt = xmlNewParserCtxt();
181 if (ctxt == NULL) {
182 test_log("test %s : %s out of memory\n",
183 id, filename);
184 return(0);
185 }
186 xmlCtxtSetErrorHandler(ctxt, testErrorHandler, NULL);
187 doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
188 if (doc == NULL) {
189 test_log("test %s : %s invalid document turned not well-formed too\n",
190 id, filename);
191 } else {
192 /* invalidity should be reported both in the context and in the document */
193 if ((ctxt->valid != 0) || (doc->properties & XML_DOC_DTDVALID)) {
194 test_log("test %s : %s failed to detect invalid document\n",
195 id, filename);
196 nb_errors++;
197 ret = 0;
198 }
199 xmlFreeDoc(doc);
200 }
201 xmlFreeParserCtxt(ctxt);
202 return(ret);
203}
204
205static int
206xmlconfTestValid(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