[Mono-bugs] [Bug 81000][Nor] New - XmlTextReader doesn't resolve entities from DTD

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Mar 2 05:56:03 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by pawel.sakowski at mindbreeze.com.

http://bugzilla.ximian.com/show_bug.cgi?id=81000

--- shadow/81000	2007-03-02 05:56:03.000000000 -0500
+++ shadow/81000.tmp.7916	2007-03-02 05:56:03.000000000 -0500
@@ -0,0 +1,91 @@
+Bug#: 81000
+Product: Mono: Class Libraries
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com                            
+ReportedBy: pawel.sakowski at mindbreeze.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlTextReader doesn't resolve entities from DTD
+
+Description of Problem:
+XmlTextResolver is unable to resolve entities which are defined in a
+referenced DTD.
+
+Steps to reproduce the problem:
+1. Compile (gmcs) and run the following code:
+
+using System;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Xml;
+
+namespace Mindbreeze.Utils
+{
+    public class Resolver : XmlResolver
+    {
+
+        public override ICredentials Credentials
+        {
+            set
+            {
+            }
+        }
+
+        public override object GetEntity(Uri absoluteUri, string role, Type
+type)
+        {
+            return new MemoryStream(Encoding.UTF8.GetBytes("<!ENTITY alpha
+\"bravo\">"));
+        }
+    }
+
+    public class Program
+    {
+        public static void Main()
+        {
+            XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
+            xmlReaderSettings.ProhibitDtd = false;
+            xmlReaderSettings.XmlResolver = new Resolver();
+
+            string xml = "<!DOCTYPE xsl:stylesheet SYSTEM
+\"foo.dtd\"><root>&alpha;</root>";
+
+            XmlReader reader = XmlReader.Create(new StringReader(xml),
+xmlReaderSettings);
+
+            while (reader.Read())
+            {
+                Console.WriteLine("-" + reader.Value + "-");
+            }
+        }
+    }
+}
+
+Actual Results:
+--
+--
+--
+--
+
+Expected Results:
+--
+--
+-bravo-
+--
+
+How often does this happen? 
+100%
+
+Additional Information:
+mono 1.2.2.1
+MS Framework delivers the expected results.


More information about the mono-bugs mailing list