public Parse ( System.Xml.Linq.XDocument getCapabilitiesXmlDocument ) : |
||
getCapabilitiesXmlDocument | System.Xml.Linq.XDocument | |
return |
public WmsServiceViewModel GetLayers(string wmsUrl) { WmsServiceViewModel serviceModel = new WmsServiceViewModel(); if (!wmsUrl.EndsWith("?")) { wmsUrl = wmsUrl + "?"; } wmsUrl = wmsUrl + "service=wms&request=GetCapabilities"; XDocument xmlDocument = XDocument.Load(wmsUrl); XElement root = xmlDocument.Element(WMS + "WMS_Capabilities"); if (root != null) { WmsGetCapabilities13Parser parser = new WmsGetCapabilities13Parser(); serviceModel = parser.Parse(xmlDocument); if (serviceModel.SupportsEnglishGetCapabilities) { XDocument getCapabilitiesEnglish = XDocument.Load(wmsUrl + "&language=eng"); Dictionary<string, Dictionary<string, string>> englishInformation = parser.ParseEnglishGetCapabilities(getCapabilitiesEnglish); serviceModel.AppendEnglishInformation(englishInformation); } } else { root = xmlDocument.Element("WMT_MS_Capabilities"); if (root != null) { serviceModel = new WmsGetCapabilities11Parser().Parse(xmlDocument); } } return serviceModel; }
public WmsServiceViewModel GetLayers(string wmsUrl) { if (!string.IsNullOrWhiteSpace(wmsUrl)) { WmsServiceViewModel serviceModel = new WmsServiceViewModel(); XDocument xmlDocument = XDocument.Load(wmsUrl); XElement root = xmlDocument.Element(WMS + "WMS_Capabilities"); if (root != null) { WmsGetCapabilities13Parser parser = new WmsGetCapabilities13Parser(); serviceModel = parser.Parse(xmlDocument); if (serviceModel.SupportsEnglishGetCapabilities) { XDocument getCapabilitiesEnglish = XDocument.Load(wmsUrl + "&language=eng"); Dictionary <string, Dictionary <string, string> > englishInformation = parser.ParseEnglishGetCapabilities(getCapabilitiesEnglish); serviceModel.AppendEnglishInformation(englishInformation); } } else { root = xmlDocument.Element("WMT_MS_Capabilities"); if (root != null) { serviceModel = new WmsGetCapabilities11Parser().Parse(xmlDocument); } } return(serviceModel); } else { return(null); } }