Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Mak <duncan@mono-cvs.ximian.com>2002-03-22 05:38:08 +0300
committerDuncan Mak <duncan@mono-cvs.ximian.com>2002-03-22 05:38:08 +0300
commitb9e2f23ea54d7fc39449751427b1446ce72f685b (patch)
treed77b0b0c0d9ce79fc0e8418c913d9f30dc2507d6
parent556f0d7b34cd6ee14ceba4889902ddd3f498fc33 (diff)
2002-03-22 Duncan Mak <duncan@ximian.com>
* XmlElement.cs: Reformatted. (CloneNode) Corrected. * XmlDocument.cs (CreateWhitespace): Implemented. * XmlAttribute.cs (CloneNode): Changed the child's CloneNode to true, because Attributes have ChildNodes. 2002-03-22 Duncan Mak <duncan@ximian.com> * AllTests.cs: * Microsoft.Test.csproj: * Mono.Test.csproj: Updated to include new files. * XmlCDataSectionTests.cs: Added to CVS. * XmlCommentTests.cs: Added to CVS. hanks to Kral for helping me setup a testing environment on VS.NET. * XmlElementTests.cs: Reformatted. (TestCloneNode): Added. * XmlWhiteSpaceTests.cs: Added to CVS. svn path=/trunk/mcs/; revision=3267
-rw-r--r--mcs/class/System.XML/System.Xml/ChangeLog10
-rw-r--r--mcs/class/System.XML/System.Xml/XmlAttribute.cs26
-rw-r--r--mcs/class/System.XML/System.Xml/XmlCDataSection.cs2
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDocument.cs7
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs2
-rw-r--r--mcs/class/System.XML/System.Xml/XmlElement.cs92
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNode.cs6
-rw-r--r--mcs/class/System.XML/System.Xml/XmlWriter.cs2
-rw-r--r--mcs/class/System.XML/Test/AllTests.cs3
-rw-r--r--mcs/class/System.XML/Test/ChangeLog18
-rw-r--r--mcs/class/System.XML/Test/Microsoft.Test.csproj279
-rw-r--r--mcs/class/System.XML/Test/Mono.Test.csproj289
-rwxr-xr-xmcs/class/System.XML/Test/XmlCDataSectionTests.cs92
-rwxr-xr-xmcs/class/System.XML/Test/XmlCommentTests.cs92
-rw-r--r--mcs/class/System.XML/Test/XmlElementTests.cs74
-rwxr-xr-xmcs/class/System.XML/Test/XmlWhiteSpaceTests.cs112
16 files changed, 709 insertions, 397 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
index 8d130885263..8c907ddef27 100644
--- a/mcs/class/System.XML/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -1,3 +1,13 @@
+2002-03-22 Duncan Mak <duncan@ximian.com>
+
+ * XmlElement.cs: Reformatted.
+ (CloneNode) Corrected.
+
+ * XmlDocument.cs (CreateWhitespace): Implemented.
+
+ * XmlAttribute.cs (CloneNode): Changed the child's CloneNode to
+ true, because Attributes have ChildNodes.
+
2002-03-21 Kral Ferch <kral_ferch@hotmail.com>
* XmlTextWriter.cs: WriteStartDocument tracks state, writes out
diff --git a/mcs/class/System.XML/System.Xml/XmlAttribute.cs b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
index 59ac666d7e6..0db650d74b0 100644
--- a/mcs/class/System.XML/System.Xml/XmlAttribute.cs
+++ b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
@@ -148,18 +148,16 @@ namespace System.Xml
public override XmlNode CloneNode (bool deep)
{
- if (deep) { // recursively clone the subtree
- XmlNode node = FirstChild; // Attributes have no ParentNodes
-
+ XmlNode node = new XmlAttribute (prefix, localName, namespaceURI,
+ OwnerDocument);
+ if (deep) {
while ((node != null) && (node.HasChildNodes)) {
- AppendChild (node.NextSibling.CloneNode (false));
+ AppendChild (node.NextSibling.CloneNode (true));
node = node.NextSibling;
}
+ }
- return node;
- } else
- return new XmlAttribute (prefix, localName, namespaceURI,
- OwnerDocument);
+ return node;
}
internal void SetOwnerElement (XmlElement ownerElement)
@@ -168,13 +166,13 @@ namespace System.Xml
}
[MonoTODO]
- public override void WriteContentTo(XmlWriter w)
+ public override void WriteContentTo (XmlWriter w)
{
throw new NotImplementedException ();
}
[MonoTODO]
- public override void WriteTo(XmlWriter w)
+ public override void WriteTo (XmlWriter w)
{
throw new NotImplementedException ();
}
@@ -182,13 +180,9 @@ namespace System.Xml
#endregion
internal override XmlLinkedNode LastLinkedChild {
- get {
- return lastChild;
- }
+ get { return lastChild; }
- set {
- lastChild = value;
- }
+ set { lastChild = value; }
}
}
}
diff --git a/mcs/class/System.XML/System.Xml/XmlCDataSection.cs b/mcs/class/System.XML/System.Xml/XmlCDataSection.cs
index e91d7935ed3..fae85718883 100644
--- a/mcs/class/System.XML/System.Xml/XmlCDataSection.cs
+++ b/mcs/class/System.XML/System.Xml/XmlCDataSection.cs
@@ -46,7 +46,7 @@ namespace System.Xml
public override void WriteTo (XmlWriter w)
{
- w.WriteCData(Data);
+ w.WriteCData (Data);
}
#endregion
diff --git a/mcs/class/System.XML/System.Xml/XmlDocument.cs b/mcs/class/System.XML/System.Xml/XmlDocument.cs
index ea7ea5db64f..6284dd4b6c8 100644
--- a/mcs/class/System.XML/System.Xml/XmlDocument.cs
+++ b/mcs/class/System.XML/System.Xml/XmlDocument.cs
@@ -307,10 +307,13 @@ namespace System.Xml
return new XmlText (text, this);
}
- [MonoTODO]
public virtual XmlWhitespace CreateWhitespace (string text)
{
- throw new NotImplementedException ();
+ foreach (char c in text.ToCharArray ())
+ if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
+ throw new ArgumentException ("Invalid whitespace characters.");
+
+ return new XmlWhitespace (text, this);
}
[MonoTODO]
diff --git a/mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs b/mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs
index 68cfbf54c9e..324ed042902 100644
--- a/mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs
+++ b/mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs
@@ -24,7 +24,7 @@ namespace System.Xml
[MonoTODO]
public override string InnerXml {
- get {throw new NotImplementedException(); }
+ get { throw new NotImplementedException(); }
}
public override string LocalName {
diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs
index f47d931b8eb..0100ba1c954 100644
--- a/mcs/class/System.XML/System.Xml/XmlElement.cs
+++ b/mcs/class/System.XML/System.Xml/XmlElement.cs
@@ -43,65 +43,42 @@ namespace System.Xml
#region Properties
public override XmlAttributeCollection Attributes {
- get {
- return attributes;
- }
+ get { return attributes; }
}
public virtual bool HasAttributes {
- get {
- return attributes.Count > 0;
- }
+ get { return attributes.Count > 0; }
}
[MonoTODO]
public override string InnerText {
- get {
- throw new NotImplementedException ();
- }
-
- set {
- throw new NotImplementedException ();
- }
+ get { throw new NotImplementedException (); }
+
+ set { throw new NotImplementedException (); }
}
[MonoTODO]
public override string InnerXml {
- get {
- throw new NotImplementedException ();
- }
+ get { throw new NotImplementedException (); }
- set {
- throw new NotImplementedException ();
- }
+ set { throw new NotImplementedException (); }
}
[MonoTODO]
- public bool IsEmpty {
- get {
- throw new NotImplementedException ();
- }
+ public bool IsEmpty {
+ get { throw new NotImplementedException (); }
- set {
- throw new NotImplementedException ();
- }
+ set { throw new NotImplementedException (); }
}
internal override XmlLinkedNode LastLinkedChild {
- get {
- return lastLinkedChild;
- }
+ get { return lastLinkedChild; }
- set {
- lastLinkedChild = value;
- }
+ set { lastLinkedChild = value; }
}
- public override string LocalName
- {
- get {
- return localName;
- }
+ public override string LocalName {
+ get { return localName; }
}
public override string Name {
@@ -111,9 +88,7 @@ namespace System.Xml
}
public override string NamespaceURI {
- get {
- return namespaceURI;
- }
+ get { return namespaceURI; }
}
[MonoTODO]
@@ -149,32 +124,23 @@ namespace System.Xml
[MonoTODO]
public override XmlNode CloneNode (bool deep)
{
+ XmlNode node = new XmlElement (prefix, localName, namespaceURI,
+ OwnerDocument);
+
+ for (int i = 0; i < node.Attributes.Count; i++)
+ node.AppendChild (node.Attributes [i].CloneNode (false));
+
if (deep) {
- XmlNode node = ParentNode.FirstChild;
-
- while ((node != null) && (node.HasChildNodes)) {
- //
- // XmlNode.CloneNode says we should also clone the attributes,
- // does the NextSibling.CloneNode do the Right Thing?
- //
- AppendChild (node.NextSibling.CloneNode (false));
+ while ((node != null) && (node.HasChildNodes)) {
+ AppendChild (node.NextSibling.CloneNode (true));
node = node.NextSibling;
}
-
- return node;
- } else {
- XmlNode node = new XmlElement (prefix, localName, namespaceURI,
- OwnerDocument);
-
- //
- // XmlNode.CloneNode says 'Clones the element node, its attributes
- // including its default attributes.'
- //
- for (int i = 0; i < node.Attributes.Count; i++)
- node.AppendChild (node.Attributes [i].CloneNode (false));
-
- return node;
- }
+ } // shallow cloning
+
+ //
+ // Reminder: Also look into Default attributes.
+ //
+ return node;
}
[MonoTODO]
diff --git a/mcs/class/System.XML/System.Xml/XmlNode.cs b/mcs/class/System.XML/System.Xml/XmlNode.cs
index d8b0e3451b6..34636002c02 100644
--- a/mcs/class/System.XML/System.Xml/XmlNode.cs
+++ b/mcs/class/System.XML/System.Xml/XmlNode.cs
@@ -185,8 +185,10 @@ namespace System.Xml
public virtual XmlNode AppendChild (XmlNode newChild)
{
- if (NodeType == XmlNodeType.Document || NodeType == XmlNodeType.Element || NodeType == XmlNodeType.Attribute) {
- XmlLinkedNode newLinkedChild = (XmlLinkedNode)newChild;
+ if (NodeType == XmlNodeType.Document
+ || NodeType == XmlNodeType.Element
+ || NodeType == XmlNodeType.Attribute) {
+ XmlLinkedNode newLinkedChild = (XmlLinkedNode) newChild;
XmlLinkedNode lastLinkedChild = LastLinkedChild;
newLinkedChild.parentNode = this;
diff --git a/mcs/class/System.XML/System.Xml/XmlWriter.cs b/mcs/class/System.XML/System.Xml/XmlWriter.cs
index 31bb6d183f6..e70e6869f7b 100644
--- a/mcs/class/System.XML/System.Xml/XmlWriter.cs
+++ b/mcs/class/System.XML/System.Xml/XmlWriter.cs
@@ -50,7 +50,7 @@ namespace System.Xml
}
[MonoTODO]
- public void WriteAttributeString (string localName, string ns, string value)
+ public void WriteAttributeString (string localName, string ns, string value)
{
throw new NotImplementedException ();
}
diff --git a/mcs/class/System.XML/Test/AllTests.cs b/mcs/class/System.XML/Test/AllTests.cs
index d10a46120f7..2714477ec25 100644
--- a/mcs/class/System.XML/Test/AllTests.cs
+++ b/mcs/class/System.XML/Test/AllTests.cs
@@ -27,6 +27,9 @@ namespace Ximian.Mono.Tests
suite.AddTest (new TestSuite (typeof (NameTableTests)));
suite.AddTest (new TestSuite (typeof (XmlElementTests)));
suite.AddTest (new TestSuite (typeof (XmlNodeListTests)));
+ suite.AddTest (new TestSuite (typeof (XmlCommentTests)));
+ suite.AddTest (new TestSuite (typeof (XmlCDataSectionTests)));
+ suite.AddTest (new TestSuite (typeof (XmlWhitespaceTests)));
return suite;
}
}
diff --git a/mcs/class/System.XML/Test/ChangeLog b/mcs/class/System.XML/Test/ChangeLog
index 4edc01dfef4..a5bf5c7922b 100644
--- a/mcs/class/System.XML/Test/ChangeLog
+++ b/mcs/class/System.XML/Test/ChangeLog
@@ -1,6 +1,22 @@
+2002-03-22 Duncan Mak <duncan@ximian.com>
+
+ * AllTests.cs:
+ * Microsoft.Test.csproj:
+ * Mono.Test.csproj: Updated to include new files.
+
+ * XmlCDataSectionTests.cs: Added to CVS.
+
+ * XmlCommentTests.cs: Added to CVS. hanks to Kral for helping me
+ setup a testing environment on VS.NET.
+
+ * XmlElementTests.cs: Reformatted.
+ (TestCloneNode): Added.
+
+ * XmlWhiteSpaceTests.cs: Added to CVS.
+
2002-03-21 Kral Ferch <kral_ferch@hotmail.com>
- * XmlDocumentTests.cs: Tests parent traversal up through
+ * XmlDocumentTests.cs: Tessts parent traversal up through
document itself until null. Tests a removed elements next
sibling is null.
diff --git a/mcs/class/System.XML/Test/Microsoft.Test.csproj b/mcs/class/System.XML/Test/Microsoft.Test.csproj
index eda9d76bcb1..21d2b15baec 100644
--- a/mcs/class/System.XML/Test/Microsoft.Test.csproj
+++ b/mcs/class/System.XML/Test/Microsoft.Test.csproj
@@ -1,132 +1,147 @@
-<VisualStudioProject>
- <CSHARP
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{D6C51F53-33E2-41DF-981A-33FCFA81CDA7}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "Microsoft.Test"
- AssemblyOriginatorKeyFile = ""
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Library"
- RootNamespace = "Test"
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = ""
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "true"
- Optimize = "false"
- OutputPath = "bin\Debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE"
- DocumentationFile = ""
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "bin\Release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
- />
- <Reference
- Name = "NUnitCore"
- AssemblyName = "NUnitCore"
- HintPath = "..\..\..\nunit\NUnitCore.dll"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AllTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ChangeLog"
- BuildAction = "None"
- />
- <File
- RelPath = "NameTableTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlAttributeTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlDocumentTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlElementTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlNamespaceManagerTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlNodeListTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlTextReaderTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlTextWriterTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{D6C51F53-33E2-41DF-981A-33FCFA81CDA7}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Microsoft.Test"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "Test"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "NUnitCore"
+ AssemblyName = "NUnitCore"
+ HintPath = "..\..\..\nunit\NUnitCore.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AllTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "NameTableTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlAttributeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCDataSectionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCommentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlElementTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNamespaceManagerTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNodeListTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextReaderTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextWriterTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlWhiteSpaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.XML/Test/Mono.Test.csproj b/mcs/class/System.XML/Test/Mono.Test.csproj
index e7f317a46e8..e35a529c1bd 100644
--- a/mcs/class/System.XML/Test/Mono.Test.csproj
+++ b/mcs/class/System.XML/Test/Mono.Test.csproj
@@ -1,137 +1,152 @@
-<VisualStudioProject>
- <CSHARP
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{D6C51F53-33E2-41DF-981A-33FCFA81CDA7}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "Mono.Test"
- AssemblyOriginatorKeyFile = ""
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Library"
- RootNamespace = "Test"
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = ""
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "true"
- Optimize = "false"
- OutputPath = "bin\Debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE"
- DocumentationFile = ""
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "bin\Release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
- />
- <Reference
- Name = "Mono.System.XML"
- Project = "{0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}"
- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
- />
- <Reference
- Name = "NUnitCore"
- AssemblyName = "NUnitCore"
- HintPath = "..\..\..\nunit\NUnitCore.dll"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AllTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ChangeLog"
- BuildAction = "None"
- />
- <File
- RelPath = "NameTableTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlAttributeTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlDocumentTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlElementTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlNamespaceManagerTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlNodeListTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlTextReaderTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "XmlTextWriterTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{D6C51F53-33E2-41DF-981A-33FCFA81CDA7}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Mono.Test"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "Test"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "Mono.System.XML"
+ Project = "{0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "NUnitCore"
+ AssemblyName = "NUnitCore"
+ HintPath = "..\..\..\nunit\NUnitCore.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AllTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "NameTableTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlAttributeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCDataSectionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCommentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlElementTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNamespaceManagerTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNodeListTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextReaderTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextWriterTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlWhiteSpaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.XML/Test/XmlCDataSectionTests.cs b/mcs/class/System.XML/Test/XmlCDataSectionTests.cs
new file mode 100755
index 00000000000..f1cc1ae2649
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlCDataSectionTests.cs
@@ -0,0 +1,92 @@
+//
+// System.Xml.XmlCDataSectionTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlCDataSectionTests : TestCase
+ {
+ XmlDocument document;
+ XmlCDataSection section;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlCDataSectionTests ()
+ : base ("Ximian.Mono.Tests.XmlCDataSectionTests testsuite")
+ {
+ }
+
+ public XmlCDataSectionTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<root><foo></foo></root>");
+ section = document.CreateCDataSection ("CDataSection");
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+ // AssertEquals (original.nodetype + " was incorrectly cloned.",
+ // original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestXmlCDataSectionName ()
+ {
+ AssertEquals (section.NodeType + " Name property broken",
+ section.Name, "#cdata-section");
+ }
+
+ public void TestXmlCDataSectionLocalName ()
+ {
+ AssertEquals (section.NodeType + " LocalName property broken",
+ section.LocalName, "#cdata-section");
+ }
+
+ public void TestXmlCDataSectionNodeType ()
+ {
+ AssertEquals ("XmlCDataSection NodeType property broken",
+ section.NodeType.ToString (), "CDATA");
+ }
+
+ public void TestXmlCDataSectionIsReadOnly ()
+ {
+ AssertEquals ("XmlCDataSection IsReadOnly property broken",
+ section.IsReadOnly, false);
+ }
+
+ public void TestXmlCDataSectionCloneNode ()
+ {
+ original = section;
+
+ shallow = section.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, shallow.Value);
+
+ deep = section.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, deep.Value);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlCommentTests.cs b/mcs/class/System.XML/Test/XmlCommentTests.cs
new file mode 100755
index 00000000000..705705bf28b
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlCommentTests.cs
@@ -0,0 +1,92 @@
+//
+// System.Xml.XmlCommentTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlCommentTests : TestCase
+ {
+ XmlDocument document;
+ XmlComment comment;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlCommentTests ()
+ : base ("Ximian.Mono.Tests.XmlCommentTests testsuite")
+ {
+ }
+
+ public XmlCommentTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+// assertequals (original.nodetype + " was incorrectly cloned.",
+// original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestXmlCommentName ()
+ {
+ AssertEquals (comment.NodeType + " Name property broken",
+ comment.Name, "#comment");
+ }
+
+ public void TestXmlCommentLocalName ()
+ {
+ AssertEquals (comment.NodeType + " LocalName property broken",
+ comment.LocalName, "#comment");
+ }
+
+ public void TestXmlCommentNodeType ()
+ {
+ AssertEquals ("XmlComment NodeType property broken",
+ comment.NodeType.ToString (), "Comment");
+ }
+
+ public void TestXmlCommentIsReadOnly ()
+ {
+ AssertEquals ("XmlComment IsReadOnly property broken",
+ comment.IsReadOnly, false);
+ }
+
+ public void TestXmlCommentCloneNode ()
+ {
+ original = comment;
+
+ shallow = comment.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, shallow.Value);
+
+ deep = comment.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, deep.Value);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlElementTests.cs b/mcs/class/System.XML/Test/XmlElementTests.cs
index 76a22d512d5..9dbe7c43498 100644
--- a/mcs/class/System.XML/Test/XmlElementTests.cs
+++ b/mcs/class/System.XML/Test/XmlElementTests.cs
@@ -26,12 +26,9 @@ namespace Ximian.Mono.Tests
document = new XmlDocument ();
}
- private void AssertElement (
- XmlElement element,
- string prefix,
- string localName,
- string namespaceURI,
- int attributesCount)
+ private void AssertElement (XmlElement element, string prefix,
+ string localName, string namespaceURI,
+ int attributesCount)
{
AssertEquals (prefix != String.Empty ? prefix + ":" + localName : localName, element.Name);
AssertEquals (prefix, element.Prefix);
@@ -43,61 +40,32 @@ namespace Ximian.Mono.Tests
public void TestCreateElement1 ()
{
XmlElement element = document.CreateElement ("name");
- AssertElement (
- element,
- String.Empty,
- "name",
- String.Empty,
- 0
- );
+ AssertElement (element, String.Empty, "name", String.Empty, 0);
}
public void TestCreateElement1WithPrefix ()
{
XmlElement element = document.CreateElement ("prefix:localName");
- AssertElement (
- element,
- "prefix",
- "localName",
- String.Empty,
- 0
- );
+ AssertElement (element, "prefix", "localName", String.Empty, 0);
}
public void TestCreateElement2 ()
{
XmlElement element = document.CreateElement ("qualifiedName", "namespaceURI");
- AssertElement (
- element,
- String.Empty,
- "qualifiedName",
- "namespaceURI",
- 0
- );
+ AssertElement (element, String.Empty, "qualifiedName",
+ "namespaceURI", 0);
}
public void TestCreateElement2WithPrefix ()
{
XmlElement element = document.CreateElement ("prefix:localName", "namespaceURI");
- AssertElement (
- element,
- "prefix",
- "localName",
- "namespaceURI",
- 0
- );
+ AssertElement (element, "prefix", "localName", "namespaceURI", 0);
}
public void TestCreateElement3 ()
{
XmlElement element = document.CreateElement ("prefix", "localName", "namespaceURI");
- AssertElement (
- element,
- "prefix",
- "localName",
- "namespaceURI",
- 0
- );
+ AssertElement (element, "prefix", "localName", "namespaceURI", 0);
}
public void TestSetGetAttribute ()
@@ -108,5 +76,29 @@ namespace Ximian.Mono.Tests
AssertEquals ("val1", element.GetAttribute ("attr1"));
AssertEquals ("val2", element.GetAttribute ("attr2"));
}
+
+ public void TestCloneNode ()
+ {
+ XmlElement element = document.CreateElement ("foo");
+ XmlElement child = document.CreateElement ("bar");
+ XmlElement grandson = document.CreateElement ("baz");
+
+ element.SetAttribute ("attr1", "val1");
+ element.SetAttribute ("attr2", "val2");
+ element.AppendChild (child);
+ child.SetAttribute ("attr3", "val3");
+ child.AppendChild (grandson);
+
+ document.AppendChild (element);
+ XmlNode deep = element.CloneNode (true);
+ // AssertEquals ("These should be the same", deep.OuterXml, element.OuterXml);
+ AssertNull ("This is not null", deep.ParentNode);
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (element,deep));
+
+ XmlNode shallow = element.CloneNode (false);
+ AssertNull ("This is not null", shallow.ParentNode);
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (element,shallow));
+ AssertEquals ("Shallow clones shalt have no children!", false, shallow.HasChildNodes);
+ }
}
}
diff --git a/mcs/class/System.XML/Test/XmlWhiteSpaceTests.cs b/mcs/class/System.XML/Test/XmlWhiteSpaceTests.cs
new file mode 100755
index 00000000000..62693aafc65
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlWhiteSpaceTests.cs
@@ -0,0 +1,112 @@
+//
+// System.Xml.XmlWhitespaceTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlWhitespaceTests : TestCase
+ {
+ XmlDocument document;
+ XmlWhitespace whitespace;
+ XmlWhitespace broken;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlWhitespaceTests ()
+ : base ("Ximian.Mono.Tests.XmlWhitespaceTests testsuite")
+ {
+ }
+
+ public XmlWhitespaceTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<root><foo></foo></root>");
+ XmlElement element = document.CreateElement ("foo");
+ whitespace = document.CreateWhitespace ("\r\n");
+ element.AppendChild (whitespace);
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+// assertequals (original.nodetype + " was incorrectly cloned.",
+// original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+ AssertEquals ("Value incorrectly cloned",
+ cloned.Value, original.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestXmlWhitespaceBadConstructor ()
+ {
+ try {
+ broken = document.CreateWhitespace ("black");
+ } catch (Exception e) {
+ AssertEquals ("Incorrect Exception thrown",
+ e.GetType (), Type.GetType ("System.ArgumentException"));
+ }
+ }
+
+ public void TestXmlWhitespaceConstructor ()
+ {
+ AssertEquals ("whitespace char didn't get copied right",
+ "\r\n", whitespace.Data);
+ }
+
+
+ public void TestXmlWhitespaceName ()
+ {
+ AssertEquals (whitespace.NodeType + " Name property broken",
+ whitespace.Name, "#whitespace");
+ }
+
+ public void TestXmlWhitespaceLocalName ()
+ {
+ AssertEquals (whitespace.NodeType + " LocalName property broken",
+ whitespace.LocalName, "#whitespace");
+ }
+
+ public void TestXmlWhitespaceNodeType ()
+ {
+ AssertEquals ("XmlWhitespace NodeType property broken",
+ whitespace.NodeType.ToString (), "Whitespace");
+ }
+
+ public void TestXmlWhitespaceIsReadOnly ()
+ {
+ AssertEquals ("XmlWhitespace IsReadOnly property broken",
+ whitespace.IsReadOnly, false);
+ }
+
+ public void TestXmlWhitespaceCloneNode ()
+ {
+ original = whitespace;
+
+ shallow = whitespace.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+
+ deep = whitespace.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}