diff options
author | Dr Scofield | 2009-05-18 09:34:30 +0000 |
---|---|---|
committer | Dr Scofield | 2009-05-18 09:34:30 +0000 |
commit | 2ad8710e190b7543989cdb96a5268d21d2b5cefb (patch) | |
tree | 1ebf5e7463f04201459ff2fcd8f81b32a23d6ab2 /OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs | |
parent | Thank you kindly, StrawberryFride, for a patch that: (diff) | |
download | opensim-SC_OLD-2ad8710e190b7543989cdb96a5268d21d2b5cefb.zip opensim-SC_OLD-2ad8710e190b7543989cdb96a5268d21d2b5cefb.tar.gz opensim-SC_OLD-2ad8710e190b7543989cdb96a5268d21d2b5cefb.tar.bz2 opensim-SC_OLD-2ad8710e190b7543989cdb96a5268d21d2b5cefb.tar.xz |
fixing XmlWriter problem
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs')
-rw-r--r-- | OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs index 3fc7c06..ced3e5c 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs | |||
@@ -65,29 +65,33 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
65 | 65 | ||
66 | public string GetHandlerRegions(OSHttpResponse httpResponse) | 66 | public string GetHandlerRegions(OSHttpResponse httpResponse) |
67 | { | 67 | { |
68 | XmlWriter.WriteStartElement(String.Empty, "regions", String.Empty); | 68 | RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); |
69 | |||
70 | rxw.WriteStartElement(String.Empty, "regions", String.Empty); | ||
69 | foreach (Scene s in App.SceneManager.Scenes) | 71 | foreach (Scene s in App.SceneManager.Scenes) |
70 | { | 72 | { |
71 | XmlWriter.WriteStartElement(String.Empty, "uuid", String.Empty); | 73 | rxw.WriteStartElement(String.Empty, "uuid", String.Empty); |
72 | XmlWriter.WriteString(s.RegionInfo.RegionID.ToString()); | 74 | rxw.WriteString(s.RegionInfo.RegionID.ToString()); |
73 | XmlWriter.WriteEndElement(); | 75 | rxw.WriteEndElement(); |
74 | } | 76 | } |
75 | XmlWriter.WriteEndElement(); | 77 | rxw.WriteEndElement(); |
76 | 78 | ||
77 | return XmlWriterResult; | 79 | return rxw.ToString(); |
78 | } | 80 | } |
79 | 81 | ||
80 | protected string ShortRegionInfo(string key, string value) | 82 | protected string ShortRegionInfo(string key, string value) |
81 | { | 83 | { |
84 | RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); | ||
85 | |||
82 | if (String.IsNullOrEmpty(value) || | 86 | if (String.IsNullOrEmpty(value) || |
83 | String.IsNullOrEmpty(key)) return null; | 87 | String.IsNullOrEmpty(key)) return null; |
84 | 88 | ||
85 | XmlWriter.WriteStartElement(String.Empty, "region", String.Empty); | 89 | rxw.WriteStartElement(String.Empty, "region", String.Empty); |
86 | XmlWriter.WriteStartElement(String.Empty, key, String.Empty); | 90 | rxw.WriteStartElement(String.Empty, key, String.Empty); |
87 | XmlWriter.WriteString(value); | 91 | rxw.WriteString(value); |
88 | XmlWriter.WriteEndDocument(); | 92 | rxw.WriteEndDocument(); |
89 | 93 | ||
90 | return XmlWriterResult; | 94 | return rxw.ToString(); |
91 | } | 95 | } |
92 | 96 | ||
93 | public string GetHandlerRegion(OSHttpResponse httpResponse, string param) | 97 | public string GetHandlerRegion(OSHttpResponse httpResponse, string param) |
@@ -114,9 +118,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
114 | if (1 == comps.Length) | 118 | if (1 == comps.Length) |
115 | { | 119 | { |
116 | // complete region details requested | 120 | // complete region details requested |
121 | RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); | ||
117 | XmlSerializer xs = new XmlSerializer(typeof(RegionDetails)); | 122 | XmlSerializer xs = new XmlSerializer(typeof(RegionDetails)); |
118 | xs.Serialize(XmlWriter, details, _xmlNs); | 123 | xs.Serialize(rxw, details, _xmlNs); |
119 | return XmlWriterResult; | 124 | return rxw.ToString(); |
120 | } | 125 | } |
121 | 126 | ||
122 | if (2 == comps.Length) | 127 | if (2 == comps.Length) |
@@ -185,20 +190,22 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
185 | int users = scene.GetAvatars().Count; | 190 | int users = scene.GetAvatars().Count; |
186 | int objects = scene.Entities.Count - users; | 191 | int objects = scene.Entities.Count - users; |
187 | 192 | ||
188 | XmlWriter.WriteStartElement(String.Empty, "region", String.Empty); | 193 | RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); |
189 | XmlWriter.WriteStartElement(String.Empty, "stats", String.Empty); | 194 | |
195 | rxw.WriteStartElement(String.Empty, "region", String.Empty); | ||
196 | rxw.WriteStartElement(String.Empty, "stats", String.Empty); | ||
190 | 197 | ||
191 | XmlWriter.WriteStartElement(String.Empty, "users", String.Empty); | 198 | rxw.WriteStartElement(String.Empty, "users", String.Empty); |
192 | XmlWriter.WriteString(users.ToString()); | 199 | rxw.WriteString(users.ToString()); |
193 | XmlWriter.WriteEndElement(); | 200 | rxw.WriteEndElement(); |
194 | 201 | ||
195 | XmlWriter.WriteStartElement(String.Empty, "objects", String.Empty); | 202 | rxw.WriteStartElement(String.Empty, "objects", String.Empty); |
196 | XmlWriter.WriteString(objects.ToString()); | 203 | rxw.WriteString(objects.ToString()); |
197 | XmlWriter.WriteEndElement(); | 204 | rxw.WriteEndElement(); |
198 | 205 | ||
199 | XmlWriter.WriteEndDocument(); | 206 | rxw.WriteEndDocument(); |
200 | 207 | ||
201 | return XmlWriterResult; | 208 | return rxw.ToString(); |
202 | } | 209 | } |
203 | 210 | ||
204 | protected string RegionPrims(OSHttpResponse httpResponse, Scene scene, Vector3 min, Vector3 max) | 211 | protected string RegionPrims(OSHttpResponse httpResponse, Scene scene, Vector3 min, Vector3 max) |