示例#1
0
文件: ows.py 项目: CowanSM/owslib
    def __init__(self, element, ows_version='1.0.0'):
        self._root = element
        global _ows_version
        _ows_version = ows_version

        self.operations = {}

        # There can be parent parameters and constraints

        parameters = []
        for parameter in self._root.findall(ns_ows('ows:Parameter')):
            parameters.append((testXMLAttribute(parameter,'name'), {'values': [i.text for i in parameter.findall(ns_ows('.//ows:Value'))]}))
        parameters = dict(parameters)

        constraints = []
        for constraint in self._root.findall(ns_ows('ows:Constraint')):
            constraints.append((testXMLAttribute(constraint,'name'), {'values': [i.text for i in constraint.findall(ns_ows('.//ows:Value'))]}))
        constraints = dict(constraints)

        for op in self._root.findall(ns_ows('ows:Operation')):
            co = Operation(op, ows_version)
            # Parent objects get overriden by children elements
            co.parameters = dict_union(parameters, co.parameters)
            co.constraints = dict_union(constraints, co.constraints)
            self.operations[co.name] = co

        for parameter in elem.findall(util.nspath('Parameter', namespace)):
            if namespace == OWS_NAMESPACE_1_1_0:
                parameters.append((parameter.attrib['name'], {'values': [i.text for i in parameter.findall(util.nspath('AllowedValues/Value', namespace))]}))
            else:
                parameters.append((parameter.attrib['name'], {'values': [i.text for i in parameter.findall(util.nspath('Value', namespace))]}))
        self.parameters = dict(parameters)
示例#2
0
文件: ows.py 项目: percious/owslib
    def __init__(self, element, namespace=None):
        self._root = element

        self.operations = {}

        # There can be parent parameters and constraints

        parameters = []
        for parameter in self._root.findall(nsp('Parameter', namespace)):
            parameters.append((testXMLAttribute(parameter,'name'), {'values': [i.text for i in parameter.findall('.//' + nsp('Value', namespace))]}))
        parameters = dict(parameters)

        constraints = []
        for constraint in self._root.findall(nsp('Constraint', namespace)):
            constraints.append((testXMLAttribute(constraint,'name'), {'values': [i.text for i in constraint.findall('.//' + nsp('Value', namespace))]}))
        constraints = dict(constraints)

        for op in self._root.findall(nsp('Operation', namespace)):
            co = Operation(op, namespace)
            # Parent objects get overriden by children elements
            co.parameters = dict_union(parameters, co.parameters)
            co.constraints = dict_union(constraints, co.constraints)
            self.operations[co.name] = co