XmlReader.cs 4.3 KB

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