Ejemplo n.º 1
0
        public Request(XElement node, string @namespace)
        {
            foreach (var element in node.Elements())
            {
                switch (element.Name.LocalName)
                {
                    case "GetCapabilities":
                        GetCapabilities = new OperationType(element, @namespace);
                        break;
                    case "GetMap":
                        GetMap = new OperationType(element, @namespace);
                        break;
                    case "GetFeatureInfo":
                        GetFeatureInfo = new OperationType(element, @namespace);
                        break;
                    default:
                        ExtendedOperation.Add(element.Name.LocalName, new OperationType(element, @namespace));
                        break;
                }
            }

            if (GetCapabilities == null)
                throw WmsParsingException.ElementNotFound("GetCapabilities");

            if (GetMap == null)
                throw WmsParsingException.ElementNotFound("GetMap");
        }
Ejemplo n.º 2
0
        public override void ReadXml(XmlReader reader)
        {
  
            reader.MoveToContent();
            if (reader.IsEmptyElement)
            {
                reader.Read();
                return;
            }

            while (!reader.EOF)
            {
                if (reader.IsStartElement())
                {
                    switch (reader.LocalName)
                    {
                        case "GetCapabilities":
                            _getCapabilitiesField = new OperationType();
                            _getCapabilitiesField.ReadXml(reader);
                            break;
                        case "GetMap":
                            _getMapField = new OperationType();
                            _getMapField.ReadXml(reader);
                            break;
                        case "GetFeatureInfo":
                            _getFeatureInfoField = new OperationType();
                            _getFeatureInfoField.ReadXml(reader);
                            break;

                        default:
                            var name = XName.Get(reader.LocalName, reader.NamespaceURI);
                            var operation = new OperationType();
                            operation.ReadXml(reader);
                            ExtendedOperation.Add(name, operation);
                            break;
                    }
                }
                else
                {
                    reader.Read();
                }
            }
        }