diff options
author | Kral Ferch <kral@mono-cvs.ximian.com> | 2002-03-14 07:59:29 +0300 |
---|---|---|
committer | Kral Ferch <kral@mono-cvs.ximian.com> | 2002-03-14 07:59:29 +0300 |
commit | 909f6660623ff68f1fa374bae0d9fd6137fd00b9 (patch) | |
tree | fa0a49183c92fa3ac7e8db924206e0d751a0e9d9 /mcs | |
parent | cfe054f7d0dd048c188c5ad1c61e8d75edf49957 (diff) |
start of XmlTextWriter
svn path=/trunk/mcs/; revision=3101
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System.XML/Mono.System.XML.csproj | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/System.Xml/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/class/System.XML/System.Xml/XmlNode.cs | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/System.Xml/XmlNodeList.cs | 15 | ||||
-rw-r--r-- | mcs/class/System.XML/System.Xml/XmlWriter.cs | 231 | ||||
-rw-r--r-- | mcs/class/System.XML/Test/AllTests.cs | 1 | ||||
-rw-r--r-- | mcs/class/System.XML/Test/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System.XML/Test/Microsoft.Test.csproj | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/Test/Mono.Test.csproj | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/Test/XmlDocumentTests.cs | 17 |
10 files changed, 182 insertions, 112 deletions
diff --git a/mcs/class/System.XML/Mono.System.XML.csproj b/mcs/class/System.XML/Mono.System.XML.csproj index 0e8d772a96d..ca012f8e4ee 100644 --- a/mcs/class/System.XML/Mono.System.XML.csproj +++ b/mcs/class/System.XML/Mono.System.XML.csproj @@ -306,6 +306,11 @@ BuildAction = "Compile" /> <File + RelPath = "System.Xml\XmlTextWriter.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "System.Xml\XmlTokenizedType.cs" SubType = "Code" BuildAction = "Compile" diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index 2934bd4e59c..23194f519db 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,3 +1,9 @@ +2002-03-14 Kral Ferch <kral_ferch@hotmail.com> + + * XmlWriter.cs: Formatting. + + * XmlTextWriter.cs: Initial checkin. + 2002-03-14 Duncan Mak <duncan@ximian.com> * Validation.cs: Removed, replaced by ValidationType.cs. diff --git a/mcs/class/System.XML/System.Xml/XmlNode.cs b/mcs/class/System.XML/System.Xml/XmlNode.cs index 3c69de23d58..851c0115629 100644 --- a/mcs/class/System.XML/System.Xml/XmlNode.cs +++ b/mcs/class/System.XML/System.Xml/XmlNode.cs @@ -119,10 +119,8 @@ namespace System.Xml set { } } - [MonoTODO] public abstract string LocalName { get; } - [MonoTODO] public abstract string Name { get; } [MonoTODO] @@ -134,7 +132,6 @@ namespace System.Xml get { return null; } } - [MonoTODO] public abstract XmlNodeType NodeType { get; } [MonoTODO] @@ -329,10 +326,8 @@ namespace System.Xml throw new NotImplementedException (); } - [MonoTODO] public abstract void WriteContentTo (XmlWriter w); - [MonoTODO] public abstract void WriteTo (XmlWriter w); #endregion diff --git a/mcs/class/System.XML/System.Xml/XmlNodeList.cs b/mcs/class/System.XML/System.Xml/XmlNodeList.cs index ef788fafb7c..f3214e64b6c 100644 --- a/mcs/class/System.XML/System.Xml/XmlNodeList.cs +++ b/mcs/class/System.XML/System.Xml/XmlNodeList.cs @@ -15,22 +15,12 @@ namespace System.Xml public abstract class XmlNodeList : IEnumerable { #region Constructors - /////////////////////////////////////////////////////////////////////// - // - // Constructors - // - /////////////////////////////////////////////////////////////////////// protected internal XmlNodeList() { } #endregion #region Properties - /////////////////////////////////////////////////////////////////////// - // - // Properties - // - /////////////////////////////////////////////////////////////////////// public abstract int Count { get; } @@ -42,11 +32,6 @@ namespace System.Xml #endregion #region Methods - /////////////////////////////////////////////////////////////////////// - // - // Methods - // - /////////////////////////////////////////////////////////////////////// public abstract IEnumerator GetEnumerator (); diff --git a/mcs/class/System.XML/System.Xml/XmlWriter.cs b/mcs/class/System.XML/System.Xml/XmlWriter.cs index 0d7f00113b8..cdd5f18a3b6 100644 --- a/mcs/class/System.XML/System.Xml/XmlWriter.cs +++ b/mcs/class/System.XML/System.Xml/XmlWriter.cs @@ -1,77 +1,154 @@ -// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
-//
-// System.Xml.XmlWriter
-//
-// Author:
-// Daniel Weber (daniel-weber@austin.rr.com)
-//
-// (C) 2001 Daniel Weber
-
-using System;
-
-namespace System.Xml
-{
- /// <summary>
- /// Abstract class XmlWriter
- /// </summary>
- public abstract class XmlWriter
- {
- // Private data members
- //===========================================================================
-
- // public properties
- //===========================================================================
- /// <summary>
- /// Get the state of the writer.
- /// </summary>
- public abstract WriteState WriteState {get;}
-
- /// <summary>
- /// Get the current xml:lang scope, or null if not defined.
- /// </summary>
- public abstract string XmlLang {get;}
-
- /// <summary>
- /// get an XmlSpace representing the current xml:space scope
- /// </summary>
- public abstract XmlSpace XmlSpace {get;}
-
- // Public Methods
- //===========================================================================
- /// <summary>
- /// When overriden, closes this stream and the underlying stream.
- /// </summary>
- /// <exception cref="InvalidOperationException">A call is made to write more output when the stream is closed.</exception>
- public abstract void Close();
-
- /// <summary>
- /// Flushes whatever is in the buffer to the underlying streams, and flushes any underlying streams.
- /// </summary>
- public abstract void Flush();
-
- /// <summary>
- /// Returns closest prefix in current namespace, or null if none found.
- /// </summary>
- /// <param name="ns">namespace URI to find a prefix for.</param>
- /// <exception cref="ArgumentException">ns is null, or string.Empty</exception>
- /// <returns></returns>
- public abstract string LookupPrefix(string ns);
-
- /// <summary>
- /// Write out all the attributes found at the current position in the XmlReader
- /// </summary>
- /// <param name="reader">XmlReader to read from</param>
- /// <param name="defattr">true to copy default attributes</param>
- /// <exception cref="ArgumentException">Reader is a null reference</exception>
- public virtual void WriteAttributes(
- XmlReader reader,
- bool defattr
- )
- {
- //TODO - implement XmlWriter.WriteAttributes(XmlReader, bool)
- throw new NotImplementedException();
- }
-
-
- }
-}
+// +// 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); + + [MonoTODO] + public void WriteStartElement (string localName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public void WriteStartElement (string localName, string ns) + { + throw new NotImplementedException (); + } + + 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 + } +} diff --git a/mcs/class/System.XML/Test/AllTests.cs b/mcs/class/System.XML/Test/AllTests.cs index 9df4e5019bd..d10a46120f7 100644 --- a/mcs/class/System.XML/Test/AllTests.cs +++ b/mcs/class/System.XML/Test/AllTests.cs @@ -20,6 +20,7 @@ namespace Ximian.Mono.Tests get { TestSuite suite = new TestSuite (); suite.AddTest (new TestSuite (typeof (XmlTextReaderTests))); + suite.AddTest (new TestSuite (typeof (XmlTextWriterTests))); suite.AddTest (new TestSuite (typeof (XmlNamespaceManagerTests))); suite.AddTest (new TestSuite (typeof (XmlAttributeTests))); suite.AddTest (new TestSuite (typeof (XmlDocumentTests))); diff --git a/mcs/class/System.XML/Test/ChangeLog b/mcs/class/System.XML/Test/ChangeLog index 6f165b30d8c..b861e2131e1 100644 --- a/mcs/class/System.XML/Test/ChangeLog +++ b/mcs/class/System.XML/Test/ChangeLog @@ -1,3 +1,7 @@ +2002-03-14 Kral Ferch <kral_ferch@hotmail.com> + + * XmlTextWriterTests.cs: Initial checkin. + 2002-03-12 Kral Ferch <kral_ferch@hotmail.com> * XmlNodeListTests.cs: New tests: TestNodeTypesThatCantHaveChildren, diff --git a/mcs/class/System.XML/Test/Microsoft.Test.csproj b/mcs/class/System.XML/Test/Microsoft.Test.csproj index d573a5eb428..eda9d76bcb1 100644 --- a/mcs/class/System.XML/Test/Microsoft.Test.csproj +++ b/mcs/class/System.XML/Test/Microsoft.Test.csproj @@ -120,6 +120,11 @@ SubType = "Code" BuildAction = "Compile" /> + <File + RelPath = "XmlTextWriterTests.cs" + SubType = "Code" + BuildAction = "Compile" + /> </Include> </Files> </CSHARP> diff --git a/mcs/class/System.XML/Test/Mono.Test.csproj b/mcs/class/System.XML/Test/Mono.Test.csproj index 2b0d0a4822f..e7f317a46e8 100644 --- a/mcs/class/System.XML/Test/Mono.Test.csproj +++ b/mcs/class/System.XML/Test/Mono.Test.csproj @@ -125,6 +125,11 @@ SubType = "Code" BuildAction = "Compile" /> + <File + RelPath = "XmlTextWriterTests.cs" + SubType = "Code" + BuildAction = "Compile" + /> </Include> </Files> </CSHARP> diff --git a/mcs/class/System.XML/Test/XmlDocumentTests.cs b/mcs/class/System.XML/Test/XmlDocumentTests.cs index 9850ce43417..7c0bcf3a2a7 100644 --- a/mcs/class/System.XML/Test/XmlDocumentTests.cs +++ b/mcs/class/System.XML/Test/XmlDocumentTests.cs @@ -17,12 +17,6 @@ namespace Ximian.Mono.Tests document = new XmlDocument (); } - /////////////////////////////////////////////////////////////////////// - // - // Createxxx() tests. - // - /////////////////////////////////////////////////////////////////////// - public void TestCreateProcessingInstructionInvalid() { XmlProcessingInstruction processingInstruction; @@ -44,7 +38,6 @@ namespace Ximian.Mono.Tests // Fail("Should have thrown an ArgumentException."); // } catch (ArgumentException) { } - processingInstruction = null; processingInstruction = document.CreateProcessingInstruction("foo", "bar?>baz"); Assert(processingInstruction != null); @@ -67,12 +60,6 @@ namespace Ximian.Mono.Tests } - /////////////////////////////////////////////////////////////////////// - // - // LoadXml(string) tests. - // - /////////////////////////////////////////////////////////////////////// - public void TestLoadProcessingInstruction () { document.LoadXml (@"<?foo bar='baaz' quux='quuux'?><quuuux></quuuux>"); @@ -119,8 +106,8 @@ namespace Ximian.Mono.Tests public void TestLoadXmlElementWithChildElement () { document.LoadXml ("<foo><bar/></foo>"); -// Assert (document.ChildNodes.Count == 1); -// Assert (document.FirstChild.ChildNodes.Count == 1); + Assert (document.ChildNodes.Count == 1); + Assert (document.FirstChild.ChildNodes.Count == 1); AssertEquals ("foo", document.DocumentElement.LocalName); AssertEquals ("bar", document.DocumentElement.FirstChild.LocalName); } |