/// <summary> /// GetServices /// </summary> /// <param name="filter"></param> /// <returns></returns> public XmlDocument GetServices(string filter) { GetServices services = NewServicesObject(filter); GenericXmlType data = _requestor.GetServices(services); return(GetXmlDoc(data)); }
private XmlDocument GetXmlDoc(GenericXmlType data) { if ((data.Any != null) && (data.Any.Length > 0)) { XmlTextReader reader = null; if (data.format == DocumentFormatType.ZIP) { byte[] bytes = Convert.FromBase64String(data.Any[0].InnerText); bytes = _compressionHelper.Uncompress(bytes); reader = new XmlTextReader(new MemoryStream(bytes)); } else { reader = new XmlTextReader(new StringReader(data.Any[0].OuterXml)); } XmlDocument xmlDoc = new XmlDocument(); using (reader) { xmlDoc.Load(reader); } return(xmlDoc); } else { return(null); } }
private byte[] GetUncompressedBytes(GenericXmlType data) { switch (data.format) { case DocumentFormatType.ZIP: { byte[] bytes = Convert.FromBase64String(data.Any[0].Value); bytes = _compressionHelper.Uncompress(bytes); return(bytes); } default: { string xmlString = data.Any[0].OuterXml; byte[] bytes = StringUtils.UTF8.GetBytes(xmlString); return(bytes); /* * byte[] bytes = StringUtils.UTF8.GetBytes(xmlString); #if DEBUG * try { File.WriteAllBytes(@"C:\Temp.xml", bytes); } catch(Exception) { } #endif // DEBUG * return bytes; */ } } }
private byte[] GetRawBytes(GenericXmlType data) { switch (data.format) { case DocumentFormatType.ZIP: { byte[] bytes = Convert.FromBase64String(data.Any[0].Value); return(bytes); } default: { string xmlString = data.Any[0].OuterXml; byte[] bytes = StringUtils.UTF8.GetBytes(xmlString); return(bytes); } } }
private string GetXmlString(GenericXmlType data) { if ((data.Any != null) && (data.Any.Length > 0)) { if (data.format == DocumentFormatType.ZIP) { byte[] bytes = Convert.FromBase64String(data.Any[0].InnerText); bytes = _compressionHelper.Uncompress(bytes); return(StringUtils.UTF8.GetString(bytes)); } else { return(data.Any[0].OuterXml); } } else { return(null); } }