From 1b75ec5647afeb9fbdad78f70c0c90a829bba076 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 29 Aug 2014 19:08:23 +0100 Subject: Ignore whitespace when reading serialized XML objects. This was previously effectively being done by XmlDocument in the multiple passes through the XML. This change tells XmlReader to ignore whitespace. This also means changing arguments to use XmlReader instead of XmlTextReader (a descendent of XmlReader) directly. XmlReader.Create() has been the recommend way to create XML readers since .NET 2.0 as per MS SDK and is the only way to specific ignore whitespace settings. --- .../World/Serialiser/Tests/SerialiserTests.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'OpenSim/Region/CoreModules/World/Serialiser') diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index 94cd9cd..a5bb1a7 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -624,23 +624,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests TestHelpers.InMethod(); TestHelpers.EnableLogging(); - // We need to do this to get rid of whitespace between elements. - // TODO: Ultimately OpenSimulator xml parser should be set to ignore this but this means a bit of - // rejigging to replace old new XmlTextReader() with the post .NET 2.0 XmlReader.Create() calls - XmlDocument xdoc = new XmlDocument(); - xdoc.LoadXml(ObjectWithOtherPartsXml); - - StringBuilder sb = new StringBuilder(); - using (StringWriter sw = new StringWriter(sb)) - { - using (XmlTextWriter xtw = new XmlTextWriter(sw)) - { -// xtw.Formatting = Formatting.Indented; - xdoc.WriteTo(xtw); - } - } - - SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(sb.ToString()); + SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithOtherPartsXml); SceneObjectPart[] parts = so.Parts; Assert.AreEqual(3, so.Parts.Length); -- cgit v1.1