diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2003-11-25 07:21:18 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2003-11-25 07:21:18 +0000 |
commit | e70c877c835da1ca10ce28059c8a251c394c8d57 (patch) | |
tree | b9b21664d34e7e219b116a832d8f34d0b1645bb8 /parser.c | |
parent | 74c0e594e06c430521f7b7035dc60c2576acc851 (diff) | |
download | libxml2-e70c877c835da1ca10ce28059c8a251c394c8d57.tar.gz |
swapped the attribute defaulting and attribute checking parts of parsing a
* parser.c: swapped the attribute defaulting and attribute checking
parts of parsing a new element start, fixes bug #127772
* result/valid/127772.* test/valid/127772.xml
test/valid/dtds/127772.dtd: added the example in the regression tests
Daniel
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 66 |
1 files changed, 33 insertions, 33 deletions
@@ -7842,39 +7842,6 @@ failed: } /* - * The attributes checkings - */ - for (i = 0; i < nbatts;i += 5) { - nsname = xmlGetNamespace(ctxt, atts[i + 1]); - if ((atts[i + 1] != NULL) && (nsname == NULL)) { - xmlNsErr(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, - "Namespace prefix %s for %s on %s is not defined\n", - atts[i + 1], atts[i], localname); - } - atts[i + 2] = nsname; - /* - * [ WFC: Unique Att Spec ] - * No attribute name may appear more than once in the same - * start-tag or empty-element tag. - * As extended by the Namespace in XML REC. - */ - for (j = 0; j < i;j += 5) { - if (atts[i] == atts[j]) { - if (atts[i+1] == atts[j+1]) { - xmlErrAttributeDup(ctxt, atts[i+1], atts[i]); - break; - } - if ((nsname != NULL) && (atts[j + 2] == nsname)) { - xmlNsErr(ctxt, XML_NS_ERR_ATTRIBUTE_REDEFINED, - "Namespaced Attribute %s in '%s' redefined\n", - atts[i], nsname, NULL); - break; - } - } - } - } - - /* * The attributes defaulting */ if (ctxt->attsDefault != NULL) { @@ -7950,6 +7917,39 @@ failed: } } + /* + * The attributes checkings + */ + for (i = 0; i < nbatts;i += 5) { + nsname = xmlGetNamespace(ctxt, atts[i + 1]); + if ((atts[i + 1] != NULL) && (nsname == NULL)) { + xmlNsErr(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, + "Namespace prefix %s for %s on %s is not defined\n", + atts[i + 1], atts[i], localname); + } + atts[i + 2] = nsname; + /* + * [ WFC: Unique Att Spec ] + * No attribute name may appear more than once in the same + * start-tag or empty-element tag. + * As extended by the Namespace in XML REC. + */ + for (j = 0; j < i;j += 5) { + if (atts[i] == atts[j]) { + if (atts[i+1] == atts[j+1]) { + xmlErrAttributeDup(ctxt, atts[i+1], atts[i]); + break; + } + if ((nsname != NULL) && (atts[j + 2] == nsname)) { + xmlNsErr(ctxt, XML_NS_ERR_ATTRIBUTE_REDEFINED, + "Namespaced Attribute %s in '%s' redefined\n", + atts[i], nsname, NULL); + break; + } + } + } + } + nsname = xmlGetNamespace(ctxt, prefix); if ((prefix != NULL) && (nsname == NULL)) { xmlNsErr(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, |