From 91ffb6722f40f1eeda9cda461992d1cd211bdbd2 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sat, 21 Jun 2008 20:43:13 +0000 Subject: [PATCH] * Remove redundant tag from individual object xml representation * WARNING: Until both regions upgrade to this revision, prim crossings from regions on this revision to earlier region revisions will not work properly * e.g. in the attachments cases, the attachments will remain visible but won't be individually detachable * This change may seem to have more costs than benefits, but I'm doing it because I can soon reuse this changed existing code in another context - it seems better not to proliferate similar but slightly different xml serializations. --- .../World/Serialiser/SceneXmlLoader.cs | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index 94161f052c..7cc2459f9a 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs @@ -28,9 +28,11 @@ using System; using System.Collections.Generic; using System.IO; +//using System.Reflection; using System.Xml; using Axiom.Math; using libsecondlife; +//using log4net; using OpenSim.Framework; using OpenSim.Region.Physics.Manager; @@ -41,6 +43,8 @@ namespace OpenSim.Region.Environment.Scenes /// public class SceneXmlLoader { + //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset) { XmlDocument doc = new XmlDocument(); @@ -97,11 +101,7 @@ namespace OpenSim.Region.Environment.Scenes public static string SavePrimGroupToXML2String(SceneObjectGroup grp) { - string returnstring = ""; - returnstring += "\n"; - returnstring += grp.ToXmlString2(); - returnstring += "\n"; - return returnstring; + return grp.ToXmlString2(); } public static void LoadGroupFromXml2String(Scene scene, string xmlString) @@ -115,9 +115,21 @@ namespace OpenSim.Region.Environment.Scenes reader.Close(); rootNode = doc.FirstChild; - foreach (XmlNode aPrimNode in rootNode.ChildNodes) + // This is to deal with neighbouring regions that are still surrounding the group xml with the + // tag. It should be possible to remove the first part of this if statement once we go past 0.5.9 (or + // when some other changes forces all regions to upgrade). + // This might seem rather pointless since prim crossing from this revision to an earlier revision remains + // broken. But it isn't much work to accomodate the old format here. + if (rootNode.LocalName.Equals("scene")) { - CreatePrimFromXml2(scene, aPrimNode.OuterXml); + foreach (XmlNode aPrimNode in rootNode.ChildNodes) + { + CreatePrimFromXml2(scene, aPrimNode.OuterXml); + } + } + else + { + CreatePrimFromXml2(scene, rootNode.OuterXml); } }