2
0

XPathEditableNavigator.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. //
  2. // XPathEditableNavigator.cs
  3. //
  4. // Author:
  5. // Atsushi Enomoto <[email protected]>
  6. //
  7. // (C)2003 Atsushi Enomoto
  8. //
  9. #if NET_2_0
  10. using System;
  11. using System.Collections;
  12. using System.Collections.Specialized;
  13. using System.ComponentModel;
  14. using System.IO;
  15. using System.Security.Policy;
  16. using System.Xml.Schema;
  17. using System.Xml.XPath;
  18. //using Mono.Xml.XPath2;
  19. //using MS.Internal.Xml;
  20. namespace System.Xml
  21. {
  22. public abstract class XPathEditableNavigator
  23. : XPathNavigator, IXPathEditable
  24. {
  25. protected XPathEditableNavigator ()
  26. {
  27. }
  28. public abstract XmlWriter AppendChild ();
  29. public virtual XPathEditableNavigator AppendChild (
  30. string xmlFragments)
  31. {
  32. // FIXME: should XmlParserContext be something?
  33. return AppendChild (new XmlTextReader (xmlFragments, XmlNodeType.Element, null));
  34. }
  35. [MonoTODO]
  36. public virtual XPathEditableNavigator AppendChild (
  37. XmlReader reader)
  38. {
  39. XmlWriter w = AppendChild ();
  40. w.WriteNode (reader, false);
  41. throw new NotImplementedException ();
  42. }
  43. [MonoTODO]
  44. public virtual XPathEditableNavigator AppendChild (
  45. XPathNavigator nav)
  46. {
  47. throw new NotImplementedException ();
  48. // AppendChild (new XPathNavigatorReader (nav));
  49. }
  50. public void AppendChildElement (string prefix, string name, string ns, string value)
  51. {
  52. XmlWriter xw = AppendChild ();
  53. xw.WriteStartElement (prefix, name, ns);
  54. xw.WriteString (value);
  55. xw.WriteEndElement ();
  56. xw.Close ();
  57. }
  58. public virtual void CreateAttribute (string prefix, string localName, string namespaceURI, string value)
  59. {
  60. using (XmlWriter w = CreateAttributes ()) {
  61. w.WriteAttributeString (prefix, localName, namespaceURI, value);
  62. }
  63. }
  64. public abstract XmlWriter CreateAttributes ();
  65. public virtual XPathEditableNavigator CreateEditor ()
  66. {
  67. return (XPathEditableNavigator) Clone ();
  68. }
  69. // LAMESPEC: documented as public abstract, but it conflicts
  70. // with XPathNavigator.CreateNavigator ().
  71. // public abstract XPathNavigator CreateNavigator ();
  72. public abstract bool DeleteCurrent ();
  73. public abstract XmlWriter InsertAfter ();
  74. public virtual XPathEditableNavigator InsertAfter (string xmlFragments)
  75. {
  76. return InsertAfter (new XmlTextReader (xmlFragments, XmlNodeType.Element, null));
  77. }
  78. [MonoTODO]
  79. public virtual XPathEditableNavigator InsertAfter (XmlReader reader)
  80. {
  81. using (XmlWriter w = InsertAfter ()) {
  82. w.WriteNode (reader, false);
  83. }
  84. throw new NotImplementedException ();
  85. }
  86. [MonoTODO]
  87. public virtual XPathEditableNavigator InsertAfter (XPathNavigator nav)
  88. {
  89. // InsertAfter (new XPathNavigatorReader (nav));
  90. throw new NotImplementedException ();
  91. }
  92. public abstract XmlWriter InsertBefore ();
  93. public virtual XPathEditableNavigator InsertBefore (string xmlFragments)
  94. {
  95. return InsertBefore (new XmlTextReader (xmlFragments, XmlNodeType.Element, null));
  96. }
  97. [MonoTODO]
  98. public virtual XPathEditableNavigator InsertBefore (XmlReader reader)
  99. {
  100. using (XmlWriter w = InsertBefore ()) {
  101. w.WriteNode (reader, false);
  102. }
  103. throw new NotImplementedException ();
  104. }
  105. [MonoTODO]
  106. public virtual XPathEditableNavigator InsertBefore (XPathNavigator nav)
  107. {
  108. // InsertBefore (new XPathNavigatorReader (nav));
  109. throw new NotImplementedException ();
  110. }
  111. public virtual void InsertElementAfter (string prefix,
  112. string localName, string namespaceURI, string value)
  113. {
  114. using (XmlWriter w = InsertAfter ()) {
  115. w.WriteElementString (prefix, localName, namespaceURI, value);
  116. }
  117. }
  118. public virtual void InsertElementBefore (string prefix,
  119. string localName, string namespaceURI, string value)
  120. {
  121. using (XmlWriter w = InsertBefore ()) {
  122. w.WriteElementString (prefix, localName, namespaceURI, value);
  123. }
  124. }
  125. public abstract XmlWriter PrependChild ();
  126. public virtual XPathEditableNavigator PrependChild (string xmlFragments)
  127. {
  128. return PrependChild (new XmlTextReader (xmlFragments, XmlNodeType.Element, null));
  129. }
  130. [MonoTODO]
  131. public virtual XPathEditableNavigator PrependChild (XmlReader reader)
  132. {
  133. using (XmlWriter w = PrependChild ()) {
  134. w.WriteNode (reader, false);
  135. }
  136. throw new NotImplementedException ();
  137. }
  138. [MonoTODO]
  139. public virtual XPathEditableNavigator PrependChild (XPathNavigator nav)
  140. {
  141. // PrependChild (new XPathNavigatorReader (nav));
  142. throw new NotImplementedException ();
  143. }
  144. public virtual void PrependChildElement (string prefix,
  145. string localName, string namespaceURI, string value)
  146. {
  147. using (XmlWriter w = PrependChild ()) {
  148. w.WriteElementString (prefix, localName, namespaceURI, value);
  149. }
  150. }
  151. // Dunno the exact purpose, but maybe internal editor use
  152. [MonoTODO]
  153. public virtual void SetFromObject (object value)
  154. {
  155. throw new NotImplementedException ();
  156. }
  157. public abstract void SetValue (object value);
  158. [MonoTODO]
  159. public virtual void Validate (XmlSchemaSet schemas, ValidationEventHandler handler)
  160. {
  161. throw new NotImplementedException ();
  162. }
  163. [MonoTODO]
  164. public virtual void Validate (XmlSchemaSet schemas, ValidationEventHandler handler, XmlSchemaAttribute attribute)
  165. {
  166. throw new NotImplementedException ();
  167. }
  168. [MonoTODO]
  169. public virtual void Validate (XmlSchemaSet schemas, ValidationEventHandler handler, XmlSchemaElement element)
  170. {
  171. throw new NotImplementedException ();
  172. }
  173. [MonoTODO]
  174. public virtual void Validate (XmlSchemaSet schemas, ValidationEventHandler handler, XmlSchemaType schemaType)
  175. {
  176. throw new NotImplementedException ();
  177. }
  178. [MonoTODO]
  179. public override string InnerXml {
  180. get { throw new NotImplementedException (); }
  181. }
  182. [MonoTODO]
  183. public override string OuterXml {
  184. get { throw new NotImplementedException (); }
  185. }
  186. }
  187. }
  188. #endif