diff options
author | Diva Canto | 2010-10-13 08:16:41 -0700 |
---|---|---|
committer | Diva Canto | 2010-10-13 08:16:41 -0700 |
commit | 54a3b8e079539d1d17b845be5c90702303452b0a (patch) | |
tree | 685771e4f29cd2746dd0dde5028e47a3e6da6b84 /OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-54a3b8e079539d1d17b845be5c90702303452b0a.zip opensim-SC-54a3b8e079539d1d17b845be5c90702303452b0a.tar.gz opensim-SC-54a3b8e079539d1d17b845be5c90702303452b0a.tar.bz2 opensim-SC-54a3b8e079539d1d17b845be5c90702303452b0a.tar.xz |
New SOG/SOP parser using XmlTextReader + delegates dictionary. Active for load oar and load xml2, but not for packing objects on crossings/TPs yet.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index 5494549..bb67ca0 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | |||
@@ -124,14 +124,30 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
124 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) | 124 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) |
125 | { | 125 | { |
126 | // There is only ever one prim. This oddity should be removeable post 0.5.9 | 126 | // There is only ever one prim. This oddity should be removeable post 0.5.9 |
127 | return SceneObjectSerializer.FromXml2Format(aPrimNode.OuterXml); | 127 | //return SceneObjectSerializer.FromXml2Format(aPrimNode.OuterXml); |
128 | using (reader = new XmlTextReader(new StringReader(aPrimNode.OuterXml))) | ||
129 | { | ||
130 | SceneObjectGroup obj = new SceneObjectGroup(); | ||
131 | if (SceneObjectSerializer.Xml2ToSOG(reader, obj)) | ||
132 | return obj; | ||
133 | |||
134 | return null; | ||
135 | } | ||
128 | } | 136 | } |
129 | 137 | ||
130 | return null; | 138 | return null; |
131 | } | 139 | } |
132 | else | 140 | else |
133 | { | 141 | { |
134 | return SceneObjectSerializer.FromXml2Format(rootNode.OuterXml); | 142 | //return SceneObjectSerializer.FromXml2Format(rootNode.OuterXml); |
143 | using (reader = new XmlTextReader(new StringReader(rootNode.OuterXml))) | ||
144 | { | ||
145 | SceneObjectGroup obj = new SceneObjectGroup(); | ||
146 | if (SceneObjectSerializer.Xml2ToSOG(reader, obj)) | ||
147 | return obj; | ||
148 | |||
149 | return null; | ||
150 | } | ||
135 | } | 151 | } |
136 | } | 152 | } |
137 | 153 | ||
@@ -193,12 +209,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
193 | /// <returns>The scene object created. null if the scene object already existed</returns> | 209 | /// <returns>The scene object created. null if the scene object already existed</returns> |
194 | protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData) | 210 | protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData) |
195 | { | 211 | { |
196 | SceneObjectGroup obj = SceneObjectSerializer.FromXml2Format(xmlData); | 212 | //SceneObjectGroup obj = SceneObjectSerializer.FromXml2Format(xmlData); |
213 | using (XmlTextReader reader = new XmlTextReader(new StringReader(xmlData))) | ||
214 | { | ||
215 | SceneObjectGroup obj = new SceneObjectGroup(); | ||
216 | SceneObjectSerializer.Xml2ToSOG(reader, obj); | ||
197 | 217 | ||
198 | if (scene.AddRestoredSceneObject(obj, true, false)) | 218 | if (scene.AddRestoredSceneObject(obj, true, false)) |
199 | return obj; | 219 | return obj; |
200 | else | 220 | else |
201 | return null; | 221 | return null; |
222 | } | ||
202 | } | 223 | } |
203 | 224 | ||
204 | public static void SavePrimsToXml2(Scene scene, string fileName) | 225 | public static void SavePrimsToXml2(Scene scene, string fileName) |