XmlElement.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. //
  2. // System.Xml.XmlElement
  3. //
  4. // Author:
  5. // Daniel Weber ([email protected])
  6. //
  7. // (C) 2001 Daniel Weber
  8. using System;
  9. namespace System.Xml
  10. {
  11. public class XmlElement : XmlLinkedNode
  12. {
  13. #region Fields
  14. private XmlAttributeCollection attributes;
  15. private string localName;
  16. private string namespaceURI;
  17. private string prefix;
  18. #endregion
  19. #region Constructor
  20. protected internal XmlElement(string prefix, string localName, string namespaceURI, XmlDocument doc) : base(doc)
  21. {
  22. this.prefix = prefix;
  23. this.localName = localName;
  24. this.namespaceURI = namespaceURI;
  25. attributes = new XmlAttributeCollection(this);
  26. }
  27. #endregion
  28. #region Properties
  29. public override XmlAttributeCollection Attributes
  30. {
  31. get { return attributes; }
  32. }
  33. public virtual bool HasAttributes
  34. {
  35. get { return attributes.Count > 0; }
  36. }
  37. [MonoTODO]
  38. public override string InnerText
  39. {
  40. get { throw new NotImplementedException(); }
  41. set { throw new NotImplementedException(); }
  42. }
  43. [MonoTODO]
  44. public override string InnerXml
  45. {
  46. get { throw new NotImplementedException(); }
  47. set { throw new NotImplementedException(); }
  48. }
  49. [MonoTODO]
  50. public bool IsEmpty
  51. {
  52. get { throw new NotImplementedException(); }
  53. set { throw new NotImplementedException(); }
  54. }
  55. public override string LocalName
  56. {
  57. get { return localName; }
  58. }
  59. public override string Name
  60. {
  61. get { return prefix != String.Empty ? prefix + ":" + localName : localName; }
  62. }
  63. public override string NamespaceURI
  64. {
  65. get { return namespaceURI; }
  66. }
  67. [MonoTODO()]
  68. public override XmlNode NextSibling
  69. {
  70. get { return base.NextSibling; }
  71. }
  72. public override XmlNodeType NodeType
  73. {
  74. get { return XmlNodeType.Element; }
  75. }
  76. public override string Prefix
  77. {
  78. get { return prefix; }
  79. }
  80. [MonoTODO]
  81. public override XmlDocument OwnerDocument
  82. {
  83. get { return base.OwnerDocument; }
  84. }
  85. public override string Value
  86. {
  87. get { return null; }
  88. set
  89. {
  90. // Do nothing.
  91. }
  92. }
  93. #endregion
  94. #region Methods
  95. [MonoTODO]
  96. public override XmlNode CloneNode (bool deep)
  97. {
  98. throw new NotImplementedException();
  99. }
  100. [MonoTODO]
  101. public virtual string GetAttribute (string name)
  102. {
  103. XmlNode attributeNode = Attributes.GetNamedItem (name);
  104. return attributeNode != null ? attributeNode.Value : String.Empty;
  105. }
  106. [MonoTODO]
  107. public virtual string GetAttribute(string localName, string namespaceURI)
  108. {
  109. throw new NotImplementedException();
  110. }
  111. [MonoTODO]
  112. public virtual XmlAttribute GetAttributeNode(string name)
  113. {
  114. throw new NotImplementedException();
  115. }
  116. [MonoTODO]
  117. public virtual XmlAttribute GetAttributeNode(string localName, string namespaceURI)
  118. {
  119. throw new NotImplementedException();
  120. }
  121. [MonoTODO]
  122. public virtual XmlNodeList GetElementsByTagName(string name)
  123. {
  124. throw new NotImplementedException();
  125. }
  126. [MonoTODO]
  127. public virtual XmlNodeList GetElementsByTagName(string localName, string namespaceURI)
  128. {
  129. throw new NotImplementedException();
  130. }
  131. [MonoTODO]
  132. public virtual bool HasAttribute(string name)
  133. {
  134. throw new NotImplementedException();
  135. }
  136. [MonoTODO]
  137. public virtual bool HasAttribute(string localName, string namespaceURI)
  138. {
  139. throw new NotImplementedException();
  140. }
  141. [MonoTODO("Don't remove default attributes.")]
  142. public override void RemoveAll()
  143. {
  144. // Remove the child nodes.
  145. base.RemoveAll();
  146. // Remove all attributes.
  147. attributes.RemoveAll();
  148. }
  149. [MonoTODO]
  150. public virtual void RemoveAllAttributes()
  151. {
  152. throw new NotImplementedException();
  153. }
  154. [MonoTODO]
  155. public virtual void RemoveAttribute(string name)
  156. {
  157. throw new NotImplementedException();
  158. }
  159. [MonoTODO]
  160. public virtual void RemoveAttribute(string localName, string namespaceURI)
  161. {
  162. throw new NotImplementedException();
  163. }
  164. [MonoTODO]
  165. public virtual XmlNode RemoveAttributeAt(int i)
  166. {
  167. throw new NotImplementedException();
  168. }
  169. [MonoTODO]
  170. public virtual XmlAttribute RemoveAttributeNode(XmlAttribute oldAttr)
  171. {
  172. throw new NotImplementedException();
  173. }
  174. [MonoTODO]
  175. public virtual XmlAttribute RemoveAttributeNode(string localName, string namespaceURI)
  176. {
  177. throw new NotImplementedException();
  178. }
  179. [MonoTODO]
  180. public virtual void SetAttribute(string name, string value)
  181. {
  182. XmlAttribute attribute = OwnerDocument.CreateAttribute (name);
  183. attribute.Value = value;
  184. Attributes.SetNamedItem (attribute);
  185. }
  186. [MonoTODO]
  187. public virtual void SetAttribute(string localName, string namespaceURI, string value)
  188. {
  189. throw new NotImplementedException();
  190. }
  191. [MonoTODO]
  192. public virtual XmlAttribute SetAttributeNode(XmlAttribute newAttr)
  193. {
  194. throw new NotImplementedException();
  195. }
  196. [MonoTODO]
  197. public virtual XmlAttribute SetAttributeNode(string localName, string namespaceURI)
  198. {
  199. throw new NotImplementedException();
  200. }
  201. [MonoTODO]
  202. public override void WriteContentTo(XmlWriter w)
  203. {
  204. throw new NotImplementedException();
  205. }
  206. [MonoTODO]
  207. public override void WriteTo(XmlWriter w)
  208. {
  209. throw new NotImplementedException();
  210. }
  211. #endregion
  212. }
  213. }