mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-11 12:58:16 +03:00
Fix SAX2 builder in case of undefined attributes namespace
To follow the early XML-1.0 REC, the new localname is "prefix:localname" and there is obviously now namespace.
This commit is contained in:
parent
77b77b1301
commit
1c989278d9
27
SAX2.c
27
SAX2.c
@ -2335,8 +2335,33 @@ xmlSAX2StartElementNs(void *ctx,
|
||||
*/
|
||||
if (nb_attributes > 0) {
|
||||
for (j = 0,i = 0;i < nb_attributes;i++,j+=5) {
|
||||
/*
|
||||
* Handle the rare case of an undefined atribute prefix
|
||||
*/
|
||||
if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) {
|
||||
if (ctxt->dictNames) {
|
||||
const xmlChar *fullname;
|
||||
|
||||
fullname = xmlDictQLookup(ctxt->dict, attributes[j+1],
|
||||
attributes[j]);
|
||||
if (fullname != NULL) {
|
||||
xmlSAX2AttributeNs(ctxt, fullname, NULL,
|
||||
attributes[j+3], attributes[j+4]);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
lname = xmlBuildQName(attributes[j], attributes[j+1],
|
||||
NULL, 0);
|
||||
if (lname != NULL) {
|
||||
xmlSAX2AttributeNs(ctxt, lname, NULL,
|
||||
attributes[j+3], attributes[j+4]);
|
||||
xmlFree(lname);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1],
|
||||
attributes[j+3], attributes[j+4]);
|
||||
attributes[j+3], attributes[j+4]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user