def get_transfer_options(self): result = [] OnlineResource = collections.namedtuple('OnlineResource', [ 'url', 'protocol', 'app_profile', 'name', 'desc', 'function', 'transfer_size' ]) for transferOption in self.tree.findall( './gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions', namespaces): transferSizeNode = transferOption.find( './gmd:transferSize/gco:Real', namespaces) transferSize = None if transferSizeNode is not None and transferSizeNode.text != '': try: transferSize = float(transferSizeNode.text) except: pass for online in transferOption.findall( './gmd:onLine/gmd:CI_OnlineResource', namespaces): protocol = getTextFromXMLNode(online, './gmd:protocol/', namespaces) name = getTextFromXMLNode(online, './gmd:name/', namespaces) url = getTextFromXMLNode(online, './gmd:linkage/', namespaces) desc = getTextFromXMLNode(online, './gmd:description/', namespaces) app_profile = getTextFromXMLNode(online, './gmd:applicationProfile/', namespaces) functionNode = online.find( './gmd:function/gmd:CI_OnLineFunctionCode', namespaces) if functionNode is not None: function = functionNode.get('codeListValue', '') else: function = '' onlineObj = OnlineResource(url, protocol, app_profile, name, desc, function, transferSize) result.append(onlineObj) return result
def get_crs(self): return getTextFromXMLNode( self.tree, './gmd:referenceSystemInfo/gmd:MD_ReferenceSystem/gmd:referenceSystemIdentifier/gmd:RS_Identifier/gmd:code/', namespaces)
def get_abstract(self): return getTextFromXMLNode( self.tree, './gmd:identificationInfo/gmd:MD_DataIdentification/gmd:abstract/', namespaces)
def get_identifier(self): return getTextFromXMLNode(self.tree, './gmd:fileIdentifier/', namespaces)
def get_title(self): return getTextFromXMLNode( self.tree, './gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title/', namespaces)