mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 19:36:07 +08:00
Adding the deserializer for server form/xml replies
This commit is contained in:
@@ -255,5 +255,47 @@ namespace OpenSim.Server.Base
|
||||
parent.AppendChild(elem);
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> ParseXmlResponse(string data)
|
||||
{
|
||||
Dictionary<string, object> ret = new Dictionary<string, object>();
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
doc.LoadXml(data);
|
||||
|
||||
XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse");
|
||||
|
||||
if (rootL.Count != 1)
|
||||
return ret;
|
||||
|
||||
XmlNode rootNode = rootL[0];
|
||||
|
||||
ret = ParseElement(rootNode);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static Dictionary<string, object> ParseElement(XmlNode element)
|
||||
{
|
||||
Dictionary<string, object> ret = new Dictionary<string, object>();
|
||||
|
||||
XmlNodeList partL = element.ChildNodes;
|
||||
|
||||
foreach (XmlNode part in partL)
|
||||
{
|
||||
XmlNode type = part.Attributes.GetNamedItem("Type");
|
||||
if (type == null || type.Value != "List")
|
||||
{
|
||||
ret[part.Name] = part.InnerText;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret[part.Name] = ParseElement(part);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
||||
|
||||
doc.AppendChild(xmlnode);
|
||||
|
||||
XmlElement rootElement = doc.CreateElement("", "Authentication",
|
||||
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
|
||||
"");
|
||||
|
||||
doc.AppendChild(rootElement);
|
||||
@@ -179,7 +179,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
||||
|
||||
doc.AppendChild(xmlnode);
|
||||
|
||||
XmlElement rootElement = doc.CreateElement("", "Authentication",
|
||||
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
|
||||
"");
|
||||
|
||||
doc.AppendChild(rootElement);
|
||||
@@ -201,7 +201,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
||||
|
||||
doc.AppendChild(xmlnode);
|
||||
|
||||
XmlElement rootElement = doc.CreateElement("", "Authentication",
|
||||
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
|
||||
"");
|
||||
|
||||
doc.AppendChild(rootElement);
|
||||
|
||||
Reference in New Issue
Block a user