public Dimension(XElement el, string ns) { var att = el.Attribute("name"); if (att == null) { throw WmsParsingException.AttributeNotFound("name"); } Name = att.Value; att = el.Attribute("units"); if (att == null) { throw WmsParsingException.AttributeNotFound("units"); } Units = att.Value; att = el.Attribute("unitSymbol"); UnitSymbol = att != null ? att.Value : string.Empty; att = el.Attribute("default"); Default = att != null ? att.Value : string.Empty; att = el.Attribute("multipleValues"); if (att == null) { MultipleValues = null; } else { MultipleValues = att.Value == "1"; } att = el.Attribute("nearestValue"); if (att == null) { NearestValue = null; } else { NearestValue = att.Value == "1"; } att = el.Attribute("current"); if (att == null) { Current = null; } else { Current = att.Value == "1"; } Value = el.Value; }
public WmsCapabilities(XDocument doc) : this() { if (doc.Root != null && doc.Root.Name == "ServiceExceptionReport") { ServiceExceptionReport = new ServiceExceptionReport(doc.Root, ""); return; } var node = doc.Element(XName.Get("WMT_MS_Capabilities")); if (node == null) node = doc.Element(XName.Get("WMS_Capabilities")); if (node == null) { // try load root node with xmlns="http://www.opengis.net/wms" node = doc.Element(XName.Get("WMS_Capabilities", "http://www.opengis.net/wms")); if (node == null) { throw WmsParsingException.ElementNotFound("WMS_Capabilities or WMT_MS_Capabilities"); } } var att = node.Attribute(XName.Get("version")); if (att == null) throw WmsParsingException.AttributeNotFound("version"); Version = new WmsVersion(att.Value); var @namespace = Version.Version == WmsVersionEnum.Version_1_3_0 ? "http://www.opengis.net/wms" : string.Empty; XmlObject.Namespace = @namespace; att = node.Attribute("updateSequence"); if (att != null) UpdateSequence = int.Parse(att.Value, NumberFormatInfo.InvariantInfo); var element = node.Element(XName.Get("Service", @namespace)); if (element == null) { XmlObject.Namespace = @namespace = string.Empty; element = node.Element(XName.Get("Service", @namespace)); } if (element == null) throw WmsParsingException.ElementNotFound("Service"); Service = new Service(element, @namespace); element = node.Element(XName.Get("Capability", @namespace)); if (element == null) throw WmsParsingException.ElementNotFound("Capability"); Capability = new Capability(element, @namespace); }
// ReSharper disable once UnusedParameter.Local public BoundingBox(XElement node, string ns) { var att = node.Attribute(XName.Get("CRS")) ?? node.Attribute(XName.Get("crs")) ?? node.Attribute(XName.Get("SRS")) ?? node.Attribute(XName.Get("srs")); if (att != null) { CRS = att.Value; } else { throw WmsParsingException.AttributeNotFound("CRS/SRS"); } att = node.Attribute(XName.Get("minx")); if (att == null) { throw WmsParsingException.AttributeNotFound("minx"); } MinX = double.Parse(att.Value, NumberFormatInfo.InvariantInfo); att = node.Attribute(XName.Get("maxx")); if (att == null) { throw WmsParsingException.AttributeNotFound("maxx"); } MaxX = double.Parse(att.Value, NumberFormatInfo.InvariantInfo); att = node.Attribute(XName.Get("miny")); if (att == null) { throw WmsParsingException.AttributeNotFound("miny"); } MinY = double.Parse(att.Value, NumberFormatInfo.InvariantInfo); att = node.Attribute(XName.Get("maxy")); if (att == null) { throw WmsParsingException.AttributeNotFound("maxy"); } MaxY = double.Parse(att.Value, NumberFormatInfo.InvariantInfo); att = node.Attribute(XName.Get("resx")); if (att != null) { ResX = double.Parse(att.Value, NumberFormatInfo.InvariantInfo); } att = node.Attribute(XName.Get("resy")); if (att != null) { ResY = double.Parse(att.Value, NumberFormatInfo.InvariantInfo); } }
public AuthorityURL(XElement node, string @namespace) { var att = node.Attribute("name"); if (att == null) { throw WmsParsingException.AttributeNotFound("name"); } Name = att.Value; var element = node.Element(XName.Get("OnlineResource", @namespace)); if (element != null) { OnlineResource = new OnlineResource(element, @namespace); } }
public MetadataURL(XElement node, string @namespace) { var att = node.Attribute("type"); if (att == null) { throw WmsParsingException.AttributeNotFound("type"); } Type = att.Value; var element = node.Element(XName.Get("Format", @namespace)); Format = element == null ? "png" : element.Value; element = node.Element(XName.Get("OnlineResource", @namespace)); if (element != null) { OnlineResource = new OnlineResource(element, @namespace); } }