// Converts the XML response into a JToken public static JToken GetFileListResultFromResponseXml(string applicationResponseXml) { var document = new XmlDocument(); document.LoadXml(applicationResponseXml); // Only the FileDescriptor element is of interest. The rest is metadata. var nodeList = document.GetElementsByTagName("FileDescriptor").Cast <XmlNode>().ToList(); using (var writer = new JTokenWriter()) { writer.Formatting = Newtonsoft.Json.Formatting.Indented; writer.Culture = CultureInfo.InvariantCulture; writer.WriteStartArray(); foreach (var node in nodeList) { writer.WriteOPFileInfo(node); } writer.WriteEndArray(); return(writer.Token); } }
public static JToken GetFileInfoFromResponseXml(string applicationResponseXml) { var document = new XmlDocument(); document.LoadXml(applicationResponseXml); // Only the FileDescriptor element is of interest. The rest is metadata. var fileDescription = document.GetElementsByTagName("FileDescriptor").Cast <XmlNode>().FirstOrDefault(); using (var writer = new JTokenWriter()) { writer.Formatting = Newtonsoft.Json.Formatting.Indented; writer.Culture = CultureInfo.InvariantCulture; writer.WriteOPFileInfo(fileDescription); return(writer.Token); } }