Register  Login       Search  
Forum  
 
  
 
Forum  Forum     
 
SearchForum Home
  XML Lab Products  eXml Web Server Control  Allow DTD in xm...
 Allow DTD in xml/xslt (XmlReaderSettings)
 
derigel
1 posts
Joined
5/1/2006

Allow DTD in xml/xslt (XmlReaderSettings)
Posted: 01 May 06 1:33 AM (N/A)

I have xslt containig DTD entities. During loading of it I getting exception that DTD is prohibited.
It's necessary explicity to allow it. But that settings are internal in eXml control.
I've slightly modified control and published that settings to public. I did it only for xslt, but similar settings also usefull for xml loading too.

Here are patch:

--- C:\Documents and Settings\derigel\Desktop\eXml.cs Mon Feb 13 19:01:36 2006 UTC
+++ D:\Projects\eXml-1.1\src\WebControls\WebControls\eXml.cs Mon May 1 07:24:35 2006 UTC
@@ -47,6 +47,7 @@
         private string transformSource;
         private IXPathNavigable document;
         private XsltSettings xsltSettings = XsltSettings.Default;
+    private XmlReaderSettings xsltXmlReaderSettings = new XmlReaderSettings();
         //true for compatibility with <asp:xml>
         private bool stripWhitespace = true;
         //false becuase requires FullTrust
@@ -317,7 +318,7 @@
                     using (Stream stream = base.OpenFile(path))
                     {                       
                         this.transform = new XslCompiledTransform();
-                        this.transform.Load(XmlReader.Create(stream, null, path),
+            this.transform.Load(XmlReader.Create(stream, xsltXmlReaderSettings, path),
                             xsltSettings, registeringResolver);
                     }
                     if (dependency != null)
@@ -644,6 +645,24 @@
         }
 
         /// <summary>
+    /// Specifies the XmlReader settings to use during loading of the XSLT style sheet.
+    /// </summary>
+    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+    [Browsable(false)]
+    [Description("Specifies the XmlReader settings to use during loading of the XSLT style sheet.")]
+    public XmlReaderSettings XsltXmlReaderSettings
+    {
+     get
+     {
+       return this.xsltXmlReaderSettings;
+     }
+     set
+     {
+       this.xsltXmlReaderSettings = value; 
+     }
+    }
+
+        /// <summary>
         /// The XSLT file used to transform the XML data.
         /// </summary>
         [Editor("System.Web.UI.Design.XslUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]

olegt
85 posts
www.xmllab.net
Joined
2/25/2005

Re: Allow DTD in xml/xslt (XmlReaderSettings)
Posted: 11 Jul 06 2:26 AM (Israel)
Thanks for your contribution! I'll include your fix into the next eXml release.

Oleg Tkachenko, Microsoft MVP for XML, MCPD
http://www.XmlLab.Net | http://blog.tkachenko.com
  XML Lab Products  eXml Web Server Control  Allow DTD in xm...
Forum Home  Search