Exemplo n.º 1
0
        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("c2b: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.WriteNordeaFileInfo(node);
                }

                writer.WriteEndArray();

                return(writer.Token);
            }
        }