XmlElement.cs 5.4 KB

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