Added System.Xml.Xsl stubs courtesy of Tim Coleman <tim@timcoleman.com>.
authorJason Diamond <injektilo@mono-cvs.ximian.com>
Mon, 29 Apr 2002 21:55:36 +0000 (21:55 -0000)
committerJason Diamond <injektilo@mono-cvs.ximian.com>
Mon, 29 Apr 2002 21:55:36 +0000 (21:55 -0000)
svn path=/trunk/mcs/; revision=4157

mcs/class/System.XML/System.Xml.Xsl/IXsltContextFunction.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml.Xsl/IXsltContextVariable.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml.Xsl/XsltArgumentList.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml.Xsl/XsltCompileException.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml.Xsl/XsltException.cs [new file with mode: 0644]

diff --git a/mcs/class/System.XML/System.Xml.Xsl/IXsltContextFunction.cs b/mcs/class/System.XML/System.Xml.Xsl/IXsltContextFunction.cs
new file mode 100644 (file)
index 0000000..8868df2
--- /dev/null
@@ -0,0 +1,31 @@
+// System.Xml.Xsl.IXsltContextFunction\r
+// \r
+// Author: Tim Coleman <tim@timcoleman.com>\r
+// (C) Copyright 2002 Tim Coleman\r
+\r
+using System;\r
+using System.Xml.XPath;\r
+\r
+namespace System.Xml.Xsl\r
+{\r
+       public interface IXsltContextFunction\r
+       {\r
+               #region Properties\r
+\r
+               XPathResultType[] ArgTypes { get; }\r
+               int Maxargs { get; }\r
+               int Minargs { get; }\r
+               XPathResultType ReturnType { get; }\r
+\r
+               #endregion\r
+\r
+               #region Methods\r
+\r
+               object Invoke(\r
+                       XsltContext xsltContext,\r
+                       object[] args,\r
+                       XPathNavigator docContext);\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml.Xsl/IXsltContextVariable.cs b/mcs/class/System.XML/System.Xml.Xsl/IXsltContextVariable.cs
new file mode 100644 (file)
index 0000000..57bca55
--- /dev/null
@@ -0,0 +1,27 @@
+// System.Xml.Xsl.IXsltContextVariable\r
+// \r
+// Author: Tim Coleman <tim@timcoleman.com>\r
+// (C) Copyright 2002 Tim Coleman\r
+\r
+using System;\r
+using System.Xml.XPath;\r
+\r
+namespace System.Xml.Xsl\r
+{\r
+       public interface IXsltContextVariable\r
+       {\r
+               #region Properties\r
+\r
+               bool IsLocal { get; }\r
+               bool IsParam { get; }\r
+               XPathResultType VariableType { get; }\r
+\r
+               #endregion\r
+\r
+               #region Methods\r
+\r
+               object Evaluate( XsltContext xsltContext );\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs b/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs
new file mode 100644 (file)
index 0000000..4103f66
--- /dev/null
@@ -0,0 +1,186 @@
+// System.Xml.Xsl.XslTransform\r
+// \r
+// Author: Tim Coleman <tim@timcoleman.com>\r
+// (C) Copyright 2002 Tim Coleman\r
+\r
+using System;\r
+using System.Xml.XPath;\r
+using System.IO;\r
+\r
+namespace System.Xml.Xsl\r
+{\r
+       public class XslTransform\r
+       {\r
+               #region Fields\r
+               \r
+               XmlResolver _xmlResolver;\r
+\r
+               #endregion\r
+\r
+               #region Constructors\r
+\r
+               [MonoTODO]\r
+               public XslTransform()\r
+               {\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Properties\r
+\r
+               XmlResolver XmlResolver {\r
+                       set { _xmlResolver = value; }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Methods\r
+\r
+               [MonoTODO]\r
+               // Loads the XSLT stylesheet contained in the IXPathNavigable.\r
+               public void Load( IXPathNavigable stylesheet )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Loads the XSLT stylesheet specified by a URL.\r
+               public void Load( string url )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Loads the XSLT stylesheet contained in the XmlReader\r
+               public void Load( XmlReader stylesheet )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Loads the XSLT stylesheet contained in the XPathNavigator\r
+               public void Load( XPathNavigator stylesheet )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Loads the XSLT stylesheet contained in the IXPathNavigable.\r
+               public void Load(       \r
+                       IXPathNavigable stylesheet, \r
+                       XmlResolver resolver )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Loads the XSLT stylesheet specified by a URL.\r
+               public void Load(       \r
+                       string url, \r
+                       XmlResolver resolver )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Loads the XSLT stylesheet contained in the XmlReader\r
+               public void Load( \r
+                       XmlReader stylesheet,\r
+                       XmlResolver resolver )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Loads the XSLT stylesheet contained in the XPathNavigator\r
+               public void Load( \r
+                       XPathNavigator stylesheet,\r
+                       XmlResolver resolver )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Transforms the XML data in the IXPathNavigable using \r
+               // the specified args and outputs the result to an XmlReader.\r
+               public XmlReader Transform(\r
+                       IXPathNavigable input,\r
+                       XsltArgumentList args )\r
+               {\r
+                       return null;\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Transforms the XML data in the input file and outputs \r
+               // the result to an output file.\r
+               public void Transform(\r
+                       string inputfile,\r
+                       string outputfile )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Transforms the XML data in the XPathNavigator using \r
+               // the specified args and outputs the result to an XmlReader.\r
+               public XmlReader Transform(\r
+                       XPathNavigator input,\r
+                       XsltArgumentList args )\r
+               {\r
+                       return null;\r
+               }\r
+               \r
+               [MonoTODO]\r
+               // Transforms the XML data in the IXPathNavigable using \r
+               // the specified args and outputs the result to a Stream.\r
+               public void Transform(\r
+                       IXPathNavigable input,\r
+                       XsltArgumentList args,\r
+                       Stream output )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Transforms the XML data in the IXPathNavigable using \r
+               // the specified args and outputs the result to a TextWriter.\r
+               public void Transform(\r
+                       IXPathNavigable input,\r
+                       XsltArgumentList args,\r
+                       TextWriter output )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Transforms the XML data in the IXPathNavigable using \r
+               // the specified args and outputs the result to an XmlWriter.\r
+               public void Transform(\r
+                       IXPathNavigable input,\r
+                       XsltArgumentList args,\r
+                       XmlWriter output )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Transforms the XML data in the XPathNavigator using \r
+               // the specified args and outputs the result to a Stream.\r
+               public void Transform(\r
+                       XPathNavigator input,\r
+                       XsltArgumentList args,\r
+                       Stream output )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Transforms the XML data in the XPathNavigator using \r
+               // the specified args and outputs the result to a TextWriter.\r
+               public void Transform(\r
+                       XPathNavigator input,\r
+                       XsltArgumentList args,\r
+                       TextWriter output )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // Transforms the XML data in the XPathNavigator using \r
+               // the specified args and outputs the result to an XmlWriter.\r
+               public void Transform(\r
+                       XPathNavigator input,\r
+                       XsltArgumentList args,\r
+                       XmlWriter output )\r
+               {\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XsltArgumentList.cs b/mcs/class/System.XML/System.Xml.Xsl/XsltArgumentList.cs
new file mode 100644 (file)
index 0000000..75dea16
--- /dev/null
@@ -0,0 +1,144 @@
+// System.Xml.Xsl.XsltArgumentList\r
+// \r
+// Author: Tim Coleman <tim@timcoleman.com>\r
+// (C) Copyright 2002 Tim Coleman\r
+\r
+using System;\r
+using System.Collections;\r
+using System.Xml;\r
+using System.Xml.XPath;\r
+\r
+namespace System.Xml.Xsl\r
+{\r
+       public sealed class XsltArgumentList\r
+       {\r
+               #region Fields\r
+\r
+               private Hashtable _extensionObjects;\r
+               private Hashtable _parameters;\r
+\r
+               #endregion\r
+\r
+               #region Constructors\r
+\r
+               public XsltArgumentList()\r
+               {\r
+                       _extensionObjects = new Hashtable();\r
+                       _parameters = new Hashtable();\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Methods\r
+\r
+               //--------------------------------------------------\r
+               public void AddExtensionObject( \r
+                       string namespaceUri, \r
+                       object extension )\r
+               {\r
+                       if (namespaceUri == null) \r
+                               throw new ArgumentException ("The namespaceUri is a null reference.");\r
+                       if (namespaceUri == "http://www.w3.org/1999/XSL/Transform")\r
+                               throw new ArgumentException ("The namespaceUri is http://www.w3.org/1999/XSL/Transform.");\r
+                       if (_extensionObjects.Contains (namespaceUri))\r
+                               throw new ArgumentException ("The namespaceUri already has an extension object associated with it.");\r
+\r
+                       _extensionObjects [namespaceUri] = extension;\r
+               }\r
+\r
+               //--------------------------------------------------\r
+               public void AddParam (\r
+                       string name, \r
+                       string namespaceUri, \r
+                       object parameter) \r
+               {\r
+\r
+                       if (namespaceUri == null) \r
+                               throw new ArgumentException ("The namespaceUri is a null reference.");\r
+               \r
+                       if (namespaceUri == "http://www.w3.org/1999/XSL/Transform")\r
+                               throw new ArgumentException ("The namespaceUri is http://www.w3.org/1999/XSL/Transform.");\r
+\r
+                       if (name == null)\r
+                               throw new ArgumentException ("The parameter name is a null reference.");\r
+\r
+       \r
+                       // TODO:\r
+                       // verify that the name is a valid name according to\r
+                       // the W3C XML specification\r
+\r
+                       XmlQualifiedName qName = new XmlQualifiedName (name, namespaceUri);\r
+\r
+                       if (_parameters.Contains (qName))\r
+                               throw new ArgumentException ("The namespaceUri already has a parameter associated with it.");\r
+\r
+                       if( !(parameter is string)\r
+                       &&  !(parameter is bool) \r
+                       &&  !(parameter is double)\r
+                       &&  !(parameter is XPathNavigator)\r
+                       &&  !(parameter is XPathNodeIterator) ) {\r
+                               if(parameter is Int16\r
+                               || parameter is UInt16\r
+                               || parameter is Int32\r
+                               || parameter is Int64\r
+                               || parameter is UInt64\r
+                               || parameter is Single\r
+                               || parameter is decimal ) {\r
+                                       parameter = (double)parameter;\r
+                               } else {\r
+                                       parameter = parameter.ToString();\r
+                               }\r
+                       }\r
+                       _parameters [qName] = parameter;\r
+               }\r
+\r
+               //--------------------------------------------------\r
+               public void Clear()\r
+               {\r
+                       _extensionObjects.Clear();\r
+                       _parameters.Clear();\r
+               }\r
+\r
+               //--------------------------------------------------\r
+               public object GetExtensionObject(\r
+                       string namespaceUri )\r
+               {\r
+                       return _extensionObjects [namespaceUri];\r
+               }\r
+\r
+               //--------------------------------------------------\r
+               public object GetParam(\r
+                       string name,\r
+                       string namespaceUri )\r
+               {\r
+                       if (name == null)\r
+                               throw (new ArgumentException ("The parameter name is a null reference."));\r
+                       if (namespaceUri == null) \r
+                               throw (new ArgumentException ("The namespaceUri is a null reference."));\r
+                       XmlQualifiedName qName = new XmlQualifiedName (name, namespaceUri);\r
+                       return _parameters [qName];\r
+               }\r
+               \r
+               //--------------------------------------------------\r
+               public object RemoveExtensionObject(\r
+                       string namespaceUri )\r
+               {\r
+                       object thisObject = this.GetExtensionObject (namespaceUri);\r
+                       _extensionObjects.Remove (namespaceUri);\r
+                       return thisObject;\r
+               }\r
+\r
+               //--------------------------------------------------\r
+               public object RemoveParam(\r
+                       string name,\r
+                       string namespaceUri )\r
+               {\r
+                       XmlQualifiedName qName = new XmlQualifiedName( name, namespaceUri );\r
+                       object thisObject = this.GetParam (name, namespaceUri);\r
+                       _parameters.Remove (qName);\r
+                       return thisObject;\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XsltCompileException.cs b/mcs/class/System.XML/System.Xml.Xsl/XsltCompileException.cs
new file mode 100644 (file)
index 0000000..dc64561
--- /dev/null
@@ -0,0 +1,62 @@
+// System.Xml.Xsl.XsltCompileException\r
+// \r
+// Author: Tim Coleman <tim@timcoleman.com>\r
+// (C) Copyright 2002 Tim Coleman\r
+\r
+using System;\r
+using System.Runtime.Serialization;\r
+\r
+namespace System.Xml.Xsl\r
+{\r
+       [Serializable]\r
+       public class XsltCompileException : XsltException\r
+       {\r
+               #region Fields\r
+\r
+               string _message;\r
+\r
+               #endregion\r
+\r
+               #region Constructors\r
+\r
+               [MonoTODO]\r
+               protected XsltCompileException( \r
+                       SerializationInfo info, \r
+                       StreamingContext context ) : base( info, context )\r
+               {\r
+               }\r
+\r
+               [MonoTODO]\r
+               // I don't think this base() call is right, but what\r
+               // should the message be for XsltException?\r
+               public XsltCompileException(    \r
+                       Exception inner, \r
+                       String sourceUri,       \r
+                       int lineNumber, \r
+                       int linePosition ) : base( sourceUri, inner )\r
+               {\r
+               }\r
+\r
+\r
+               #endregion\r
+\r
+               #region Properties\r
+\r
+               public override string Message { \r
+                       get { return _message; }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Methods\r
+\r
+               public override void GetObjectData(\r
+                       SerializationInfo info,\r
+                       StreamingContext context )\r
+               {\r
+                       base.GetObjectData (info, context);\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs b/mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs
new file mode 100644 (file)
index 0000000..1e30a00
--- /dev/null
@@ -0,0 +1,53 @@
+// System.Xml.Xsl.XsltContext\r
+// \r
+// Author: Tim Coleman <tim@timcoleman.com>\r
+// (C) Copyright 2002 Tim Coleman\r
+\r
+using System;\r
+using System.Xml;\r
+using System.Xml.XPath;\r
+\r
+namespace System.Xml.Xsl\r
+{\r
+       public abstract class XsltContext : XmlNamespaceManager\r
+       {\r
+               #region Constructors\r
+\r
+               // should this really be calling new NameTable() in the \r
+               // base() call?\r
+               public XsltContext()\r
+                       : base( new NameTable() )\r
+               {\r
+               }\r
+\r
+               public XsltContext( NameTable table )\r
+                       : base( table )\r
+               {\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Properties\r
+\r
+               public abstract bool Whitespace { get; }\r
+\r
+               #endregion\r
+\r
+               #region Methods \r
+\r
+               public abstract int CompareDocument(\r
+                       string baseUri,\r
+                       string nextbaseUri );\r
+\r
+               public abstract IXsltContextFunction ResolveFunction(\r
+                       string prefix,\r
+                       string name,\r
+                       XPathResultType[] ArgTypes );\r
+\r
+               public abstract IXsltContextVariable ResolveVariable(\r
+                       string prefix,\r
+                       string name );\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XsltException.cs b/mcs/class/System.XML/System.Xml.Xsl/XsltException.cs
new file mode 100644 (file)
index 0000000..956ab6b
--- /dev/null
@@ -0,0 +1,78 @@
+// System.Xml.Xsl.XsltException\r
+// \r
+// Author: Tim Coleman <tim@timcoleman.com>\r
+// (C) Copyright 2002 Tim Coleman\r
+\r
+using System;\r
+using System.Runtime.Serialization;\r
+\r
+namespace System.Xml.Xsl\r
+{\r
+       [Serializable]\r
+       public class XsltException : SystemException\r
+       {\r
+               #region Fields\r
+\r
+               string _message; \r
+               int _lineNumber;\r
+               int _linePosition;\r
+               string _sourceUri;\r
+\r
+               #endregion\r
+\r
+               #region Constructors\r
+\r
+               public XsltException(\r
+                       string message,\r
+                       Exception innerException ) \r
+                       : base (message, innerException)\r
+               {\r
+                       _message = message;\r
+               }\r
+\r
+               protected XsltException(\r
+                       SerializationInfo info,\r
+                       StreamingContext context )\r
+               {\r
+                       _lineNumber = info.GetInt32 ("lineNumber");\r
+                       _linePosition = info.GetInt32 ("linePosition");\r
+                       _sourceUri = info.GetString ("sourceUri");\r
+               }\r
+               \r
+               #endregion\r
+\r
+               #region Properties\r
+\r
+               public int LineNumber { \r
+                       get { return _lineNumber; }\r
+               }\r
+\r
+               public int LinePosition {\r
+                       get { return _linePosition; }\r
+               }\r
+\r
+               public override string Message {\r
+                       get { return _message; }\r
+               }\r
+\r
+               public string SourceUri {\r
+                       get { return _sourceUri; }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Methods\r
+\r
+               public override void GetObjectData(\r
+                       SerializationInfo info,\r
+                       StreamingContext context )\r
+               {\r
+                       base.GetObjectData (info, context);\r
+                       info.AddValue ("lineNumber", _lineNumber);\r
+                       info.AddValue ("linePosition", _linePosition);\r
+                       info.AddValue ("sourceUri", _sourceUri);\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r