aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Serialiser
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-08-29 19:08:23 +0100
committerJustin Clark-Casey (justincc)2014-08-29 19:08:23 +0100
commit1b75ec5647afeb9fbdad78f70c0c90a829bba076 (patch)
tree500744dddfc3f4238391d9e04ca431669f742ce5 /OpenSim/Region/CoreModules/World/Serialiser
parentFix recent regression test TestDeserializeXmlObjectWithOtherParts() which was... (diff)
downloadopensim-SC-1b75ec5647afeb9fbdad78f70c0c90a829bba076.zip
opensim-SC-1b75ec5647afeb9fbdad78f70c0c90a829bba076.tar.gz
opensim-SC-1b75ec5647afeb9fbdad78f70c0c90a829bba076.tar.bz2
opensim-SC-1b75ec5647afeb9fbdad78f70c0c90a829bba076.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Serialiser')
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs18
1 files changed, 1 insertions, 17 deletions
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
624 TestHelpers.InMethod(); 624 TestHelpers.InMethod();
625 TestHelpers.EnableLogging(); 625 TestHelpers.EnableLogging();
626 626
627 // We need to do this to get rid of whitespace between elements. 627 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithOtherPartsXml);
628 // TODO: Ultimately OpenSimulator xml parser should be set to ignore this but this means a bit of
629 // rejigging to replace old new XmlTextReader() with the post .NET 2.0 XmlReader.Create() calls
630 XmlDocument xdoc = new XmlDocument();
631 xdoc.LoadXml(ObjectWithOtherPartsXml);
632
633 StringBuilder sb = new StringBuilder();
634 using (StringWriter sw = new StringWriter(sb))
635 {
636 using (XmlTextWriter xtw = new XmlTextWriter(sw))
637 {
638// xtw.Formatting = Formatting.Indented;
639 xdoc.WriteTo(xtw);
640 }
641 }
642
643 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(sb.ToString());
644 SceneObjectPart[] parts = so.Parts; 628 SceneObjectPart[] parts = so.Parts;
645 Assert.AreEqual(3, so.Parts.Length); 629 Assert.AreEqual(3, so.Parts.Length);
646 630