finish adding stubs to begin work on XmlDocuemnt.Load(file)
authorDaniel Weber <dweber@mono-cvs.ximian.com>
Mon, 19 Nov 2001 20:30:08 +0000 (20:30 -0000)
committerDaniel Weber <dweber@mono-cvs.ximian.com>
Mon, 19 Nov 2001 20:30:08 +0000 (20:30 -0000)
Most files are merely placeholders.

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

18 files changed:
mcs/class/System.XML/System.Xml/XPathNavigator.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlAttribute.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlCDataSection.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlCharacterData.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlComment.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlDeclaration.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlDocumentType.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlElement.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlEntityReference.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlImplementation.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlNodeList.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlText.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlWhitespace.cs [new file with mode: 0644]
mcs/class/System.XML/System.Xml/XmlWriter.cs [new file with mode: 0644]

diff --git a/mcs/class/System.XML/System.Xml/XPathNavigator.cs b/mcs/class/System.XML/System.Xml/XPathNavigator.cs
new file mode 100644 (file)
index 0000000..4610db5
--- /dev/null
@@ -0,0 +1,17 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// Summary description for XPathNavigator.\r
+       /// </summary>\r
+       public class XPathNavigator\r
+       {\r
+               public XPathNavigator()\r
+               {\r
+                       //\r
+                       // TODO: Add constructor logic here\r
+                       //\r
+               }\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlAttribute.cs b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
new file mode 100644 (file)
index 0000000..afccdbd
--- /dev/null
@@ -0,0 +1,156 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-\r
+//\r
+// System.Xml.XmlAttribute\r
+//\r
+// Author:\r
+//   Daniel Weber (daniel-weber@austin.rr.com)\r
+//\r
+// (C) 2001 Daniel Weberusing System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// Summary description for XmlAttribute.\r
+       /// </summary>\r
+       public class XmlAttribute : XmlNode\r
+       {\r
+               // ============  private data structures ==============================\r
+               private  XmlNode FOwner;\r
+               private XmlNode FOwnerElement;\r
+               \r
+               string FelementName;\r
+               string FattrName;\r
+               string FattrValue;\r
+               \r
+               //==== Public Properties ====================================================\r
+\r
+\r
+\r
+               /// <summary>\r
+               /// Saves all children of the current node to the passed writer\r
+               /// </summary>\r
+               /// <param name="w"></param>\r
+               public override void WriteContentTo(XmlWriter w)\r
+               {\r
+                       // TODO - implement XmlAttribute.WriteContentsTo(XmlWriter)\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               /// <summary>\r
+               /// Saves the current node to writer w\r
+               /// </summary>\r
+               /// <param name="w"></param>\r
+               public override void WriteTo(XmlWriter w)\r
+               {\r
+                       // TODO - implement XmlAttribute.WriteTo(XmlWriter)\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               /// <summary>\r
+               /// Returns the local name of the attribute.  For attributes, this is the same as Name\r
+               /// </summary>\r
+               public override string LocalName \r
+               {\r
+                       get\r
+                       {\r
+                               return Name;\r
+                       }\r
+               }\r
+\r
+               /// <summary>\r
+               /// Get the XmlNode representing the owning document\r
+               /// </summary>\r
+               public override XmlDocument OwnerDocument\r
+               {\r
+                       get\r
+                       {\r
+                               if (FOwner.NodeType == XmlNodeType.Document)\r
+                                       return FOwner as XmlDocument;\r
+                               else\r
+                                       return null;\r
+                       }\r
+               }\r
+\r
+               /// <summary>\r
+               /// Retrieve the XmlElement owner of this attribute, or null if attribute not assigned\r
+               /// </summary>\r
+               public virtual XmlElement OwnerElement\r
+               {\r
+                       get\r
+                       {\r
+                               if (FOwnerElement.NodeType == XmlNodeType.Element)\r
+                                       return FOwnerElement as XmlElement;\r
+                               else\r
+                                       return null;\r
+                       }\r
+               }\r
+               /// <summary>\r
+               /// Get the qualified attribute name.  Attributes do not have an associated namespace.\r
+               /// </summary>\r
+               public override string Name \r
+               { \r
+                       get\r
+                       {\r
+                               return Name;\r
+                       }\r
+               }\r
+\r
+               //============== Public Methods =============================================\r
+               /// <summary>\r
+               /// Override.  Returns the node type.\r
+               /// </summary>\r
+               public override XmlNodeType NodeType \r
+               {\r
+                       get\r
+                       {\r
+                               return XmlNodeType.Attribute;\r
+                       }\r
+               }\r
+\r
+               /// <summary>\r
+               /// Return a clone of the node\r
+               /// </summary>\r
+               /// <param name="deep">Make copy of all children</param>\r
+               /// <returns>Cloned node</returns>\r
+               public override XmlNode CloneNode( bool deep)\r
+               {\r
+                       // TODO - implement XmlAttribute.CloneNode()\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               // ============  Internal methods  ====================================\r
+               internal void setOwnerElement( XmlElement newOwnerElement)\r
+               {\r
+                       FOwnerElement = newOwnerElement;\r
+               }\r
+\r
+               // ============  Constructors =========================================\r
+               public XmlAttribute()\r
+               {\r
+                       //\r
+                       // TODO: Add constructor logic here\r
+                       //\r
+               }\r
+\r
+               internal XmlAttribute ( XmlNode aOwner,                         // owner document\r
+                       string elementName,                                                             // can be ""\r
+                       string attributeName,                                                   // cannot be ""\r
+                       // attType,\r
+                       // defaultDecl,\r
+                       string attValue)                                                                // attValue\r
+               {\r
+                       if (aOwner == null)\r
+                               throw new ArgumentException("Null OwnerDocument passed to XmlAttribute constructor");\r
+                       if (attributeName.Length == 0)\r
+                               throw new ArgumentException("Empty string passed to XmlAttribute constructor");\r
+\r
+                       FOwner = aOwner;\r
+                       FOwnerElement = null;\r
+                       FelementName = elementName;\r
+                       FattrName = attributeName;\r
+                       FattrValue = attValue;\r
+               }\r
+       \r
+\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs b/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs
new file mode 100644 (file)
index 0000000..273a4e4
--- /dev/null
@@ -0,0 +1,505 @@
+// System.Xml.XmlAttributeCollection.cs\r
+//\r
+// Author: Daniel Weber (daniel-weber@austin.rr.com)\r
+//\r
+// Implementation of abstract Xml.XmlAttributeCollection class\r
+//\r
+\r
+using System;\r
+using System.Collections;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// A collection of Attributes that can be accessed by index or name(space)\r
+       /// Derived from XmlNamedNodeMap\r
+       /// <seealso cref="XmlNamedNodeMap"/>\r
+       /// </summary>\r
+       public class XmlAttributeCollection : XmlNamedNodeMap, ICollection\r
+       {\r
+\r
+               // =====  ICollection interface elements  ===================================\r
+               /// <summary>\r
+               /// Private class to provide Synchronzed Access to the attribute list.\r
+               /// </summary>\r
+               private class SyncAttributes : XmlAttributeCollection\r
+               {\r
+                       private XmlAttributeCollection _attributes;\r
+\r
+                       public SyncAttributes ( XmlAttributeCollection attributes )\r
+                       {\r
+                               _attributes = attributes;\r
+                       }\r
+\r
+                       public override bool IsSynchronized \r
+                       {\r
+                               get {return true; }\r
+                       }\r
+\r
+                       // Override all properties/methods that modify/read items\r
+                       //      and lock them so they are thread-safe\r
+                       public override void CopyTo(Array array, int index)\r
+                       {\r
+                               lock (_attributes )\r
+                               { _attributes.CopyTo(array, index); }\r
+                       }\r
+                       \r
+                       public override XmlAttribute this[string name] \r
+                       {\r
+                               get  {\r
+                                       lock (_attributes ) { return _attributes[name]; }\r
+                               }\r
+                       }\r
+\r
+                       public override XmlAttribute this[int i] \r
+                       {\r
+                               get {\r
+                                       lock (_attributes) { return _attributes[i]; }\r
+                               }\r
+                       }\r
+\r
+                       public override XmlAttribute Append( XmlAttribute node )\r
+                       {\r
+                               lock (_attributes)\r
+                               { return _attributes.Append( node ); }\r
+                       }\r
+                       \r
+                       public override void CopyTo(XmlAttribute[] array, int index)\r
+                       {\r
+                               lock (_attributes)\r
+                               { _attributes.CopyTo(array, index); }\r
+                       }\r
+\r
+                       public override XmlAttribute InsertAfter( \r
+                               XmlAttribute newNode, \r
+                               XmlAttribute refNode)\r
+                       {\r
+                               lock (_attributes)\r
+                               { return _attributes.InsertAfter( newNode, refNode ); }\r
+                       }\r
+\r
+                       public override XmlAttribute Prepend(XmlAttribute node)\r
+                       {\r
+                               lock (_attributes)\r
+                               { return _attributes.Prepend(node); }\r
+                       }\r
+\r
+                       public override XmlAttribute Remove(XmlAttribute node)\r
+                       {\r
+                               lock (_attributes)\r
+                               { return _attributes.Remove( node ); }\r
+                       }\r
+\r
+                       public override void RemoveAll()\r
+                       {\r
+                               lock (_attributes)\r
+                               { _attributes.RemoveAll(); }\r
+                       }\r
+\r
+                       public override XmlAttribute RemoveAt(int i)\r
+                       {\r
+                               lock (_attributes)\r
+                               { return _attributes.RemoveAt(i); }\r
+                       }\r
+\r
+                       public override XmlNode SetNamedItem(XmlNode node)\r
+                       {\r
+                               lock (_attributes)\r
+                               { return _attributes.SetNamedItem(node); }\r
+                       }\r
+\r
+                       // Even ToString, since someone could come along and blow away an\r
+                       //      attribute while we're iterating...\r
+                       public override string ToString()\r
+                       {\r
+                               lock (_attributes) \r
+                               { return _attributes.ToString(); }\r
+                       }\r
+\r
+               }  // SynchAttributes\r
+\r
+               /// <summary>\r
+               /// Return true if access is synchronized (thread-safe)\r
+               /// </summary>\r
+               public virtual bool IsSynchronized \r
+               {\r
+                       // This version of the class is not synchronized\r
+                       get\r
+                       {\r
+                               return false;\r
+                       }\r
+               }\r
+\r
+               /// <summary>\r
+               /// Return object used for synchronous access to class\r
+               /// </summary>\r
+               public object SyncRoot \r
+               {\r
+                       get\r
+                       {\r
+                               return this;\r
+                       }\r
+               }\r
+\r
+               /// <summary>\r
+               /// Returns a thread-safe version of the attribute collection.\r
+               /// </summary>\r
+               /// <param name="attributes">Attribute collection to make thread-safe.</param>\r
+               /// <returns>Thread-safe XmlAttributeCollection.</returns>\r
+               public static XmlAttributeCollection Synchronized(XmlAttributeCollection attributes) \r
+               {\r
+                       if (attributes == null) \r
+                       {\r
+                               throw new ArgumentNullException("Null XmlAttributeCollection passed to Synchronized()");\r
+                       }\r
+\r
+                       return new SyncAttributes(attributes);\r
+               }\r
+\r
+               /// <summary>\r
+               /// Copy the XmlAttributeCollection into the passed array.  Index is zero-based.\r
+               /// </summary>\r
+               /// <param name="array">Array to copy into</param>\r
+               /// <param name="index">Index to start copying from</param>\r
+               public virtual void CopyTo(Array array, int index)\r
+               {\r
+                       // Let the Array handle all the errors, there's no risk to us\r
+\r
+                       // TODO - should we set OwnerElement to null in clone() in CopyTo(Array, int)? (yes, using setOwnerElement())\r
+                       int arrayIndex = 0;\r
+                       for (int i = index; i < FnodeList.Count; i++)\r
+                       {\r
+                               XmlAttribute e = FnodeList[i] as XmlAttribute;\r
+                               XmlAttribute theClone = e.Clone() as XmlAttribute;\r
+                               theClone.setOwnerElement(null);\r
+                               array.SetValue(theClone, arrayIndex);\r
+                               arrayIndex++;\r
+                       }\r
+               }\r
+               // XmlAttributeCollection Properties =================================\r
+               /// <summary>\r
+               /// Get the attribute with the specified name\r
+               /// </summary>\r
+               [System.Runtime.CompilerServices.IndexerName("ItemOf")]\r
+               public virtual XmlAttribute this[string name] \r
+               {\r
+                       get\r
+                       {\r
+                               return GetNamedItem(name) as XmlAttribute;\r
+                       }\r
+               }\r
+\r
+               /// <summary>\r
+               /// Get the attribute at the specified index.  The Collection is zero-based.\r
+               /// </summary>\r
+               [System.Runtime.CompilerServices.IndexerName("ItemOf")]\r
+               public virtual XmlAttribute this[int i] \r
+               {\r
+                       get\r
+                       {\r
+                               return base.Item(i) as XmlAttribute;\r
+                       }\r
+               }\r
+\r
+               /// <summary>\r
+               /// Get the attribute with the specifed (localName, URI)\r
+               /// </summary>\r
+               [System.Runtime.CompilerServices.IndexerName("ItemOf")]\r
+               public virtual XmlAttribute this[string localName, string namespaceURI] \r
+               {\r
+                       get\r
+                       {\r
+                               return GetNamedItem(localName, namespaceURI) as XmlAttribute;\r
+                       }\r
+               }\r
+\r
+               // ============= Public methods =====================================\r
+               /// <summary>\r
+               /// Appends the specified node to the attribute list\r
+               /// If the node is already in the list, it is moved to the end.\r
+               /// If a node is in the list with the same name, the node is removed and the new node is added.\r
+               /// </summary>\r
+               /// <param name="node">Attribute node to append to the collection</param>\r
+               /// <exception cref="ArgumentException">Node was created from a differant document or node is null</exception>\r
+               /// <returns></returns>\r
+               public virtual XmlAttribute Append( XmlAttribute node )\r
+               {\r
+                       // TODO - node validation? (no)\r
+                       \r
+                       XmlAttribute retval = null;\r
+\r
+                       System.Diagnostics.Debug.Assert(node != null, "Null node passed to Append()");\r
+\r
+                       if (! FOwner.OwnerDocument.Equals(node.OwnerDocument))\r
+                               throw new ArgumentException("Cannot append node from another document");\r
+\r
+                       if (node.OwnerElement != null) \r
+                               throw new ArgumentException("Cannot append node from another document");\r
+\r
+                       foreach (XmlAttribute cur in FnodeList)\r
+                       {\r
+                               // If node is already in the collection, it is moved to the last position. \r
+                               if (cur.Equals(node))\r
+                               {\r
+                                       retval = cur;\r
+                                       FnodeList.Remove(cur);\r
+                               }\r
+\r
+                               //If an attribute with the same name is already present in the collection, \r
+                               //   the original attribute is removed from the collection and \r
+                               //   node is added to the end of the collection.\r
+                               if (cur.Name == node.Name)\r
+                                       FnodeList.Remove(cur);\r
+                       }\r
+\r
+                       // add the new node to the end of the collection\r
+                       // set attribute owner element? (yes)\r
+                       node.setOwnerElement(FOwnerNode as XmlElement);\r
+                       FnodeList.Add(node);\r
+\r
+                       // return the removed item\r
+                       return retval;\r
+               }\r
+\r
+               /// <summary>\r
+               /// Copies all attributes in collection into the array, starting at index.\r
+               /// attribute index is zero-based.\r
+               /// </summary>\r
+               /// <exception cref="OverflowException">Thrown if insufficient room to copy all elements</exception>\r
+               /// <param name="array">Array to copy XlmAttributes into</param>\r
+               /// <param name="index">index to start copy</param>\r
+               public virtual void CopyTo(XmlAttribute[] array, int index)\r
+               {\r
+                       // Let the array handle all the errors, there's no risk to us\r
+\r
+                       // TODO - should we set OwnerElement to null in clone() in CopyTo(XmlAttribute[], int)? (yes, using setOwnerElement())\r
+                       int arrayIndex = 0;\r
+                       for (int i = index; i < FnodeList.Count; i++)\r
+                       {\r
+                               XmlAttribute e = FnodeList[i] as XmlAttribute;\r
+                               XmlAttribute theClone = e.Clone() as XmlAttribute;\r
+                               theClone.setOwnerElement(null);\r
+                               array[arrayIndex] = theClone;\r
+                               arrayIndex++;\r
+                       }\r
+               }\r
+\r
+               /// <summary>\r
+               /// Helper function since InsertBefore/After use exact same algorithm\r
+               /// </summary>\r
+               /// <param name="refNode"></param>\r
+               /// <param name="newNode"></param>\r
+               /// <param name="offset">offset to add to Insert (0 or 1)</param>\r
+               /// <returns>Deleted attribute</returns>\r
+               private XmlAttribute InsertHelper(XmlAttribute newNode, XmlAttribute refNode, int offset)\r
+               {\r
+                       // TODO - validation? (no)\r
+                       if (refNode == null)\r
+                               throw new ArgumentNullException("Null refNode passed to InsertAfter()");\r
+                       if (newNode == null)\r
+                               throw new ArgumentNullException("Null newNode passed to InsertAfter()");\r
+\r
+                       if (! newNode.OwnerDocument.Equals(refNode.OwnerDocument) )\r
+                               throw new ArgumentException("Node to insert does not have same owner document as reference");\r
+\r
+                       // Logically, it makes no sense to insert node "A" after node "A",\r
+                       //      since only one node "A" can be in the list - flag it as an error\r
+                       if (newNode.Name == refNode.Name)\r
+                               throw new ArgumentException("Node to insert has same name as reference node");\r
+\r
+                       // Other bizarre case is if refNode.Equals(newNode)\r
+                       //      We'll flag this error after we check that refNode is in the list\r
+               \r
+                       int refNodeIndex = -1;\r
+                       // Note that if newNode is in the list, then we'll get a name match\r
+                       int SameNameIndex = -1;\r
+\r
+                       for (int i = 0; i < FnodeList.Count; i++)\r
+                       {\r
+                               XmlAttribute curListNode = Item(i) as XmlAttribute;\r
+                               if (curListNode.Name == refNode.Name)\r
+                                       refNodeIndex = i;\r
+                               \r
+                               if (curListNode.Name == newNode.Name)\r
+                                       SameNameIndex = i;\r
+                       }\r
+\r
+                       if ( refNodeIndex == -1 )\r
+                               throw new ArgumentException("Attribute [" + refNode.Name + "] is not in Collection for InsertAfter()");\r
+\r
+                       // Check the obvious, InsertAfter( attr1, attr1);\r
+                       if (refNode.Equals( newNode ) )\r
+                               return newNode;\r
+\r
+                       XmlAttribute retval = null;\r
+\r
+                       if (SameNameIndex != -1)\r
+                       {\r
+                               // If this is newNode in the list, we'll insert it back in the right spot\r
+                               // If this is another node, just remove it\r
+                               retval = FnodeList[SameNameIndex] as XmlAttribute;\r
+                               FnodeList.RemoveAt(SameNameIndex);\r
+                               if ( SameNameIndex < refNodeIndex )\r
+                                       refNodeIndex--;\r
+                       }\r
+\r
+                       FnodeList.Insert(refNodeIndex + offset, newNode);\r
+\r
+                       // TODO - set OwnerElement? (no)\r
+                       //node.setOwnerElement(FOwnerNode as XmlElement);\r
+\r
+                       // TODO - determine which node to return (deleted node)\r
+                       return retval;\r
+               }\r
+\r
+               /// <summary>\r
+               /// Insert the specifed attribute immediately after the reference node.\r
+               /// If an attribute with the same name is already in the collection, that attribute is removed and the new attribute inserted\r
+               /// </summary>\r
+               /// <exception cref="ArgumentException">Raised if newNode OwnerDocument differs from nodelist owner or refNode is not a member of the collection</exception>\r
+               /// <param name="newNode">New attribute to insert</param>\r
+               /// <param name="refNode">Reference node to insert new node after</param>\r
+               /// <returns>Inserted node</returns>\r
+               public virtual XmlAttribute InsertAfter( XmlAttribute newNode, XmlAttribute refNode)\r
+               {\r
+                       return InsertHelper(newNode, refNode, 1);\r
+               }\r
+\r
+               /// <summary>\r
+               /// Inserts newNode into the collection just before refNode.\r
+               /// If a node with newNode.Name is already in the list, it is removed.\r
+               /// </summary>\r
+               /// <exception cref="ArgumentException">Thrown if inserted attribute created from different document, refNode not found in collection or\r
+               /// refNode.Name == newNode.Name.</exception>\r
+               /// <param name="newNode">Node to insert into list</param>\r
+               /// <param name="refNode">Node to insert before</param>\r
+               /// <returns>Deleted node, or null if no node was deleted.</returns>\r
+               public virtual XmlAttribute InsertBefore(\r
+                       XmlAttribute newNode,\r
+                       XmlAttribute refNode\r
+                       )\r
+               {\r
+                       return InsertHelper(newNode, refNode, 0);\r
+               }\r
+\r
+               /// <summary>\r
+               /// Inserts the specified node as the first node in the collection\r
+               /// </summary>\r
+               /// <param name="node">XmlAttribute to insert</param>\r
+               /// <exception cref="ArgumentException">If node is null, or owner document does not match collection.</exception>\r
+               /// <returns>Node that was removed, or null if no node deleted.</returns>\r
+               public virtual XmlAttribute Prepend(XmlAttribute node)\r
+               {\r
+                       //TODO - node validation? (no)\r
+                       // TODO - set attribute owner element? (no)\r
+                       //node.setOwnerElement(FOwnerNode as XmlElement);\r
+\r
+                       if (FnodeList.Count > 0)\r
+                       {\r
+                               return InsertBefore(node, Item(0) as XmlAttribute);\r
+                       }\r
+\r
+                       if (node == null)\r
+                               throw new ArgumentException("Cannot prepend null node");\r
+\r
+                       if (! node.OwnerDocument.Equals(FOwner.OwnerDocument) )\r
+                               throw new ArgumentException("Node to prepend does not have same owner document as reference");\r
+\r
+                       FnodeList.Add(node);                    \r
+                       return node;\r
+               }\r
+\r
+               /// <summary>\r
+               /// Removes the requested node from the collection.\r
+               /// </summary>\r
+               /// <param name="node">Node to remove</param>\r
+               /// <returns>The node removed, or null if the node was not found in the collection.</returns>\r
+               public virtual XmlAttribute Remove(XmlAttribute node)\r
+               {\r
+                       for (int i = 0; i < FnodeList.Count; i++)\r
+                       {\r
+                               XmlAttribute e = FnodeList[i] as XmlAttribute;\r
+                       \r
+                               if (e.Equals(node))\r
+                               {\r
+                                       FnodeList.RemoveAt(i);\r
+                                       return node;\r
+                               }\r
+                       }\r
+                       // TODO - if node is a default, should we add it back with a default value? (no)\r
+                       return null;\r
+               }\r
+\r
+               /// <summary>\r
+               /// Removes all attributes from the collection\r
+               /// </summary>\r
+               public virtual void RemoveAll()\r
+               {\r
+                       // Can this be this easy?\r
+                       for (int i = FnodeList.Count - 1; i > 0; i--)\r
+                       {\r
+                               XmlAttribute e = FnodeList[i] as XmlAttribute;\r
+                               e.setOwnerElement(null);\r
+                               FnodeList.RemoveAt(i);\r
+                       }\r
+\r
+                       // TODO - Add default attributes back in in RemoveAll()?  (no)\r
+               }\r
+\r
+               /// <summary>\r
+               /// Removes the attribute at the specified index\r
+               /// </summary>\r
+               /// <param name="i">index of attribute to remove.</param>\r
+               /// <returns>Removed node, or null if node not in collection</returns>\r
+               public virtual XmlAttribute RemoveAt(int i)\r
+               {\r
+                       if ((i < 0) | ( i >= FnodeList.Count))\r
+                               return null;\r
+\r
+                       // TODO - if default attribute removed in RemoveAt(), add it back? (no)\r
+                       XmlAttribute e = FnodeList[i] as XmlAttribute;\r
+                       FnodeList.RemoveAt(i);\r
+                       e.setOwnerElement(null);\r
+                       return e;\r
+               }\r
+\r
+               /// <summary>\r
+               /// Adds a node to the collection using it's name.  If a node with the same name exists,\r
+               /// it is removed.\r
+               /// </summary>\r
+               /// <param name="node">XmlAttribute to add.</param>\r
+               /// <returns>If a node replaces a named node, the replaced node is deleted and returned. \r
+               /// Otherwise, null.</returns>\r
+               public override XmlNode SetNamedItem(XmlNode node)\r
+               {\r
+                       return base.SetNamedItem(node);\r
+               }\r
+\r
+               public override string ToString()\r
+               {\r
+                       string retval = "System.Xml.XmlAttributeCollection ";\r
+                       if (FOwnerNode != null)\r
+                               retval += "OwnerElement: " + FOwnerNode.Name;\r
+\r
+                       foreach (XmlAttribute o in FnodeList)\r
+                       {\r
+                               retval += o.Name + "=" + o.Value;\r
+                       }\r
+                       return retval;\r
+\r
+               }\r
+               // ============= Constructors ========================================\r
+               // TODO - change constructor to pass in IEnumerator?\r
+               internal XmlAttributeCollection(XmlNode aOwner, XmlNode aOwnerNode, ArrayList nodeList) :\r
+                       base(aOwner, aOwnerNode, nodeList)\r
+               {\r
+                       // Makes no sense to have namespace aware on attributes\r
+                       NamespaceAware = false;\r
+               }\r
+\r
+               internal XmlAttributeCollection ()\r
+               {\r
+               }\r
+\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml/XmlCDataSection.cs b/mcs/class/System.XML/System.Xml/XmlCDataSection.cs
new file mode 100644 (file)
index 0000000..d2a18f8
--- /dev/null
@@ -0,0 +1,17 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// \r
+       /// </summary>\r
+       public class XmlCDataSection\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               \r
+\r
+               // Public Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlCharacterData.cs b/mcs/class/System.XML/System.Xml/XmlCharacterData.cs
new file mode 100644 (file)
index 0000000..d102383
--- /dev/null
@@ -0,0 +1,150 @@
+// System.Xml.XmlCharacterData.cs\r
+//\r
+// Author: Daniel Weber (daniel-weber@austin.rr.com)\r
+//\r
+// Implementation of abstract Xml.XmlCharacterData class\r
+//\r
+// Provides text manipulation methods used by derived classes\r
+//     abstract class\r
+\r
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// Abstratc class to provide text manipulation methods for derived classes\r
+       /// </summary>\r
+       public abstract class XmlCharacterData : XmlLinkedNode\r
+       {\r
+               // ============ Public Properties =====================================\r
+               //=====================================================================\r
+               /// <summary>\r
+               /// Contains the nodes data\r
+               /// </summary>\r
+               public virtual string Data \r
+               {\r
+                       get\r
+                       {\r
+                               // TODO - implement Data {get;}\r
+                               throw new NotImplementedException();\r
+                       }\r
+                       \r
+                       set\r
+                       {\r
+                               // TODO - implement Data {set;}\r
+                               throw new NotImplementedException();\r
+                       }\r
+               }\r
+\r
+               /// <summary>\r
+               /// Get/Set the nodes value\r
+               /// </summary>\r
+               public override string Value \r
+               {\r
+                       get\r
+                       {\r
+                               // TODO - implement Value {get;}\r
+                               throw new NotImplementedException();\r
+                       }\r
+\r
+                       set\r
+                       {\r
+                               // TODO - implement Value {set;}\r
+                               throw new NotImplementedException();\r
+                       }\r
+               }\r
+\r
+               public override string InnerText \r
+               {\r
+                       get\r
+                       {\r
+                               // TODO - implement InnerText {get;}\r
+                               throw new NotImplementedException();\r
+                       }\r
+\r
+                       set\r
+                       {\r
+                               // TODO - implement InnerText {set;}\r
+                               throw new NotImplementedException();\r
+                       }\r
+               }\r
+\r
+               /// <summary>\r
+               /// Returns the length of data, in characters\r
+               /// </summary>\r
+               public virtual int Length \r
+               {\r
+                       get\r
+                       {\r
+                               // TODO - implement Length {get;}\r
+                               throw new NotImplementedException();\r
+                       }\r
+               }\r
+\r
+               // ============ Public Methods  =======================================\r
+               //=====================================================================\r
+               /// <summary>\r
+               /// Appends string strData to the end of data\r
+               /// </summary>\r
+               /// <param name="strData"></param>\r
+               public virtual void AppendData(string strData)\r
+               {\r
+                       // TODO - implement AppendData(strData)\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               /// <summary>\r
+               /// Remove a range of characters from the node\r
+               /// </summary>\r
+               /// <param name="offset">offset, in characters, to start delete</param>\r
+               /// <param name="count">Number of characters to delete</param>\r
+               public virtual void DeleteData(int offset, int count)\r
+               {\r
+                       // TODO - implement DeleteData(offset, count)\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               /// <summary>\r
+               /// Replaces the number of characters, starting at offset, with the passed string\r
+               /// </summary>\r
+               /// <param name="offset">Offset (in characters) to start replacement</param>\r
+               /// <param name="count">Number of characters to replace</param>\r
+               /// <param name="strData">Replacement string</param>\r
+               public virtual void ReplaceData(int offset, int count, string strData)\r
+               {\r
+                       // TODO - implement ReplaceData(offset, count, strData)\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               /// <summary>\r
+               /// Retrieves a substring of the specified range\r
+               /// </summary>\r
+               /// <param name="offset">Character offset to begin string</param>\r
+               /// <param name="count">Number of characters to return</param>\r
+               /// <returns></returns>\r
+               public virtual string Substring(int offset, int count)\r
+               {\r
+                       // TODO - implement Substring(offset, count)\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               // ============ Protected Methods  ====================================\r
+               //=====================================================================\r
+               /// <summary>\r
+               /// Listed in beta 2, but no description\r
+               /// [to be supplied]\r
+               /// </summary>\r
+               /// <param name="node"></param>\r
+               /// <param name="xnt"></param>\r
+               /// <returns></returns>\r
+               protected internal bool DecideXPNodeTypeForWhitespace(\r
+                       XmlNode node,\r
+                       ref XPathNodeType xnt\r
+                       )\r
+               {\r
+                       // TODO\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml/XmlComment.cs b/mcs/class/System.XML/System.Xml/XmlComment.cs
new file mode 100644 (file)
index 0000000..7bb826d
--- /dev/null
@@ -0,0 +1,17 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// \r
+       /// </summary>\r
+       public class XmlComment\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               \r
+\r
+               // Public Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlDeclaration.cs b/mcs/class/System.XML/System.Xml/XmlDeclaration.cs
new file mode 100644 (file)
index 0000000..69d5fc8
--- /dev/null
@@ -0,0 +1,17 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// \r
+       /// </summary>\r
+       public class XmlDeclaration\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               \r
+\r
+               // Public Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlDocumentType.cs b/mcs/class/System.XML/System.Xml/XmlDocumentType.cs
new file mode 100644 (file)
index 0000000..a0ed34d
--- /dev/null
@@ -0,0 +1,17 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// \r
+       /// </summary>\r
+       public class XmlDocumentType\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               \r
+\r
+               // Public Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs
new file mode 100644 (file)
index 0000000..b5af0ef
--- /dev/null
@@ -0,0 +1,109 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-\r
+//\r
+// System.Xml.XmlElement\r
+//\r
+// Author:\r
+//   Daniel Weber (daniel-weber@austin.rr.com)\r
+//\r
+// (C) 2001 Daniel Weber\r
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       public class XmlElement : XmlLinkedNode\r
+       {\r
+               // Private/Protected internal data structures\r
+               //===========================================================================\r
+               private XmlAttributeCollection _attributes;\r
+\r
+               // Public Properties\r
+               //===========================================================================\r
+\r
+               /// <summary>\r
+               /// Return the XmlAttributeCollection on the Element\r
+               /// </summary>\r
+               public override XmlAttributeCollection Attributes \r
+               {\r
+                       get\r
+                       {\r
+                               // TODO - implement Attributes\r
+                               return _attributes;\r
+                       }\r
+               }\r
+\r
+\r
+               // Implement abstract methods of XmlNode\r
+               //=====================================================================\r
+               /// <summary>\r
+               /// Return a clone of the node\r
+               /// </summary>\r
+               /// <param name="deep">Make copy of all children</param>\r
+               /// <returns>Cloned node</returns>\r
+               public override XmlNode CloneNode( bool deep)\r
+               {\r
+                       // TODO - implement CloneNode()\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               /// <summary>\r
+               /// Saves all children of the current node to the passed writer\r
+               /// </summary>\r
+               /// <param name="w"></param>\r
+               public override void WriteContentTo(XmlWriter w)\r
+               {\r
+                       // TODO - implement WriteContentsTo(XmlWriter)\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               /// <summary>\r
+               /// Saves the current node to writer w\r
+               /// </summary>\r
+               /// <param name="w"></param>\r
+               public override void WriteTo(XmlWriter w)\r
+               {\r
+                       // TODO - implement WriteTo(XmlWriter)\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               /// <summary>\r
+               /// Returns the local name of the node with qualifiers removed\r
+               /// LocalName of ns:elementName = "elementName"\r
+               /// </summary>\r
+               public override string LocalName \r
+               {\r
+                       get\r
+                       {\r
+                               // TODO - implement LocalName\r
+                               return String.Empty;\r
+                       }\r
+               }\r
+\r
+\r
+               /// <summary>\r
+               /// Get the qualified node name\r
+               /// derived classes must implement as behavior varies\r
+               /// by tag type.\r
+               /// </summary>\r
+               public override string Name \r
+               { \r
+                       get\r
+                       {\r
+                               // TODO - implement Name\r
+                               return String.Empty;\r
+                       }\r
+               }\r
+\r
+               public override XmlNodeType NodeType \r
+               {\r
+                       get\r
+                       {\r
+                               return XmlNodeType.Element;\r
+                       }\r
+               }\r
+\r
+\r
+               // ============= Internal calls =============================================\r
+\r
+\r
+               } // class\r
+       }  //namespace\r
diff --git a/mcs/class/System.XML/System.Xml/XmlEntityReference.cs b/mcs/class/System.XML/System.Xml/XmlEntityReference.cs
new file mode 100644 (file)
index 0000000..3ab2706
--- /dev/null
@@ -0,0 +1,17 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// \r
+       /// </summary>\r
+       public class XmlEntityReference\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               \r
+\r
+               // Public Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlImplementation.cs b/mcs/class/System.XML/System.Xml/XmlImplementation.cs
new file mode 100644 (file)
index 0000000..98d144d
--- /dev/null
@@ -0,0 +1,15 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// \r
+       /// </summary>\r
+       public class XmlImplementation\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               \r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs b/mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs
new file mode 100644 (file)
index 0000000..29a842a
--- /dev/null
@@ -0,0 +1,67 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// Passed to delegates on document tree changes\r
+       /// </summary>\r
+       public class XmlNodeChangedEventArgs\r
+       {\r
+               // Private data members\r
+               XmlNode _oldParent;\r
+               XmlNode _newParent;\r
+               XmlNodeChangedAction _action;\r
+               XmlNode _node;\r
+\r
+               // public properties\r
+               public XmlNodeChangedAction Action \r
+               { \r
+                       get\r
+                       {\r
+                               return _action;\r
+                       }\r
+               } \r
+\r
+               public XmlNode Node \r
+               { \r
+                       get\r
+                       {\r
+                               return _node;\r
+                       }\r
+               } \r
+\r
+\r
+               public XmlNode OldParent \r
+               { \r
+                       get\r
+                       {\r
+                               return _oldParent;\r
+                       }\r
+               } \r
+\r
+\r
+               public XmlNode NewParent \r
+               { \r
+                       get\r
+                       {\r
+                               return _newParent;\r
+                       }\r
+               } \r
+               \r
+\r
+               // Public Methods\r
+               // Internal Methods\r
+               internal XmlNodeChangedEventArgs(\r
+                       XmlNodeChangedAction action, \r
+                       XmlNode node, \r
+                       XmlNode oldParent,\r
+                       XmlNode newParent)\r
+               {\r
+                       _node = node;\r
+                       _oldParent = oldParent;\r
+                       _newParent = newParent;\r
+                       _action = action;\r
+               }\r
+\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeList.cs b/mcs/class/System.XML/System.Xml/XmlNodeList.cs
new file mode 100644 (file)
index 0000000..65df987
--- /dev/null
@@ -0,0 +1,42 @@
+using System;\r
+using System.Collections;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// Abstract class XmlNodeList.\r
+       /// </summary>\r
+       public abstract class XmlNodeList : IEnumerable\r
+       {\r
+               // public properties\r
+               public abstract int Count { get; }\r
+\r
+               [System.Runtime.CompilerServices.IndexerName("ItemOf")]\r
+               public virtual XmlNode this[int i] \r
+               {\r
+                       get\r
+                       {\r
+                               throw new NotImplementedException("XmlNodeList indexer must be implemented by derived class.");\r
+                       }\r
+               }\r
+\r
+               // Public Methods\r
+               /// <summary>\r
+               /// Abstract.  Return the enumerator for the class.\r
+               /// </summary>\r
+               /// <returns>Enumerator</returns>\r
+               public abstract IEnumerator GetEnumerator();\r
+\r
+               /// <summary>\r
+               /// Abstract.  Returns the item at index.  Index is 0-based.\r
+               /// </summary>\r
+               /// <param name="index"></param>\r
+               /// <returns></returns>\r
+               public abstract XmlNode Item(int index);\r
+               \r
+               public XmlNodeList()\r
+               {\r
+                       // TODO: What should be done in constructor for XmlNodeList.XmlNodeList()? (nothing)\r
+               }\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs b/mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs
new file mode 100644 (file)
index 0000000..4066065
--- /dev/null
@@ -0,0 +1,17 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// \r
+       /// </summary>\r
+       public class XmlProcessingInstruction\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               \r
+\r
+               // Public Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs b/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs
new file mode 100644 (file)
index 0000000..82717e0
--- /dev/null
@@ -0,0 +1,17 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// \r
+       /// </summary>\r
+       public class XmlSignificantWhitespace\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               \r
+\r
+               // Public Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlText.cs b/mcs/class/System.XML/System.Xml/XmlText.cs
new file mode 100644 (file)
index 0000000..98a2624
--- /dev/null
@@ -0,0 +1,74 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-\r
+//\r
+// System.Xml.XmlText\r
+//\r
+// Author:\r
+//   Daniel Weber (daniel-weber@austin.rr.com)\r
+//\r
+// (C) 2001 Daniel Weber\r
+\r
+\r
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// Represents the text content of an element or attribute\r
+       /// </summary>\r
+       public class XmlText : XmlNode\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               public override string LocalName \r
+               {\r
+                       get\r
+                       {\r
+                               return "#text";\r
+                       }\r
+               }\r
+               /// <summary>\r
+               /// Get the name of the node.\r
+               /// </summary>\r
+               public override string Name \r
+               {\r
+                       get\r
+                       {\r
+                               return "#text";\r
+                       }\r
+               }\r
+\r
+               public override XmlNodeType NodeType\r
+               {\r
+                       get\r
+                       {\r
+                               return XmlNodeType.Text;\r
+                       }\r
+               }\r
+               \r
+\r
+               // Public Methods\r
+               //===========================================================================\r
+               public override XmlNode CloneNode( bool deep)\r
+               {\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               public override void WriteContentTo(XmlWriter w)\r
+               {\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               public override void WriteTo(XmlWriter w)\r
+               {\r
+                       throw new NotImplementedException();\r
+               }\r
+\r
+               // Internal method calls\r
+               //===========================================================================\r
+\r
+               // Constructors\r
+               //===========================================================================\r
+\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlWhitespace.cs b/mcs/class/System.XML/System.Xml/XmlWhitespace.cs
new file mode 100644 (file)
index 0000000..7ab8c77
--- /dev/null
@@ -0,0 +1,17 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// \r
+       /// </summary>\r
+       public class XmlWhitespace\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               \r
+\r
+               // Public Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.XML/System.Xml/XmlWriter.cs b/mcs/class/System.XML/System.Xml/XmlWriter.cs
new file mode 100644 (file)
index 0000000..c316811
--- /dev/null
@@ -0,0 +1,15 @@
+using System;\r
+\r
+namespace System.Xml\r
+{\r
+       /// <summary>\r
+       /// Abstract class XmlNodeList.\r
+       /// </summary>\r
+       public class XmlWriter\r
+       {\r
+               // Private data members\r
+\r
+               // public properties\r
+               // Public Methods\r
+       }\r
+}\r