mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-11 05:17:37 +03:00
parser: Fix detection of duplicate attributes in XML namespace
Fixes a regression from commit e0dd330b
, resulting in duplicate
attributes in the predefined XML namespace not being detected or
extraneous default attributes being passed.
Fixes #704.
This commit is contained in:
parent
ce8f3d2c1d
commit
186562a182
2
parser.c
2
parser.c
@ -8910,7 +8910,7 @@ xmlAttrHashInsert(xmlParserCtxtPtr ctxt, unsigned size, const xmlChar *name,
|
||||
int nsIndex = (int) (ptrdiff_t) atts[2];
|
||||
|
||||
if ((nsIndex == NS_INDEX_EMPTY) ? (uri == NULL) :
|
||||
(nsIndex == NS_INDEX_XML) ? (uri == ctxt->str_xml) :
|
||||
(nsIndex == NS_INDEX_XML) ? (uri == ctxt->str_xml_ns) :
|
||||
(uri == ctxt->nsTab[nsIndex * 2 + 1]))
|
||||
return(bucket->index);
|
||||
}
|
||||
|
7
result/def-xml-attr.xml
Normal file
7
result/def-xml-attr.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE root [
|
||||
<!ATTLIST foo xml:lang CDATA "eng">
|
||||
]>
|
||||
<root>
|
||||
<foo xml:lang="ger">Ja</foo>
|
||||
</root>
|
10
result/def-xml-attr.xml.rde
Normal file
10
result/def-xml-attr.xml.rde
Normal file
@ -0,0 +1,10 @@
|
||||
0 10 root 0 0
|
||||
0 1 root 0 0
|
||||
1 14 #text 0 1
|
||||
|
||||
1 1 foo 0 0
|
||||
2 3 #text 0 1 Ja
|
||||
1 15 foo 0 0
|
||||
1 14 #text 0 1
|
||||
|
||||
0 15 root 0 0
|
10
result/def-xml-attr.xml.rdr
Normal file
10
result/def-xml-attr.xml.rdr
Normal file
@ -0,0 +1,10 @@
|
||||
0 10 root 0 0
|
||||
0 1 root 0 0
|
||||
1 14 #text 0 1
|
||||
|
||||
1 1 foo 0 0
|
||||
2 3 #text 0 1 Ja
|
||||
1 15 foo 0 0
|
||||
1 14 #text 0 1
|
||||
|
||||
0 15 root 0 0
|
15
result/def-xml-attr.xml.sax
Normal file
15
result/def-xml-attr.xml.sax
Normal file
@ -0,0 +1,15 @@
|
||||
SAX.setDocumentLocator()
|
||||
SAX.startDocument()
|
||||
SAX.internalSubset(root, , )
|
||||
SAX.attributeDecl(foo, xml:lang, 1, 1, eng, ...)
|
||||
SAX.externalSubset(root, , )
|
||||
SAX.startElement(root)
|
||||
SAX.characters(
|
||||
, 3)
|
||||
SAX.startElement(foo, xml:lang='ger')
|
||||
SAX.characters(Ja, 2)
|
||||
SAX.endElement(foo)
|
||||
SAX.characters(
|
||||
, 1)
|
||||
SAX.endElement(root)
|
||||
SAX.endDocument()
|
15
result/def-xml-attr.xml.sax2
Normal file
15
result/def-xml-attr.xml.sax2
Normal file
@ -0,0 +1,15 @@
|
||||
SAX.setDocumentLocator()
|
||||
SAX.startDocument()
|
||||
SAX.internalSubset(root, , )
|
||||
SAX.attributeDecl(foo, xml:lang, 1, 1, eng, ...)
|
||||
SAX.externalSubset(root, , )
|
||||
SAX.startElementNs(root, NULL, NULL, 0, 0, 0)
|
||||
SAX.characters(
|
||||
, 3)
|
||||
SAX.startElementNs(foo, NULL, NULL, 0, 1, 0, xml:lang='ger"...', 3)
|
||||
SAX.characters(Ja, 2)
|
||||
SAX.endElementNs(foo, NULL, NULL)
|
||||
SAX.characters(
|
||||
, 1)
|
||||
SAX.endElementNs(root, NULL, NULL)
|
||||
SAX.endDocument()
|
3
result/errors/dup-xml-attr.xml.ent
Normal file
3
result/errors/dup-xml-attr.xml.ent
Normal file
@ -0,0 +1,3 @@
|
||||
./test/errors/dup-xml-attr.xml:1: parser error : Attribute xml:lang redefined
|
||||
<doc xml:lang="en" xml:lang="de"/>
|
||||
^
|
3
result/errors/dup-xml-attr.xml.err
Normal file
3
result/errors/dup-xml-attr.xml.err
Normal file
@ -0,0 +1,3 @@
|
||||
./test/errors/dup-xml-attr.xml:1: parser error : Attribute xml:lang redefined
|
||||
<doc xml:lang="en" xml:lang="de"/>
|
||||
^
|
4
result/errors/dup-xml-attr.xml.str
Normal file
4
result/errors/dup-xml-attr.xml.str
Normal file
@ -0,0 +1,4 @@
|
||||
./test/errors/dup-xml-attr.xml:1: parser error : Attribute xml:lang redefined
|
||||
<doc xml:lang="en" xml:lang="de"/>
|
||||
^
|
||||
./test/errors/dup-xml-attr.xml : failed to parse
|
7
result/noent/def-xml-attr.xml
Normal file
7
result/noent/def-xml-attr.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE root [
|
||||
<!ATTLIST foo xml:lang CDATA "eng">
|
||||
]>
|
||||
<root>
|
||||
<foo xml:lang="ger">Ja</foo>
|
||||
</root>
|
15
result/noent/def-xml-attr.xml.sax2
Normal file
15
result/noent/def-xml-attr.xml.sax2
Normal file
@ -0,0 +1,15 @@
|
||||
SAX.setDocumentLocator()
|
||||
SAX.startDocument()
|
||||
SAX.internalSubset(root, , )
|
||||
SAX.attributeDecl(foo, xml:lang, 1, 1, eng, ...)
|
||||
SAX.externalSubset(root, , )
|
||||
SAX.startElementNs(root, NULL, NULL, 0, 0, 0)
|
||||
SAX.characters(
|
||||
, 3)
|
||||
SAX.startElementNs(foo, NULL, NULL, 0, 1, 0, xml:lang='ger"...', 3)
|
||||
SAX.characters(Ja, 2)
|
||||
SAX.endElementNs(foo, NULL, NULL)
|
||||
SAX.characters(
|
||||
, 1)
|
||||
SAX.endElementNs(root, NULL, NULL)
|
||||
SAX.endDocument()
|
7
test/def-xml-attr.xml
Normal file
7
test/def-xml-attr.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE root [
|
||||
<!ATTLIST foo xml:lang CDATA "eng">
|
||||
]>
|
||||
<root>
|
||||
<foo xml:lang="ger">Ja</foo>
|
||||
</root>
|
1
test/errors/dup-xml-attr.xml
Normal file
1
test/errors/dup-xml-attr.xml
Normal file
@ -0,0 +1 @@
|
||||
<doc xml:lang="en" xml:lang="de"/>
|
Loading…
Reference in New Issue
Block a user