Author: atsushi
Date: 2006-11-13 20:25:47 -0500 (Mon, 13 Nov 2006)
New Revision: 67808
Modified:
trunk/mcs/class/System.XML/System.Xml/ChangeLog
trunk/mcs/class/System.XML/System.Xml/XmlReader.cs
trunk/mcs/class/System.XML/System.Xml/XmlTextReader.cs
trunk/mcs/class/System.XML/System.Xml/XmlTextReader2.cs
trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderSettingsTests.cs
Log:
2006-11-13 Michael Meeks <[EMAIL PROTECTED]>
* XmlReader.cs, XmlTextReader.cs, XmlTextReader2.cs:
pass the XmlResolver through to the GetStream impl.
2006-11-13 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlReaderSettingsTests.cs : added custom resolver case for primary
XML stream (custom resolver is indeed used and here it should cause
error).
Modified: trunk/mcs/class/System.XML/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/ChangeLog 2006-11-14 00:59:38 UTC
(rev 67807)
+++ trunk/mcs/class/System.XML/System.Xml/ChangeLog 2006-11-14 01:25:47 UTC
(rev 67808)
@@ -1,3 +1,8 @@
+2006-11-13 Michael Meeks <[EMAIL PROTECTED]>
+
+ * XmlReader.cs, XmlTextReader.cs, XmlTextReader2.cs:
+ pass the XmlResolver through to the GetStream impl.
+
2006-10-30 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlTextReader2.cs : if DTD does not exist, do not try to resolve
Modified: trunk/mcs/class/System.XML/System.Xml/XmlReader.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlReader.cs 2006-11-14 00:59:38 UTC
(rev 67807)
+++ trunk/mcs/class/System.XML/System.Xml/XmlReader.cs 2006-11-14 01:25:47 UTC
(rev 67808)
@@ -310,7 +310,7 @@
settings = PopulateSettings (settings);
if (context == null)
context = PopulateParserContext (settings, url);
- XmlTextReader xtr = new XmlTextReader (true, url,
GetNodeType (settings), context);
+ XmlTextReader xtr = new XmlTextReader (false,
settings.XmlResolver, url, GetNodeType (settings), context);
XmlReader ret = CreateCustomizedTextReader (xtr,
settings);
xtr.CloseInput = true;
return xtr;
Modified: trunk/mcs/class/System.XML/System.Xml/XmlTextReader.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlTextReader.cs 2006-11-14
00:59:38 UTC (rev 67807)
+++ trunk/mcs/class/System.XML/System.Xml/XmlTextReader.cs 2006-11-14
01:25:47 UTC (rev 67808)
@@ -127,8 +127,12 @@
// This is used in XmlReader.Create() to indicate that string
// argument is uri, not an xml fragment.
- internal XmlTextReader (bool dummy, string url, XmlNodeType
fragType, XmlParserContext context)
+ internal XmlTextReader (bool dummy, XmlResolver resolver,
string url, XmlNodeType fragType, XmlParserContext context)
{
+ if (resolver == null)
+ resolver = new XmlUrlResolver ();
+
+ this.XmlResolver = resolver;
string uriString;
Stream stream = GetStreamFromUrl (url, out uriString);
this.InitializeContext (uriString, context, new
XmlStreamReader (stream), fragType);
Modified: trunk/mcs/class/System.XML/System.Xml/XmlTextReader2.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlTextReader2.cs 2006-11-14
00:59:38 UTC (rev 67807)
+++ trunk/mcs/class/System.XML/System.Xml/XmlTextReader2.cs 2006-11-14
01:25:47 UTC (rev 67808)
@@ -129,9 +129,9 @@
source = new XmlTextReaderImpl (baseURI, xmlFragment,
fragType, context);
}
- internal XmlTextReader (bool dummy, string url, XmlNodeType
fragType, XmlParserContext context)
+ internal XmlTextReader (bool dummy, XmlResolver resolver,
string url, XmlNodeType fragType, XmlParserContext context)
{
- source = new XmlTextReaderImpl (dummy, url, fragType,
context);
+ source = new XmlTextReaderImpl (dummy, resolver, url,
fragType, context);
}
private XmlTextReader (XmlTextReaderImpl entityContainer, bool
insideAttribute)
Modified: trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog 2006-11-14
00:59:38 UTC (rev 67807)
+++ trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog 2006-11-14
01:25:47 UTC (rev 67808)
@@ -1,5 +1,11 @@
2006-11-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * XmlReaderSettingsTests.cs : added custom resolver case for primary
+ XML stream (custom resolver is indeed used and here it should cause
+ error).
+
+2006-11-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* XmlReaderSettingsTests.cs : added NullResolver() case.
2006-10-27 Atsushi Enomoto <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderSettingsTests.cs
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderSettingsTests.cs
2006-11-14 00:59:38 UTC (rev 67807)
+++ trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderSettingsTests.cs
2006-11-14 01:25:47 UTC (rev 67808)
@@ -10,6 +10,7 @@
#if NET_2_0
using System;
using System.IO;
+using System.Net;
using System.Text;
using System.Xml;
using System.Xml.Schema;
@@ -317,6 +318,30 @@
xr.Read ();
}
}
+
+ class ThrowExceptionResolver : XmlResolver
+ {
+ public override ICredentials Credentials {
+ set { }
+ }
+
+ public override object GetEntity (Uri uri, string type,
Type expected)
+ {
+ throw new ApplicationException ("error");
+ }
+ }
+
+ [Test]
+ [ExpectedException (typeof (ApplicationException))]
+ public void CustomResolverUsedForXmlStream ()
+ {
+ XmlReaderSettings settings = new XmlReaderSettings ();
+ settings.XmlResolver = new ThrowExceptionResolver ();
+ using (XmlReader xr = XmlReader.Create
("Test/XmlFiles/simple.xml", settings)) {
+ while (!xr.EOF)
+ xr.Read ();
+ }
+ }
}
}
#endif
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches