Implementation and tests for XmlAttributeCollection.RemoveAll and XmlElement.RemoveAl...
[mono.git] / mcs / class / System.XML / System.Xml / XmlLinkedNode.cs
index f577d694c707817d1220dfaf2d3e26ecd3b709f2..090bedcf6b924e0235ad7635a195c3284cbbc1e3 100644 (file)
@@ -1,33 +1,66 @@
+//
+// System.Xml.XmlLinkedNode
+//
+// Authors:
+//   Jason Diamond <jason@injektilo.org>
+//   Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Jason Diamond, Kral Ferch
+//
+\r
 using System;
 
 namespace System.Xml
 {
        public abstract class XmlLinkedNode : XmlNode
        {
-               #region Constructors
+               #region Fields
+
+               XmlLinkedNode nextSibling;
+
+               #endregion
 
-               protected internal XmlLinkedNode(XmlDocument doc) : base(doc) { }
+               #region Constructors
+               internal XmlLinkedNode(XmlDocument doc) : base(doc) { }
 
                #endregion
 
                #region Properties
 
-               [MonoTODO]
                public override XmlNode NextSibling
                {
                        get {
-                               throw new NotImplementedException ();
+                               if (Object.ReferenceEquals(nextSibling, ParentNode.LastLinkedChild.NextLinkedSibling) == false) {
+                                       return nextSibling;
+                               }
+                               else {
+                                       return null;
+                               }
                        }
                }
 
-               [MonoTODO]
+               internal XmlLinkedNode NextLinkedSibling
+               {
+                       get { return nextSibling; }
+                       set { nextSibling = value; }
+               }
+
                public override XmlNode PreviousSibling
                {
                        get {
-                               throw new NotImplementedException ();
+                               if (ParentNode != null) {
+                                       XmlNode node = ParentNode.FirstChild;
+                                       if (node != this) {
+                                               do {
+                                                       if (node.NextSibling == this)
+                                                               return node;
+                                               } while ((node = node.NextSibling) != null);
+                                       }                                       
+                               }
+                               return null;
                        }
                }
 
                #endregion
        }
-}
\ No newline at end of file
+}