X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.XML%2FTest%2FSystem.Xml.Schema%2FXmlSchemaSetTests.cs;h=9b45b3f8aaa062da5aad29663ed56d7fae16cae5;hb=be1d9a7fe207f86fe7033cb49dea0e9a367ece79;hp=d5078cbc5afd0fc4b1e521345167fbec865e6f26;hpb=2f8435c7248e1e4a96c421c3bf16ead841a96f03;p=mono.git
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
index d5078cbc5af..9b45b3f8aaa 100644
--- a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs
@@ -6,11 +6,11 @@
//
// (C) 2004 Novell Inc.
//
-#if NET_2_0
using System;
using System.Collections;
using System.IO;
+using System.Text;
using System.Xml;
using System.Xml.Schema;
using NUnit.Framework;
@@ -163,7 +163,7 @@ namespace MonoTests.System.Xml
ss.Compile ();
Assert.IsTrue (ss.IsCompiled, "#4");
ss.RemoveRecursive (s);
- Assert.IsTrue (ss.IsCompiled, "#5");
+ Assert.IsFalse (ss.IsCompiled, "#5");
}
[Test] // bug #77489
@@ -218,6 +218,100 @@ type=""xsd:string"" use=""required""/>
var xsd = schemas.Add ("", XmlReader.Create (new StringReader (xsdraw)));
Assert.IsNull (xsd.TargetNamespace, "#1");
}
+
+ [Test] // part of bug #670945
+ public void TwoSchemasInSameDocumentUri ()
+ {
+ string xsd1 = @"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
+
+ string xsd2 = @"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
+
+ var xss = new XmlSchemaSet ();
+ var xs1 = XmlSchema.Read (new StringReader (xsd1), null);
+ xs1.SourceUri = "http://localhost:8080/dummy.wsdl";
+ xs1.LineNumber = 5;
+ xss.Add (xs1);
+ var xs2 = XmlSchema.Read (new StringReader (xsd2), null);
+ xs2.SourceUri = "http://localhost:8080/dummy.wsdl";
+ xs2.LineNumber = 50;
+ xss.Add (xs2);
+ xss.Compile ();
+ Assert.IsNotNull (xss.GlobalElements [new XmlQualifiedName ("GetSystemDateAndTimeResponse", "http://www.onvif.org/ver10/device/wsdl")], "#1");
+ }
+
+ [Test] // bug #13716
+ public void ResolveSchemaUriUsingXmlResolver ()
+ {
+ var resolver = new Bug13716XmlResolver ();
+ string xml = "Clean Code";
+ string ns = "testschema";
+ string xsdPath = "my.xsd";
+
+ var readerSettings = new XmlReaderSettings ();
+
+ //readerSettings.XmlResolver = resolver;
+ readerSettings.Schemas.XmlResolver = resolver;
+ readerSettings.Schemas.Add (ns, xsdPath);
+ readerSettings.ValidationType = ValidationType.Schema;
+
+ using (var xr = XmlReader.Create (new StringReader (xml), readerSettings))
+ {
+ while (!xr.EOF)
+ xr.Read ();
+ }
+ }
+
+ public class Bug13716XmlResolver : XmlUrlResolver
+ {
+ public override object GetEntity(Uri absoluteUri, string role, Type typeOfObjectToReturn)
+ {
+ string xsd = @"
+
+
+ ";
+ return new MemoryStream (Encoding.UTF8.GetBytes (xsd));
+ }
+ }
}
}
-#endif