From 8aff24724e96fbbcb0ab84766bc5a658f244ef46 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 19 Feb 2002 21:50:43 +0000 Subject: [PATCH] oops broke automatic defaulting of namespaces attributes. Daniel * SAX.c: oops broke automatic defaulting of namespaces attributes. Daniel --- ChangeLog | 4 ++++ SAX.c | 67 +++++++++++++++++++++++++++++-------------------------- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index b099f073..286fabdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Feb 19 22:49:36 CET 2002 Daniel Veillard + + * SAX.c: oops broke automatic defaulting of namespaces attributes. + Tue Feb 19 22:01:35 CET 2002 Daniel Veillard * include/libxml/parserInternals.h parser.c: had to change diff --git a/SAX.c b/SAX.c index 2665998c..b6e368ac 100644 --- a/SAX.c +++ b/SAX.c @@ -1069,53 +1069,56 @@ process_external_subset: * internal subset are not overriden by definitions in the * external subset. */ - if ((attr->defaultValue != NULL) && - (xmlGetDtdQAttrDesc(ctxt->myDoc->extSubset, - attr->elem, attr->name, - attr->prefix) == attr) && - (xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset, - attr->elem, attr->name, - attr->prefix) == NULL)) { + if (attr->defaultValue != NULL) { /* * the element should be instantiated in the tree if: * - this is a namespace prefix * - the user required for completion in the tree * like XSLT + * - there isn't already an attribute definition + * in the internal subset overriding it. */ if (((attr->prefix != NULL) && (xmlStrEqual(attr->prefix, BAD_CAST "xmlns"))) || ((attr->prefix == NULL) && (xmlStrEqual(attr->name, BAD_CAST "xmlns"))) || (ctxt->loadsubset & XML_COMPLETE_ATTRS)) { - xmlChar *fulln; + xmlAttributePtr tst; - if (attr->prefix != NULL) { - fulln = xmlStrdup(attr->prefix); - fulln = xmlStrcat(fulln, BAD_CAST ":"); - fulln = xmlStrcat(fulln, attr->name); - } else { - fulln = xmlStrdup(attr->name); - } + tst = xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset, + attr->elem, attr->name, + attr->prefix); + if ((tst == attr) || (tst == NULL)) { + xmlChar *fulln; - /* - * Check that the attribute is not declared in the - * serialization - */ - att = NULL; - if (atts != NULL) { - i = 0; - att = atts[i]; - while (att != NULL) { - if (xmlStrEqual(att, fulln)) - break; - i += 2; - att = atts[i]; + if (attr->prefix != NULL) { + fulln = xmlStrdup(attr->prefix); + fulln = xmlStrcat(fulln, BAD_CAST ":"); + fulln = xmlStrcat(fulln, attr->name); + } else { + fulln = xmlStrdup(attr->name); } + + /* + * Check that the attribute is not declared in the + * serialization + */ + att = NULL; + if (atts != NULL) { + i = 0; + att = atts[i]; + while (att != NULL) { + if (xmlStrEqual(att, fulln)) + break; + i += 2; + att = atts[i]; + } + } + if (att == NULL) { + attribute(ctxt, fulln, attr->defaultValue); + } + xmlFree(fulln); } - if (att == NULL) { - attribute(ctxt, fulln, attr->defaultValue); - } - xmlFree(fulln); } } attr = attr->nexth;