+2009-09-15 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlAttributeCollection.cs : removed duplicate ID attribute check
+ here as this behavior not specifically defined by W3C DOM Level 2
+ specification. Fixed bug #508296.
+
2009-08-21 Atsushi Enomoto <atsushi@ximian.com>
* XmlTextReader.cs : there still was use of bogus
if (attdef == null || attdef.Datatype.TokenizedType != XmlTokenizedType.ID)
return;
- // adding new identical attribute, but
- // MS.NET is pity for ID support, so I'm wondering how to correct it...
- if (ownerElement.IsRooted) {
- XmlAttribute dup = ownerDocument.GetIdenticalAttribute (node.Value);
- if (dup != null && dup.OwnerElement != null && dup.OwnerElement.IsRooted)
- throw new XmlException (String.Format (
- "ID value {0} already exists in this document.", node.Value));
- }
ownerDocument.AddIdenticalAttribute (node);
}
+2009-09-15 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlAttributeCollectionTests.cs : add test for bug #508296 by
+ Tom Hindle.
+
2009-08-21 Atsushi Enomoto <atsushi@ximian.com>
* XmlTextReaderTests.cs : added test for null nametable in parser
doc.SelectNodes ("//mynode") [0].Attributes.Append (a);
doc.SelectNodes ("//mynode") [0].Attributes.Append (a);
}
+
+ [Test]
+ public void AddIdentityDuplicate ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (@"
+ <!DOCTYPE eticGlossList [<!ELEMENT item (item*)><!ATTLIST item id ID #IMPLIED>]>
+ <group><item></item><item id=""tom""><f/></item></group>");
+ XmlNodeList nodes = doc.SelectNodes ("group/item");
+ int n = 1;
+ foreach (XmlNode node in nodes) {
+ XmlAttribute idAttr = doc.CreateAttribute ("id");
+
+ idAttr.Value = "id";
+ node.Attributes.Append (idAttr);
+ Assert.AreEqual (1, node.Attributes.Count, "#" + n++);
+ }
+ }
}
}