Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, md):
"""constructor"""
_GenericObject.__init__(self, md)
self.extent_type_code = util.testXMLValue(md.find(util.nspath_eval('gm03:extentTypeCode', namespaces)))
self.north_bound_latitude = util.testXMLValue(md.find(util.nspath_eval('gm03:northBoundLatitude', namespaces)))
self.south_bound_latitude = util.testXMLValue(md.find(util.nspath_eval('gm03:southBoundLatitude', namespaces)))
self.east_bound_longitude = util.testXMLValue(md.find(util.nspath_eval('gm03:eastBoundLongitude', namespaces)))
self.west_bound_longitude = util.testXMLValue(md.find(util.nspath_eval('gm03:westBoundLongitude', namespaces)))
self.address = util.testXMLValue(val)
val = md.find('cntinfo/cntaddr/city')
self.city = util.testXMLValue(val)
val = md.find('cntinfo/cntaddr/state')
self.state = util.testXMLValue(val)
val = md.find('cntinfo/cntaddr/postal')
self.postal = util.testXMLValue(val)
val = md.find('cntinfo/cntaddr/country')
self.country = util.testXMLValue(val)
val = md.find('cntinfo/cntvoice')
self.voice = util.testXMLValue(val)
val = md.find('cntinfo/cntemail')
self.email = util.testXMLValue(val)
def parse_contactinformation(self):
try:
xml_dict = _xml_to_dict(self._root)
self.name = xml_dict.get('contact_name')
self.type = xml_dict.get('type_of_contact')
self.email = [testXMLValue(email) for email in self._findall('email')]
self.phone = [testXMLValue(phone) for phone in self._findall('phone')]
self.address = [testXMLValue(address) for address in self._findall('address')]
except:
raise
# UTF-8
# NONE
#
#
complex_data_element = element.find(complexDataElementName)
if complex_data_element is not None:
self.dataType = "ComplexData"
for supported_comlexdata_element in\
complex_data_element.findall('SupportedComplexData'):
self.supportedValues.append(
ComplexData(
mimeType=testXMLValue(
supported_comlexdata_element.find('Format')),
encoding=testXMLValue(
supported_comlexdata_element.find('Encoding')),
schema=testXMLValue(
supported_comlexdata_element.find('Schema'))
)
)
for format_element in\
complex_data_element.findall('Supported/Format'):
self.supportedValues.append(
ComplexData(
mimeType=testXMLValue(format_element.find('MimeType')),
encoding=testXMLValue(format_element.find('Encoding')),
schema=testXMLValue(format_element.find('Schema'))
)
)
def __init__(self, md):
val = md.find(util.nspath_eval('dif:Type', namespaces))
self.type = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:SubType', namespaces))
self.subtype = util.testXMLValue(val)
def __init__(self, element):
self.codeSpace = testXMLAttribute(element.find(nsp('sml:Term/sml:codeSpace')), nsp("xlink:href"))
self.definition = testXMLAttribute(element.find(nsp('sml:Term')), "definition")
self.value = testXMLValue(element.find(nsp('sml:Term/sml:value')))
# ftp://ftp.remotesensing.org/pub/geotiff/samples/gdal_eg/cea.txt
val = entry_node.find(util.nspath_eval('atom:id', ns))
id = util.testXMLValue(val)
# log.debug("entry :id %s :: %s", id, val)
resource_base_dict.update({"id": id})
# <title>GeoTIFF Example</title>
val = entry_node.find(util.nspath_eval('atom:title', ns))
title = util.testXMLValue(val)
# log.debug("entry: title %s :: %s", id, val)
resource_base_dict['properties'].update({"title": title})
# 2011-11-01T00:00:00Z
val = entry_node.find(util.nspath_eval('atom:updated', ns))
update_date = util.testXMLValue(val)
# log.debug("entry: updated %s :: %s", update_date, val)
resource_base_dict['properties'].update({"updated": update_date})
#
val = entry_node.find(util.nspath_eval('dc:publisher', ns))
publisher = util.testXMLValue(val)
# log.debug("entry: dc:publisher %s :: %s", publisher, val)
resource_base_dict['properties'].update({"publisher": publisher})
#
val = entry_node.find(util.nspath_eval('dc:rights', ns))
rights = util.testXMLValue(val)
# log.debug("entry: rights %s :: %s", rights, val)
resource_base_dict['properties'].update({"rights": rights})
#
for el in md.findall(util.nspath_eval('dif:Related_URL', namespaces)):
self.related_url.append(Related_URL(el))
self.parent_dif = []
for el in md.findall(util.nspath_eval('dif:Parent_DIF', namespaces)):
self.parent_dif.append(util.testXMLValue(el))
self.idn_node = []
for el in md.findall(util.nspath_eval('dif:IDN_Node', namespaces)):
self.idn_node.append(Name(el))
val = md.find(util.nspath_eval('dif:Originating_Metadata_Node', namespaces))
self.originating_metadata_node = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Metadata_Name', namespaces))
self.metadata_name = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Metadata_Version', namespaces))
self.metadata_version = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:DIF_Creation_Date', namespaces))
self.dif_creation_date = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Last_DIF_Revision_Date', namespaces))
self.last_dif_revision_date = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Future_DIF_Review_Date', namespaces))
self.future_dif_review_date = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Private', namespaces))
self.private = util.testXMLValue(val)
self.miny = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Northernmost_Latitude', namespaces))
self.maxy = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Westernmost_Latitude', namespaces))
self.minx = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Easternmost_Latitude', namespaces))
self.maxx = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Minimum_Altitude', namespaces))
self.minz = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Maximum_Altitude', namespaces))
self.maxz = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Minimum_Depth', namespaces))
self.mindepth = util.testXMLValue(val)
val = md.find(util.nspath_eval('dif:Maximum_Depth', namespaces))
self.maxdepth = util.testXMLValue(val)
def parse_contactinformation(self):
try:
xml_dict = _xml_to_dict(self._root)
self.name = xml_dict.get('contact_name')
self.type = xml_dict.get('type_of_contact')
self.email = [testXMLValue(email) for email in self._findall('email')]
self.phone = [testXMLValue(phone) for phone in self._findall('phone')]
self.address = [testXMLValue(address) for address in self._findall('address')]
except:
raise