2002-03-22 Duncan Mak <duncan@ximian.com>
[mono.git] / mcs / class / System.XML / System.Xml / XmlWriter.cs
index 0d7f00113b80f1b724d4ea131452a8bbccf91130..e70e6869f7bfd4baa744c81eb0da27704b83e01c 100644 (file)
-// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-\r
-//\r
-// System.Xml.XmlWriter\r
-//\r
-// Author:\r
-//   Daniel Weber (daniel-weber@austin.rr.com)\r
-//\r
-// (C) 2001 Daniel Weber\r
-\r
-using System;\r
-\r
-namespace System.Xml\r
-{\r
-       /// <summary>\r
-       /// Abstract class XmlWriter\r
-       /// </summary>\r
-       public abstract class XmlWriter\r
-       {\r
-               // Private data members\r
-               //===========================================================================\r
-\r
-               // public properties\r
-               //===========================================================================\r
-               /// <summary>\r
-               /// Get the state of the writer.\r
-               /// </summary>\r
-               public abstract WriteState WriteState {get;}\r
-\r
-               /// <summary>\r
-               /// Get the current xml:lang scope, or null if not defined.\r
-               /// </summary>\r
-               public abstract string XmlLang {get;}\r
-\r
-               /// <summary>\r
-               /// get an XmlSpace representing the current xml:space scope\r
-               /// </summary>\r
-               public abstract XmlSpace XmlSpace {get;}\r
-\r
-               // Public Methods\r
-               //===========================================================================\r
-               /// <summary>\r
-               /// When overriden, closes this stream and the underlying stream.\r
-               /// </summary>\r
-               /// <exception cref="InvalidOperationException">A call is made to write more output when the stream is closed.</exception>\r
-               public abstract void Close();\r
-\r
-               /// <summary>\r
-               /// Flushes whatever is in the buffer to the underlying streams, and flushes any underlying streams.\r
-               /// </summary>\r
-               public abstract void Flush();\r
-\r
-               /// <summary>\r
-               /// Returns closest prefix in current namespace, or null if none found.\r
-               /// </summary>\r
-               /// <param name="ns">namespace URI to find a prefix for.</param>\r
-               /// <exception cref="ArgumentException">ns is null, or string.Empty</exception>\r
-               /// <returns></returns>\r
-               public abstract string LookupPrefix(string ns);\r
-\r
-               /// <summary>\r
-               /// Write out all the attributes found at the current position in the XmlReader\r
-               /// </summary>\r
-               /// <param name="reader">XmlReader to read from</param>\r
-               /// <param name="defattr">true to copy default attributes</param>\r
-               /// <exception cref="ArgumentException">Reader is a null reference</exception>\r
-               public virtual void WriteAttributes(\r
-                       XmlReader reader,\r
-                       bool defattr\r
-                       )\r
-               {\r
-                       //TODO - implement XmlWriter.WriteAttributes(XmlReader, bool)\r
-                       throw new NotImplementedException();\r
-               }\r
-\r
-\r
-       }\r
-}\r
+//
+// System.Xml.XmlTextWriter
+//
+// Author:
+//   Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+
+namespace System.Xml
+{
+       public abstract class XmlWriter
+       {
+               #region Constructors
+
+               protected XmlWriter () { }
+
+               #endregion
+
+               #region Properties
+
+               public abstract WriteState WriteState { get; }
+               
+               public abstract string XmlLang { get; }
+
+               public abstract XmlSpace XmlSpace { get; }
+
+               #endregion
+
+               #region Methods
+
+               public abstract void Close ();
+
+               public abstract void Flush ();
+
+               public abstract string LookupPrefix (string ns);
+
+               [MonoTODO]
+               public virtual void WriteAttributes (XmlReader reader, bool defattr)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void WriteAttributeString (string localName, string value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void WriteAttributeString (string localName, string ns, string value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void WriteAttributeString (string prefix, string localName, string ns, string value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public abstract void WriteBase64 (byte[] buffer, int index, int count);
+
+               public abstract void WriteBinHex (byte[] buffer, int index, int count);
+
+               public abstract void WriteCData (string text);
+
+               public abstract void WriteCharEntity (char ch);
+
+               public abstract void WriteChars (char[] buffer, int index, int count);
+
+               public abstract void WriteComment (string text);
+
+               public abstract void WriteDocType (string name, string pubid, string sysid, string subset);
+
+               public void WriteElementString (string localName, string value)
+               {
+                       WriteStartElement(localName);
+                       WriteString(value);
+                       WriteEndElement();
+               }
+
+               public void WriteElementString (string localName, string ns, string value)
+               {
+                       WriteStartElement(localName, ns);
+                       WriteString(value);
+                       WriteEndElement();
+               }
+
+               public abstract void WriteEndAttribute ();
+
+               public abstract void WriteEndDocument ();
+
+               public abstract void WriteEndElement ();
+
+               public abstract void WriteEntityRef (string name);
+
+               public abstract void WriteFullEndElement ();
+
+               public abstract void WriteName (string name);
+
+               public abstract void WriteNmToken (string name);
+
+               [MonoTODO]
+               public virtual void WriteNode (XmlReader reader, bool defattr)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public abstract void WriteProcessingInstruction (string name, string text);
+
+               public abstract void WriteQualifiedName (string localName, string ns);
+
+               public abstract void WriteRaw (string data);
+
+               public abstract void WriteRaw (char[] buffer, int index, int count);
+
+               [MonoTODO]
+               public void WriteStartAttribute (string localName, string ns)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public abstract void WriteStartAttribute (string prefix, string localName, string ns);
+
+               public abstract void WriteStartDocument ();
+
+               public abstract void WriteStartDocument (bool standalone);
+
+               public void WriteStartElement (string localName)
+               {
+                       WriteStartElement ("", localName, "");
+               }
+
+               public void WriteStartElement (string localName, string ns)
+               {
+                       WriteStartElement ("", localName, ns);
+               }
+
+               public abstract void WriteStartElement (string prefix, string localName, string ns);
+
+               public abstract void WriteString (string text);
+
+               public abstract void WriteSurrogateCharEntity (char lowChar, char highChar);
+
+               public abstract void WriteWhitespace (string ws);
+
+               #endregion
+       }
+}