XmlReader.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. //
  2. // XmlReader.cs
  3. //
  4. // Author:
  5. // Jason Diamond ([email protected])
  6. //
  7. // (C) 2001, 2002 Jason Diamond http://injektilo.org/
  8. //
  9. namespace System.Xml
  10. {
  11. public abstract class XmlReader
  12. {
  13. #region Constructor
  14. protected XmlReader ()
  15. {
  16. }
  17. #endregion
  18. #region Properties
  19. public abstract int AttributeCount { get; }
  20. public abstract string BaseURI { get; }
  21. public virtual bool CanResolveEntity
  22. {
  23. get { return false; }
  24. }
  25. public abstract int Depth { get; }
  26. public abstract bool EOF { get; }
  27. public virtual bool HasAttributes
  28. {
  29. get { return AttributeCount > 0; }
  30. }
  31. public abstract bool HasValue { get; }
  32. public abstract bool IsDefault { get; }
  33. public abstract bool IsEmptyElement { get; }
  34. public abstract string this[int i] { get; }
  35. public abstract string this[string name] { get; }
  36. public abstract string this[
  37. string localName,
  38. string namespaceName]
  39. { get; }
  40. public abstract string LocalName { get; }
  41. public abstract string Name { get; }
  42. public abstract string NamespaceURI { get; }
  43. public abstract XmlNameTable NameTable { get; }
  44. public abstract XmlNodeType NodeType { get; }
  45. public abstract string Prefix { get; }
  46. public abstract char QuoteChar { get; }
  47. public abstract ReadState ReadState { get; }
  48. public abstract string Value { get; }
  49. public abstract string XmlLang { get; }
  50. public abstract XmlSpace XmlSpace { get; }
  51. #endregion
  52. #region Methods
  53. public abstract void Close ();
  54. public abstract string GetAttribute (int i);
  55. public abstract string GetAttribute (string name);
  56. public abstract string GetAttribute (
  57. string localName,
  58. string namespaceName);
  59. public static bool IsName (string s)
  60. {
  61. bool result = false;
  62. if (s != null && s.Length > 0) {
  63. char[] chars = s.ToCharArray ();
  64. if (XmlChar.IsFirstNameChar (chars[0])) {
  65. int i = 1;
  66. int n = chars.Length;
  67. while (i < n && XmlChar.IsNameChar (chars[i]))
  68. ++i;
  69. result = i == n;
  70. }
  71. }
  72. return result;
  73. }
  74. public static bool IsNameToken (string s)
  75. {
  76. bool result = false;
  77. if (s != null && s.Length > 0) {
  78. char[] chars = s.ToCharArray ();
  79. int i = 0;
  80. int n = chars.Length;
  81. while (i < n && XmlChar.IsNameChar (chars[i]))
  82. ++i;
  83. result = i == n;
  84. }
  85. return result;
  86. }
  87. [MonoTODO]
  88. public virtual bool IsStartElement ()
  89. {
  90. throw new NotImplementedException ();
  91. }
  92. [MonoTODO]
  93. public virtual bool IsStartElement (string name)
  94. {
  95. throw new NotImplementedException ();
  96. }
  97. [MonoTODO]
  98. public virtual bool IsStartElement (
  99. string localName,
  100. string namespaceName)
  101. {
  102. throw new NotImplementedException ();
  103. }
  104. public abstract string LookupNamespace (string prefix);
  105. public abstract void MoveToAttribute (int i);
  106. public abstract bool MoveToAttribute (string name);
  107. public abstract bool MoveToAttribute (
  108. string localName,
  109. string namespaceName);
  110. [MonoTODO]
  111. public virtual XmlNodeType MoveToContent ()
  112. {
  113. throw new NotImplementedException ();
  114. }
  115. public abstract bool MoveToElement ();
  116. public abstract bool MoveToFirstAttribute ();
  117. public abstract bool MoveToNextAttribute ();
  118. public abstract bool Read ();
  119. public abstract bool ReadAttributeValue ();
  120. [MonoTODO]
  121. public virtual string ReadElementString ()
  122. {
  123. throw new NotImplementedException ();
  124. }
  125. [MonoTODO]
  126. public virtual string ReadElementString (string name)
  127. {
  128. throw new NotImplementedException ();
  129. }
  130. [MonoTODO]
  131. public virtual string ReadElementString (
  132. string localName,
  133. string namespaceName)
  134. {
  135. throw new NotImplementedException ();
  136. }
  137. [MonoTODO]
  138. public virtual void ReadEndElement ()
  139. {
  140. throw new NotImplementedException ();
  141. }
  142. public abstract string ReadInnerXml ();
  143. public abstract string ReadOuterXml ();
  144. [MonoTODO]
  145. public virtual void ReadStartElement ()
  146. {
  147. throw new NotImplementedException ();
  148. }
  149. [MonoTODO]
  150. public virtual void ReadStartElement (string name)
  151. {
  152. throw new NotImplementedException ();
  153. }
  154. [MonoTODO]
  155. public virtual void ReadStartElement (
  156. string localName,
  157. string namespaceName)
  158. {
  159. throw new NotImplementedException ();
  160. }
  161. public abstract string ReadString ();
  162. public abstract void ResolveEntity ();
  163. [MonoTODO]
  164. public virtual void Skip ()
  165. {
  166. throw new NotImplementedException ();
  167. }
  168. #endregion
  169. }
  170. }