summaryrefslogtreecommitdiff
path: root/valid.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2004-10-28 09:07:41 +0000
committerMike Hommey <mh@glandium.org>2004-10-28 09:07:41 +0000
commit9705f1a5e858108d21a0128556f42b25d16833cd (patch)
treef819e7482d433f8bf5da005695c79189dd5ce527 /valid.c
parent0732be88d054db33fa0ca479eab9988c8e6be42e (diff)
downloadlibxml2-upstream/2.6.15.tar.gz
Load /tmp/tmp.SgII7T/libxml2-2.6.15 intoupstream/2.6.15
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'valid.c')
-rw-r--r--valid.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/valid.c b/valid.c
index 6b2d08e..b853992 100644
--- a/valid.c
+++ b/valid.c
@@ -6304,7 +6304,10 @@ xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
*
* Try to validate the document against the dtd instance
*
- * basically it does check all the definitions in the DtD.
+ * Basically it does check all the definitions in the DtD.
+ * Note the the internal subset (if present) is de-coupled
+ * (i.e. not used), which could give problems if ID or IDREF
+ * is present.
*
* returns 1 if valid or 0 otherwise
*/
@@ -6312,16 +6315,19 @@ xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
int
xmlValidateDtd(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd) {
int ret;
- xmlDtdPtr oldExt;
+ xmlDtdPtr oldExt, oldInt;
xmlNodePtr root;
if (dtd == NULL) return(0);
if (doc == NULL) return(0);
oldExt = doc->extSubset;
+ oldInt = doc->intSubset;
doc->extSubset = dtd;
+ doc->intSubset = NULL;
ret = xmlValidateRoot(ctxt, doc);
if (ret == 0) {
doc->extSubset = oldExt;
+ doc->intSubset = oldInt;
return(ret);
}
if (doc->ids != NULL) {
@@ -6336,6 +6342,7 @@ xmlValidateDtd(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd) {
ret = xmlValidateElement(ctxt, doc, root);
ret &= xmlValidateDocumentFinal(ctxt, doc);
doc->extSubset = oldExt;
+ doc->intSubset = oldInt;
return(ret);
}
@@ -6690,8 +6697,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names,
/*
* Creates a dummy node and insert it into the tree
*/
- test_node = xmlNewNode (NULL, BAD_CAST "<!dummy?>");
- test_node->doc = ref_node->doc;
+ test_node = xmlNewDocNode (ref_node->doc, NULL, BAD_CAST "<!dummy?>", NULL);
test_node->parent = parent;
test_node->prev = prev;
test_node->next = next;