| 6469 | */ |
| 6470 | |
| 6471 | int |
| 6472 | xmlValidateDtd(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd) { |
| 6473 | int ret; |
| 6474 | xmlDtdPtr oldExt, oldInt; |
| 6475 | xmlNodePtr root; |
| 6476 | |
| 6477 | if (dtd == NULL) |
| 6478 | return(0); |
| 6479 | if (doc == NULL) |
| 6480 | return(0); |
| 6481 | |
| 6482 | oldExt = doc->extSubset; |
| 6483 | oldInt = doc->intSubset; |
| 6484 | doc->extSubset = dtd; |
| 6485 | doc->intSubset = NULL; |
| 6486 | if (doc->ids != NULL) { |
| 6487 | xmlFreeIDTable(doc->ids); |
| 6488 | doc->ids = NULL; |
| 6489 | } |
| 6490 | if (doc->refs != NULL) { |
| 6491 | xmlFreeRefTable(doc->refs); |
| 6492 | doc->refs = NULL; |
| 6493 | } |
| 6494 | |
| 6495 | ret = xmlValidateRoot(ctxt, doc); |
| 6496 | if (ret != 0) { |
| 6497 | root = xmlDocGetRootElement(doc); |
| 6498 | ret = xmlValidateElement(ctxt, doc, root); |
| 6499 | ret &= xmlValidateDocumentFinal(ctxt, doc); |
| 6500 | } |
| 6501 | |
| 6502 | doc->extSubset = oldExt; |
| 6503 | doc->intSubset = oldInt; |
| 6504 | if (doc->ids != NULL) { |
| 6505 | xmlFreeIDTable(doc->ids); |
| 6506 | doc->ids = NULL; |
| 6507 | } |
| 6508 | if (doc->refs != NULL) { |
| 6509 | xmlFreeRefTable(doc->refs); |
| 6510 | doc->refs = NULL; |
| 6511 | } |
| 6512 | |
| 6513 | return(ret); |
| 6514 | } |
| 6515 | |
| 6516 | static void |
| 6517 | xmlValidateNotationCallback(void *payload, void *data, |
no test coverage detected