Files
mono/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs
T
Atsushi Eno 93f58ac5c6 2003-07-27 Atsushi Enomoto <[email protected]>
* XmlLinkedNode.cs : added internal IsRooted.

svn path=/trunk/mcs/; revision=16724
2003-07-27 02:10:41 +00:00

86 lines
1.5 KiB
C#

//
// System.Xml.XmlLinkedNode
//
// Authors:
// Jason Diamond <[email protected]>
// Kral Ferch <[email protected]>
//
// (C) 2002 Jason Diamond, Kral Ferch
//
using System;
namespace System.Xml
{
public abstract class XmlLinkedNode : XmlNode
{
#region Fields
XmlLinkedNode nextSibling;
XmlLinkedNode lastLinkedChild;
#endregion
#region Constructors
internal XmlLinkedNode(XmlDocument doc) : base(doc) { }
#endregion
#region Properties
internal bool IsRooted {
get {
for (XmlNode n = ParentNode; n != null; n = n.ParentNode)
if (n.NodeType == XmlNodeType.Document)
return true;
return false;
}
}
public override XmlNode NextSibling
{
get {
if(ParentNode == null) {
return null;
}
else if (Object.ReferenceEquals(nextSibling, ParentNode.LastLinkedChild.NextLinkedSibling) == false) {
return nextSibling;
}
else {
return null;
}
}
}
internal XmlLinkedNode NextLinkedSibling
{
get { return nextSibling; }
set { nextSibling = value; }
}
public override XmlNode PreviousSibling
{
get {
if (ParentNode != null) {
XmlNode node = ParentNode.FirstChild;
if (node != this) {
do {
if (node.NextSibling == this)
return node;
} while ((node = node.NextSibling) != null);
}
}
return null;
}
}
// copied this way from XmlElement
internal override XmlLinkedNode LastLinkedChild
{
get { return lastLinkedChild; }
set { lastLinkedChild = value; }
}
#endregion
}
}