|
|
@@ -11,6 +11,8 @@
|
|
|
using System;
|
|
|
using System.Collections;
|
|
|
using System.Xml;
|
|
|
+using System.IO;
|
|
|
+using System.Text;
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
@@ -527,6 +529,24 @@ namespace MonoTests.System.Xml
|
|
|
catch (Exception) {}
|
|
|
AssertEquals (1, element.ChildNodes.Count);
|
|
|
}
|
|
|
+
|
|
|
+ public void TestGetElementsByTagNameNoNameSpace ()
|
|
|
+ {
|
|
|
+ string xml = @"<library><book><title>XML Fun</title><author>John Doe</author>
|
|
|
+ <price>34.95</price></book><book><title>Bear and the Dragon</title>
|
|
|
+ <author>Tom Clancy</author><price>6.95</price></book><book>
|
|
|
+ <title>Bourne Identity</title><author>Robert Ludlum</author>
|
|
|
+ <price>9.95</price></book><Fluffer><Nutter><book>
|
|
|
+ <title>Bourne Ultimatum</title><author>Robert Ludlum</author>
|
|
|
+ <price>9.95</price></book></Nutter></Fluffer></library>";
|
|
|
+
|
|
|
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml));
|
|
|
+ document = new XmlDocument ();
|
|
|
+ document.Load (memoryStream);
|
|
|
+ XmlNodeList bookList = document.GetElementsByTagName ("book");
|
|
|
+ AssertEquals ("GetElementsByTagName (string) returned incorrect count.", 4, bookList.Count);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void TestInnerAndOuterXml ()
|
|
|
{
|
|
|
@@ -560,6 +580,22 @@ namespace MonoTests.System.Xml
|
|
|
AssertEquals (document.InnerXml, document.OuterXml);
|
|
|
}
|
|
|
|
|
|
+ public void TestLoadWithSystemIOStream ()
|
|
|
+ {
|
|
|
+ string xml = @"<library><book><title>XML Fun</title><author>John Doe</author>
|
|
|
+ <price>34.95</price></book><book><title>Bear and the Dragon</title>
|
|
|
+ <author>Tom Clancy</author><price>6.95</price></book><book>
|
|
|
+ <title>Bourne Identity</title><author>Robert Ludlum</author>
|
|
|
+ <price>9.95</price></book><Fluffer><Nutter><book>
|
|
|
+ <title>Bourne Ultimatum</title><author>Robert Ludlum</author>
|
|
|
+ <price>9.95</price></book></Nutter></Fluffer></library>";
|
|
|
+
|
|
|
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml));
|
|
|
+ document = new XmlDocument ();
|
|
|
+ document.Load (memoryStream);
|
|
|
+ AssertEquals ("Not Loaded From IOStream", true, document.HasChildNodes);
|
|
|
+ }
|
|
|
+
|
|
|
public void TestLoadXmlCDATA ()
|
|
|
{
|
|
|
document.LoadXml ("<foo><![CDATA[bar]]></foo>");
|