/// <summary> /// Recursive function that will go through an xml element and store it's content /// to the form item. /// </summary> /// <param name="item">(parent) Item in form that content should be added to.</param> /// <param name="node">Node that should be parsed.</param> public void TraverseNode(IHttpInput item, XmlNode node) { // Add text node content to previous item if (node.Name == "#text") { HttpInputItem formItem = item as HttpInputItem; if (formItem != null) { formItem.Add(node.InnerText.Trim()); return; } } string name = node.Name.ToLower(); item.Add(name, node.Value); IHttpInput myItem = item[name]; if (node.Attributes != null) { foreach (XmlAttribute attribute in node.Attributes) { myItem.Add(attribute.Name.ToLower(), attribute.Value); } } foreach (XmlNode childNode in node.ChildNodes) { TraverseNode(myItem, childNode); } }
private static void Add(IHttpInput input, string name, string value) { input.Add(HttpUtility.UrlDecode(name), HttpUtility.UrlDecode(value)); }
private static void Add(IHttpInput input, string name, string value, Encoding contentEncoding) { input.Add(HttpUtility.UrlDecode(name, contentEncoding), HttpUtility.UrlDecode(value, contentEncoding)); }
/// <summary> /// Recursive function that will go through an xml element and store it's content /// to the form item. /// </summary> /// <param name="item">(parent) Item in form that content should be added to.</param> /// <param name="node">Node that should be parsed.</param> public void TraverseNode(IHttpInput item, XmlNode node) { // Add text node content to previous item if (node.Name == "#text") { HttpInputItem formItem = item as HttpInputItem; if (formItem != null) { formItem.Add(node.InnerText.Trim()); return; } } string name = node.Name.ToLower(); item.Add(name, node.Value); IHttpInput myItem = item[name]; if (node.Attributes != null) foreach (XmlAttribute attribute in node.Attributes) myItem.Add(attribute.Name.ToLower(), attribute.Value); foreach (XmlNode childNode in node.ChildNodes) TraverseNode(myItem, childNode); }