Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

103 wiersze
1.7 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. [Serializable]
  4. public class XMLElement : IXMLNode
  5. {
  6. public XMLElement(string name, IXMLNode parent, List<IXMLNode> children, List<XMLAttribute> attributes)
  7. {
  8. this.valueString = name;
  9. this.parentNode = parent;
  10. this.childList = children;
  11. this.attributeList = attributes;
  12. if (parent != null)
  13. {
  14. parent.Children.Add(this);
  15. }
  16. }
  17. public XMLElement(string name, IXMLNode parent, List<IXMLNode> children)
  18. {
  19. this.valueString = name;
  20. this.parentNode = parent;
  21. this.childList = children;
  22. this.attributeList = new List<XMLAttribute>();
  23. if (parent != null)
  24. {
  25. parent.Children.Add(this);
  26. }
  27. }
  28. public XMLElement(string name, IXMLNode parent)
  29. {
  30. this.valueString = name;
  31. this.parentNode = parent;
  32. this.childList = new List<IXMLNode>();
  33. this.attributeList = new List<XMLAttribute>();
  34. if (parent != null)
  35. {
  36. parent.Children.Add(this);
  37. }
  38. }
  39. public string value
  40. {
  41. get
  42. {
  43. return this.valueString;
  44. }
  45. set
  46. {
  47. this.valueString = value;
  48. }
  49. }
  50. public XMLNodeType type
  51. {
  52. get
  53. {
  54. return XMLNodeType.Element;
  55. }
  56. }
  57. public IXMLNode Parent
  58. {
  59. get
  60. {
  61. return this.parentNode;
  62. }
  63. }
  64. public List<IXMLNode> Children
  65. {
  66. get
  67. {
  68. return this.childList;
  69. }
  70. set
  71. {
  72. this.childList = value;
  73. }
  74. }
  75. public List<XMLAttribute> Attributes
  76. {
  77. get
  78. {
  79. return this.attributeList;
  80. }
  81. set
  82. {
  83. this.attributeList = value;
  84. }
  85. }
  86. protected string valueString;
  87. protected IXMLNode parentNode;
  88. protected List<IXMLNode> childList;
  89. protected List<XMLAttribute> attributeList;
  90. }