aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/XmlRpcCS/XmlRpcResponseDeserializer.cs
diff options
context:
space:
mode:
authorMW2007-04-25 18:12:06 +0000
committerMW2007-04-25 18:12:06 +0000
commit9ed0a8dbad121b64ca8baca78f28ca58602c47ca (patch)
tree5c0008e0be59cb7ccaaf8ff1b0ea2f272a0548e6 /XmlRpcCS/XmlRpcResponseDeserializer.cs
parentCan now use the xml config file for setting up things like sandbox mode, logi... (diff)
downloadopensim-SC-9ed0a8dbad121b64ca8baca78f28ca58602c47ca.zip
opensim-SC-9ed0a8dbad121b64ca8baca78f28ca58602c47ca.tar.gz
opensim-SC-9ed0a8dbad121b64ca8baca78f28ca58602c47ca.tar.bz2
opensim-SC-9ed0a8dbad121b64ca8baca78f28ca58602c47ca.tar.xz
updated to use lastest version of libsl but is currently broke when using SL viewer 1.15.02, due to big changes in the message templates.
Diffstat (limited to 'XmlRpcCS/XmlRpcResponseDeserializer.cs')
-rw-r--r--XmlRpcCS/XmlRpcResponseDeserializer.cs65
1 files changed, 65 insertions, 0 deletions
diff --git a/XmlRpcCS/XmlRpcResponseDeserializer.cs b/XmlRpcCS/XmlRpcResponseDeserializer.cs
new file mode 100644
index 0000000..032d8a3
--- /dev/null
+++ b/XmlRpcCS/XmlRpcResponseDeserializer.cs
@@ -0,0 +1,65 @@
1namespace Nwc.XmlRpc
2{
3 using System;
4 using System.Collections;
5 using System.IO;
6 using System.Xml;
7
8 /// <summary>Class to deserialize XML data representing a response.</summary>
9 public class XmlRpcResponseDeserializer : XmlRpcDeserializer
10 {
11 static private XmlRpcResponseDeserializer _singleton;
12 /// <summary>A static singleton instance of this deserializer.</summary>
13 [Obsolete("This object is now thread safe, just use an instance.", false)]
14 static public XmlRpcResponseDeserializer Singleton
15 {
16 get
17 {
18 if (_singleton == null)
19 _singleton = new XmlRpcResponseDeserializer();
20
21 return _singleton;
22 }
23 }
24
25 /// <summary>Static method that parses XML data into a response using the Singleton.</summary>
26 /// <param name="xmlData"><c>StreamReader</c> containing an XML-RPC response.</param>
27 /// <returns><c>XmlRpcResponse</c> object resulting from the parse.</returns>
28 override public Object Deserialize(TextReader xmlData)
29 {
30 XmlTextReader reader = new XmlTextReader(xmlData);
31 XmlRpcResponse response = new XmlRpcResponse();
32 bool done = false;
33
34 lock (this)
35 {
36 Reset();
37
38 while (!done && reader.Read())
39 {
40 DeserializeNode(reader); // Parent parse...
41 switch (reader.NodeType)
42 {
43 case XmlNodeType.EndElement:
44 switch (reader.Name)
45 {
46 case FAULT:
47 response.Value = _value;
48 response.IsFault = true;
49 break;
50 case PARAM:
51 response.Value = _value;
52 _value = null;
53 _text = null;
54 break;
55 }
56 break;
57 default:
58 break;
59 }
60 }
61 }
62 return response;
63 }
64 }
65}