| 203 | } |
| 204 | |
| 205 | static int |
| 206 | xmlconfTestValid(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 | |
| 238 | static int |
| 239 | xmlconfTestNotNSWF(const char *id, const char *filename, int options) { |
no test coverage detected