Example #1
0
        public WmsCapabilities(XDocument doc)
            : this()
        {
            if (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"));
            }

            var att = node.Attribute(XName.Get("version"));

            if (att == null)
            {
                throw WmsParsingException.AttributeNotFound("version");
            }
            Version = new WmsVersion(att.Value);

            att = node.Attribute("updateSequence");
            if (att != null)
            {
                UpdateSequence = int.Parse(att.Value, NumberFormatInfo.InvariantInfo);
            }

            var @namespace = Version.Version == WmsVersionEnum.Version_1_3_0
                            ? "http://www.opengis.net/wms"
                            : string.Empty;

            XmlObject.Namespace = @namespace;

            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);
        }
Example #2
0
        public WmsCapabilities(XDocument doc)
            : this()
        {
            if (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"));

            var att = node.Attribute(XName.Get("version"));
            if (att == null)
                throw WmsParsingException.AttributeNotFound("version");
            Version = new WmsVersion(att.Value);

            att = node.Attribute("updateSequence");
            if (att != null)
                UpdateSequence = int.Parse(att.Value, NumberFormatInfo.InvariantInfo);

            var @namespace = Version.Version == WmsVersionEnum.Version_1_3_0
                            ? "http://www.opengis.net/wms"
                            : string.Empty;

            XmlObject.Namespace = @namespace;

            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);
        }
Example #3
0
 public WmsCapabilities(WmsVersionEnum version)
 {
     Version = new WmsVersion(version);
 }
Example #4
0
 public WmsCapabilities(string version)
 {
     Version = new WmsVersion(version);
 }
Example #5
0
 public WmsCapabilities(WmsVersionEnum version)
 {
     Version = new WmsVersion(version);
 }
Example #6
0
 public WmsCapabilities(string version)
 {
     Version = new WmsVersion(version);
 }