aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
diff options
context:
space:
mode:
authorDan Lake2012-02-03 15:21:07 -0800
committerDan Lake2012-02-03 15:21:07 -0800
commitea19e50919afdf2aee3d123437eef82fc59663a1 (patch)
treec45b94ef98eab9115a69d70c4159769daea5c3d1 /OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
parentCheck for null scene in ScheduleFullUpdate and ScheduleTerseUpdate before tri... (diff)
parentExtend m_avatars lock in NpcModule.CreateNPC over both creation of NPC scene ... (diff)
downloadopensim-SC_OLD-ea19e50919afdf2aee3d123437eef82fc59663a1.zip
opensim-SC_OLD-ea19e50919afdf2aee3d123437eef82fc59663a1.tar.gz
opensim-SC_OLD-ea19e50919afdf2aee3d123437eef82fc59663a1.tar.bz2
opensim-SC_OLD-ea19e50919afdf2aee3d123437eef82fc59663a1.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Conflicts: OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
Diffstat (limited to 'OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs')
-rw-r--r--OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs53
1 files changed, 52 insertions, 1 deletions
diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
index 7447ac2..39a9f37 100644
--- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
+++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
@@ -24,11 +24,13 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27
27using System; 28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.IO; 30using System.IO;
31using System.Reflection;
30using System.Xml; 32using System.Xml;
31 33using log4net;
32using OpenMetaverse; 34using OpenMetaverse;
33using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
34 36
@@ -39,6 +41,55 @@ namespace OpenSim.Framework.Serialization.External
39 /// </summary> 41 /// </summary>
40 public class ExternalRepresentationUtils 42 public class ExternalRepresentationUtils
41 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 /// <summary>
47 /// Populate a node with data read from xml using a dictinoary of processors
48 /// </summary>
49 /// <param name="nodeToFill"></param>
50 /// <param name="processors">
51 /// A <see cref="Dictionary<System.String, Action<NodeType, XmlTextReader>>"/>
52 /// </param>
53 /// <param name="xtr">
54 /// A <see cref="XmlTextReader"/>
55 /// </param>
56 public static void ExecuteReadProcessors<NodeType>(
57 NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlTextReader>> processors, XmlTextReader xtr)
58 {
59 string nodeName = string.Empty;
60 while (xtr.NodeType != XmlNodeType.EndElement)
61 {
62 nodeName = xtr.Name;
63
64// m_log.DebugFormat("[ExternalRepresentationUtils]: Processing: {0}", nodeName);
65
66 Action<NodeType, XmlTextReader> p = null;
67 if (processors.TryGetValue(xtr.Name, out p))
68 {
69// m_log.DebugFormat("[ExternalRepresentationUtils]: Found {0} processor, nodeName);
70
71 try
72 {
73 p(nodeToFill, xtr);
74 }
75 catch (Exception e)
76 {
77 m_log.ErrorFormat(
78 "[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}",
79 nodeName, e.Message, e.StackTrace);
80
81 if (xtr.NodeType == XmlNodeType.EndElement)
82 xtr.Read();
83 }
84 }
85 else
86 {
87 // m_log.DebugFormat("[LandDataSerializer]: caught unknown element {0}", nodeName);
88 xtr.ReadOuterXml(); // ignore
89 }
90 }
91 }
92
42 /// <summary> 93 /// <summary>
43 /// Takes a XML representation of a SceneObjectPart and returns another XML representation 94 /// Takes a XML representation of a SceneObjectPart and returns another XML representation
44 /// with creator data added to it. 95 /// with creator data added to it.