-/**\r
- * Namespace: System.Web.UI.WebControls\r
- * Class: Xml\r
- *\r
- * Author: Gaurav Vaish\r
- * Maintainer: gvaish@iitk.ac.in\r
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\r
- * Implementation: yes\r
- * Status: 75%\r
- *\r
- * (C) Gaurav Vaish (2002)\r
- */\r
+//
+// System.Web.UI.WebControls.Xml.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//\r
\r
using System;\r
-using System.ComponentModel;\r
+using System.ComponentModel;
+using System.ComponentModel.Design;\r
using System.IO;\r
using System.Xml;\r
using System.Xml.Xsl;\r
namespace System.Web.UI.WebControls\r
{\r
[DefaultProperty("DocumentSource")]\r
- [PersistChildren(false)]\r
+ [PersistChildren(false)]
+ // TODO add control builder
+ //[ControlBuilder ()]
+ [Designer ("System.Web.UI.Design.WebControls.XmlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]\r
public class Xml : Control\r
{\r
private XmlDocument document;\r
{\r
XmlTextReader reader = new XmlTextReader(new StringReader("<xsl:stylesheet version='1.0' " +\r
"xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>" +\r
- "<xsl:template match=\"\">" +\r
+ "<xsl:template match=\"*\">" +\r
"<xsl:copy-of select=\".\"/>" +\r
"</xsl:template>" +\r
"</xsl:stylesheet>"));\r
{\r
}\r
\r
- [MonoTODO("Initialize_Document")]\r
- private void LoadXmlDoc()\r
+ [MonoTODO("security")]\r
+ private void LoadXmlDoc ()\r
{\r
- throw new NotImplementedException();\r
- }\r
+ if (documentContent != null && documentContent.Length > 0) {\r
+ document = new XmlDocument();\r
+ document.LoadXml (documentContent);\r
+ return;\r
+ }\r
\r
+ if (documentSource != null && documentSource.Length != 0) {\r
+ document = new XmlDocument();\r
+ document.Load (documentSource);\r
+ }\r
+ }\r
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("This is the XML document that is used for the XML Webcontrol.")]\r
public XmlDocument Document\r
{\r
get\r
document = value;\r
}\r
}\r
-\r
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The XML content that is transformed for the XML Webcontrol.")]\r
public string DocumentContent\r
{\r
get\r
documentContent = value;\r
}\r
}\r
-\r
+
+ [DefaultValue (""), Bindable (true), WebCategory ("Behavior")]
+ [Editor ("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("The URL or the source of the XML content that is transformed for the XML Webcontrol.")]\r
public string DocumentSource\r
{\r
get\r
documentSource = value;\r
}\r
}\r
-\r
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("The XSL transform that is applied to this XML Webcontrol.")]\r
public XslTransform Transform\r
{\r
get\r
transform = value;\r
}\r
}\r
-\r
+
+ [DefaultValue (""), Bindable (true), WebCategory ("Behavior")]
+ [Editor ("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [WebSysDescription ("An URL specifying the source that is used for the XSL transformation.")]\r
public string TransformSource\r
{\r
get\r
transformSource = value;\r
}\r
}\r
-\r
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription ("Arguments that are used by the XSL Transform.")]\r
public XsltArgumentList TransformArgumentList\r
{\r
get\r
DocumentContent = ((LiteralControl)obj).Text;\r
return;\r
}\r
- throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Have_Children_of_Type", "Xml", GetType().Name.ToString()));\r
+ throw new HttpException (HttpRuntime.FormatResourceString (\r
+ "Cannot_Have_Children_of_Type",\r
+ "Xml",\r
+ GetType().Name));\r
}\r
\r
- [MonoTODO("Initialize_xpathDocument")]\r
- private void LoadXpathDoc()\r
+ [MonoTODO("security")]\r
+ private void LoadXpathDoc ()\r
{\r
- if(documentContent != null && documentContent.Length > 0)\r
- {\r
- xpathDoc = new XPathDocument(new StringReader(documentContent));\r
+ if(documentContent != null && documentContent.Length > 0) {\r
+ xpathDoc = new XPathDocument (new StringReader (documentContent));\r
return;\r
}\r
- if(documentSource == null || documentSource.Length == 0)\r
- {\r
+\r
+ if (documentSource != null && documentSource.Length != 0) {\r
+ xpathDoc = new XPathDocument (MapPathSecure (documentSource));\r
return;\r
}\r
- throw new NotImplementedException();\r
}\r
\r
- [MonoTODO("Initialize_Transform")]\r
- private void LoadTransform()\r
+ [MonoTODO("security")]\r
+ private void LoadTransform ()\r
{\r
- throw new ArgumentException();\r
+ if (transform != null)\r
+ return;\r
+\r
+ if (transformSource != null && transformSource.Length != 0) {\r
+ transform = new XslTransform ();\r
+ transform.Load (MapPathSecure (transformSource));\r
+ }\r
}\r
\r
- [MonoTODO]\r
protected override void Render(HtmlTextWriter output)\r
{\r
if(document == null)\r
}\r
\r
LoadTransform();\r
- if(document == null || xpathDoc == null)\r
+ if(document == null && xpathDoc == null)\r
{\r
return;\r
}\r
}\r
}\r
}\r
+\r