diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2009-05-11 21:12:26 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2009-05-11 21:12:26 +0400 |
commit | ce01d27dc27548090fa85981dc824290a39bc127 (patch) | |
tree | d3996d74a294dd13aa1b1734b3a09e64904b9b81 /mcs/class/System.XML/Test | |
parent | 93e9f216e17c8601d71af7b6a42536d485d821e5 (diff) |
2009-05-11 Atsushi Enomoto <atsushi@ximian.com>
* XmlSchemaComplexType.cs : do not forget to clear attributes
before Compile(). Patch by Jonas Larsson. Fixed bug #501763.
* XsdValidatingReaderTest.cs : test for bug #501763 by Jonas Larsson.
svn path=/trunk/mcs/; revision=133905
Diffstat (limited to 'mcs/class/System.XML/Test')
-rw-r--r-- | mcs/class/System.XML/Test/System.Xml/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs | 63 |
2 files changed, 67 insertions, 0 deletions
diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog index 71c8242f75e..51853bec4da 100644 --- a/mcs/class/System.XML/Test/System.Xml/ChangeLog +++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog @@ -1,3 +1,7 @@ +2009-05-11 Atsushi Enomoto <atsushi@ximian.com> + + * XsdValidatingReaderTest.cs : test for bug #501763 by Jonas Larsson. + 2009-04-28 Sebastien Pouliot <sebastien@ximian.com> * XmlReaderCommonTests.cs: Add test case for an empty string url diff --git a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs index 988d55e725b..9cad92514d3 100644 --- a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs @@ -574,7 +574,70 @@ namespace MonoTests.System.Xml RunValidation (xml, xsd);
}
+
+ [Test]
+ public void Bug501763 ()
+ {
+ string xsd1 = @"
+ <xs:schema id='foo1'
+ targetNamespace='foo1'
+ elementFormDefault='qualified'
+ xmlns='foo1'
+ xmlns:xs='http://www.w3.org/2001/XMLSchema'
+ xmlns:f2='foo2'>
+
+ <xs:import namespace='foo2' />
+ <xs:element name='Foo1Element' type='f2:Foo2ExtendedType'/>
+ </xs:schema>";
+
+ string xsd2 = @"
+ <xs:schema id='foo2'
+ targetNamespace='foo2'
+ elementFormDefault='qualified'
+ xmlns='foo2'
+ xmlns:xs='http://www.w3.org/2001/XMLSchema' >
+
+ <xs:element name='Foo2Element' type='Foo2Type' />
+
+ <xs:complexType name='Foo2Type'>
+ <xs:attribute name='foo2Attr' type='xs:string' use='required'/>
+ </xs:complexType>
+
+ <xs:complexType name='Foo2ExtendedType'>
+ <xs:complexContent>
+ <xs:extension base='Foo2Type'>
+ <xs:attribute name='foo2ExtAttr' type='xs:string' use='required'/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:schema>";
+
+ XmlDocument doc = new XmlDocument ();
+
+ XmlSchema schema1 = XmlSchema.Read (XmlReader.Create (new StringReader (xsd1)), null);
+ XmlSchema schema2 = XmlSchema.Read (XmlReader.Create (new StringReader (xsd2)), null);
+
+ doc.LoadXml (@"
+ <Foo2Element
+ foo2Attr='dummyvalue1'
+ xmlns='foo2'
+ />");
+ doc.Schemas.Add (schema2);
+ doc.Validate (null);
+
+ doc = new XmlDocument();
+ doc.LoadXml(@"
+ <Foo1Element
+ foo2Attr='dummyvalue1'
+ foo2ExtAttr='dummyvalue2'
+ xmlns='foo1'
+ />");
+ doc.Schemas.Add (schema2);
+ doc.Schemas.Add (schema1);
+ doc.Validate (null);
+ }
+
void RunValidation (string xml, string xsd)
{
XmlReaderSettings s = new XmlReaderSettings ();
|