XmlLinkedNode.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // System.Xml.XmlLinkedNode
  3. //
  4. // Authors:
  5. // Jason Diamond <[email protected]>
  6. // Kral Ferch <[email protected]>
  7. //
  8. // (C) 2002 Jason Diamond, Kral Ferch
  9. //
  10. using System;
  11. namespace System.Xml
  12. {
  13. public abstract class XmlLinkedNode : XmlNode
  14. {
  15. #region Fields
  16. XmlLinkedNode nextSibling;
  17. #endregion
  18. #region Constructors
  19. internal XmlLinkedNode(XmlDocument doc) : base(doc) { }
  20. #endregion
  21. #region Properties
  22. public override XmlNode NextSibling
  23. {
  24. get {
  25. if (Object.ReferenceEquals(nextSibling, ParentNode.LastLinkedChild.NextLinkedSibling) == false) {
  26. return nextSibling;
  27. }
  28. else {
  29. return null;
  30. }
  31. }
  32. }
  33. internal XmlLinkedNode NextLinkedSibling
  34. {
  35. get { return nextSibling; }
  36. set { nextSibling = value; }
  37. }
  38. public override XmlNode PreviousSibling
  39. {
  40. get {
  41. if (ParentNode != null) {
  42. XmlNode node = ParentNode.FirstChild;
  43. if (node != this) {
  44. do {
  45. if (node.NextSibling == this)
  46. return node;
  47. } while ((node = node.NextSibling) != null);
  48. }
  49. }
  50. return null;
  51. }
  52. }
  53. #endregion
  54. }
  55. }