From 73b53a30b0af46d4fc7e29e5e6075f60400e6fa8 Mon Sep 17 00:00:00 2001 From: myeisha Date: Fri, 12 Nov 2010 17:08:27 +0100 Subject: [PATCH 1/2] Don't add IDREFs to set of missing IDs multiple times --- mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs b/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs index f6ae29c20da7..8eea3d30a2aa 100644 --- a/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs +++ b/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs @@ -1809,14 +1809,14 @@ public string AssessEachAttributeIdentityConstraint ( MissingIDReferences.Remove (str); break; case XmlTokenizedType.IDREF: - if (!idList.Contains (str)) + if (!idList.Contains (str) && !MissingIDReferences.Contains (str)) MissingIDReferences.Add (str); break; case XmlTokenizedType.IDREFS: string [] idrefs = (string []) parsedValue; for (int i = 0; i < idrefs.Length; i++) { string id = idrefs [i]; - if (!idList.Contains (id)) + if (!idList.Contains (id) && !MissingIDReferences.Contains (str)) MissingIDReferences.Add (id); } break; From 5150ffd9f37337b838d0b4ed049ed69b467c27d2 Mon Sep 17 00:00:00 2001 From: myeisha Date: Tue, 16 Nov 2010 13:04:30 +0100 Subject: [PATCH 2/2] Add testcase for multiple missing IDs --- .../XmlSchemaValidatorTests.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaValidatorTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaValidatorTests.cs index e58e24c35907..9d5da5fc57a8 100644 --- a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaValidatorTests.cs +++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaValidatorTests.cs @@ -297,6 +297,37 @@ public void Bug584664 () Validate (File.ReadAllText ("Test/XmlFiles/xsd/584664a.xml"), File.ReadAllText ("Test/XmlFiles/xsd/584664a.xsd")); Validate (File.ReadAllText ("Test/XmlFiles/xsd/584664b.xml"), File.ReadAllText ("Test/XmlFiles/xsd/584664b.xsd")); } + + [Test] + public void MultipleMissingIds () + { + var schema = XmlSchema.Read (new StringReader (@" + + + + + + + + + + + + + +"), null); + var xml = @" + + + + +"; + var document = new XmlDocument (); + document.LoadXml (xml); + document.Schemas = new XmlSchemaSet (); + document.Schemas.Add (schema); + document.Validate (null); + } } }