2002-02-22 Duncan Mak <duncan@ximian.com>
authorDuncan Mak <duncan@mono-cvs.ximian.com>
Fri, 22 Feb 2002 21:56:35 +0000 (21:56 -0000)
committerDuncan Mak <duncan@mono-cvs.ximian.com>
Fri, 22 Feb 2002 21:56:35 +0000 (21:56 -0000)
    * System.Xml/XmlQualifiedName.cs: Implemented, but WTF is the
      Empty field? LameSpec?

svn path=/trunk/mcs/; revision=2603

mcs/class/System.XML/System.Xml/XmlComment.cs
mcs/class/System.XML/System.Xml/XmlQualifiedName.cs [new file with mode: 0644]

index d3e5dcedebfef2558302d9fa4bc3c7d0c86c2acc..f6d650654223e3872c4b8c00e8a8d19b82bda157 100644 (file)
-using System;\r
-\r
-namespace System.Xml\r
-{\r
-       /// <summary>\r
-       /// \r
-       /// </summary>\r
-       /// \r
-\r
-       /*\r
-        * Section 2.5 of the XML spec says...\r
-       [Definition: Comments may appear anywhere in a document outside other markup;\r  in addition, they may appear within the document type declaration at places\r    allowed by the grammar. They are not part of the document's character data; \r   an XML processor may, but need not, make it possible for an application to retrieve \r   the text of comments. For compatibility, the string "--" (double-hyphen)\r       must not occur within comments.] Parameter entity references are not recognized\r        within comments.\r
-       \r
-       Note that the grammar does not allow a comment ending in --->.\r\r
-       Comment ::=   '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'\r
-       */\r
-       public class XmlComment : XmlCharacterData\r
-       {\r
-               // Private data members\r
-\r
-               // public properties\r
-               public override string InnerText \r
-               {\r
-                       get\r
-                       {\r
-                               // TODO - implement XmlComment.InnerText.get\r
-                               throw new NotImplementedException();\r
-                       }\r
-                       \r
-                       set\r
-                       {\r
-                               // TODO - implement XmlComment.InnerText.set\r
-                               throw new NotImplementedException();\r
-                       }\r
-               }\r
-\r
-               public override string LocalName \r
-               {\r
-                       get\r
-                       {\r
-                               return "#comment";\r
-                       }\r
-               }\r
-\r
-               public override string Name \r
-               {\r
-                       get\r
-                       {\r
-                               return "#comment";\r
-                       }\r
-               }\r
-\r
-               public override string Value \r
-               {\r
-                       get\r
-                       {\r
-                               return Fvalue;\r
-                       }\r
-                       \r
-                       set\r
-                       {\r
-                               // TODO - Do our well-formedness checks on Value.set? (no)\r
-                               Fvalue = value;\r
-                       }\r
-               }\r
-               \r
-\r
-               // Public Methods\r
-               public override XmlNode CloneNode(bool deep)\r
-               {\r
-                       // TODO - implement XmlComment.CloneNode(bool)\r
-                       throw new NotImplementedException();\r
-               }\r
-\r
-               public override void WriteContentTo(XmlWriter w)\r
-               {\r
-                       // TODO - implement XmlComment.WriteContentTo(XmlWriter)\r
-                       throw new NotImplementedException();\r
-               }\r
-\r
-               public override void WriteTo(XmlWriter w)\r
-               {\r
-                       // TODO - implement XmlComment.WriteTo(XmlWriter)\r
-                       throw new NotImplementedException();\r
-               }\r
-\r
-\r
-               // Internal methods\r
-               /// <summary>\r
-               /// Returns an exception object if passed text is not well-formed.\r
-               /// Text is passed without introductory syntax elements.\r
-               /// For comments, the leading "<!--" and trailing "-->" should be stripped.\r
-               /// </summary>\r
-               /// <param name="data"></param>\r
-               /// <returns></returns>\r
-               private XmlException wellFormed(string data, XmlInputSource src)\r
-               {\r
-                       if (data.IndexOf("--") != -1)\r
-                               return new XmlException("Invalid characters (\"--\") in comment", src);\r
-                       if (data[0] == '-')\r
-                               return new XmlException("Invalid comment beginning (<!---)", src);\r
-                       if (data[data.Length - 1] == '-')\r
-                               return new XmlException("Invalid comment ending (--->)", src);\r
-                       return null;\r
-\r
-               }\r
-               // Constructors\r
-               internal XmlComment(XmlDocument aOwner, string txt, XmlInputSource src) : base(aOwner)\r
-               {\r
-                       XmlException e = wellFormed(txt, src);\r
-\r
-                       if ( e == null )\r
-                       {\r
-                               Fvalue = txt;\r
-                       }\r
-                       else\r
-                               throw e;\r
-               }\r
-       }\r
-}\r
+using System;
+
+namespace System.Xml
+{
+       /// <summary>
+       /// 
+       /// </summary>
+       /// 
+
+       /*
+        * Section 2.5 of the XML spec says...
+       [Definition: Comments may appear anywhere in a document outside other markup;   in addition, they may appear within the document type declaration at places     allowed by the grammar. They are not part of the document's character data;     an XML processor may, but need not, make it possible for an application to retrieve     the text of comments. For compatibility, the string "--" (double-hyphen)        must not occur within comments.] Parameter entity references are not recognized within comments.
+       
+       Note that the grammar does not allow a comment ending in --->.
+       Comment ::=   '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
+       */
+       public class XmlComment : XmlCharacterData
+       {
+               // Private data members
+
+               // public properties
+               public override string InnerText 
+               {
+                       get
+                       {
+                               // TODO - implement XmlComment.InnerText.get
+                               throw new NotImplementedException();
+                       }
+                       
+                       set
+                       {
+                               // TODO - implement XmlComment.InnerText.set
+                               throw new NotImplementedException();
+                       }
+               }
+
+               public override string LocalName 
+               {
+                       get
+                       {
+                               return "#comment";
+                       }
+               }
+
+               public override string Name 
+               {
+                       get
+                       {
+                               return "#comment";
+                       }
+               }
+
+               public override string Value 
+               {
+                       get
+                       {
+                               return Fvalue;
+                       }
+                       
+                       set
+                       {
+                               // TODO - Do our well-formedness checks on Value.set? (no)
+                               Fvalue = value;
+                       }
+               }
+               
+
+               // Public Methods
+               public override XmlNode CloneNode(bool deep)
+               {
+                       // TODO - implement XmlComment.CloneNode(bool)
+                       throw new NotImplementedException();
+               }
+
+               public override void WriteContentTo(XmlWriter w)
+               {
+                       // TODO - implement XmlComment.WriteContentTo(XmlWriter)
+                       throw new NotImplementedException();
+               }
+
+               public override void WriteTo(XmlWriter w)
+               {
+                       // TODO - implement XmlComment.WriteTo(XmlWriter)
+                       throw new NotImplementedException();
+               }
+
+
+               // Internal methods
+               /// <summary>
+               /// Returns an exception object if passed text is not well-formed.
+               /// Text is passed without introductory syntax elements.
+               /// For comments, the leading "<!--" and trailing "-->" should be stripped.
+               /// </summary>
+               /// <param name="data"></param>
+               /// <returns></returns>
+               private XmlException wellFormed(string data, XmlInputSource src)
+               {
+                       if (data.IndexOf("--") != -1)
+                               return new XmlException("Invalid characters (\"--\") in comment", src);
+                       if (data[0] == '-')
+                               return new XmlException("Invalid comment beginning (<!---)", src);
+                       if (data[data.Length - 1] == '-')
+                               return new XmlException("Invalid comment ending (--->)", src);
+                       return null;
+
+               }
+               // Constructors
+               internal XmlComment(XmlDocument aOwner, string txt, XmlInputSource src) : base(aOwner)
+               {
+                       XmlException e = wellFormed(txt, src);
+
+                       if ( e == null )
+                       {
+                               Fvalue = txt;
+                       }
+                       else
+                               throw e;
+               }
+       }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs b/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs
new file mode 100644 (file)
index 0000000..04b6c58
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// System.Xml.XmlQualifiedName.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+       public class XmlQualifiedName
+       {
+               // Constructors         
+               public XmlQualifiedName ()
+                       : base ()
+               {
+               }
+
+               public XmlQualifiedName (string name)
+                       : base ()
+               {
+                       this.name = name;
+               }
+
+               public XmlQualifiedName (string name, string ns)
+                       : base ()
+               {
+                       this.name = name;
+                       this.ns = ns;
+               }
+
+               // Fields
+               [MonoTODO] public static readonly XmlQualifiedName Empty = new XmlQualifiedName ();
+               
+               private string name;
+               private string namespace;
+               
+               public XmlQualifiedName (string name) {}
+
+               // Properties
+               public bool IsEmpty
+               {
+                       if ((name == String.Empty) && (ns == String.Empty))
+                               return true;
+                       else
+                               return false;
+               }
+
+               public string Name
+               {
+                       get { return name; }
+               }
+
+               public string Namespace
+               {
+                       get { return namespace; }
+               }
+
+               // Methods
+               public override bool Equals (object other)
+               {
+                       if ((this.Name == other.Name) && (this.Namespace == other.Namespace))
+                               return true;
+                       else
+                               return false;
+               }
+
+               public override int GetHashCode ();
+
+               public override string ToString ()
+               {
+                       return ns + ":" + name;
+               }
+
+               public override string ToString (string name, string ns)
+               {
+                       if (ns == null)
+                               return name;
+                       else
+                               return ns + ":" + name;
+               }
+       }
+}