def parse_xml(self, xml): ret = list() for address in xml.findall('.//AddressValidationResult'): inner_address = address.find('.//Address') info = xmltodict(address) info.update(xmltodict(inner_address)) ret.append(info) return ret
def parse_xml(self, xml): ret = dict() ret['ambiguous'] = xml.find('.//AmbiguousAddressIndicator') is not None ret['valid'] = xml.find('.//ValidAddressIndicator') is not None ret['no_candidates'] = xml.find('.//NoCandidatesIndicator') is not None ret['classification'] = xmltodict(xml.find('.//AddressClassification')) ret['addresses'] = list() for item in xml.findall('.//AddressKeyFormat'): address = xmltodict(item) address['classification'] = xmltodict(item.find('.//AddressClassification')) ret['addresses'].append(address) return ret
def parse_xml(self, xml): ret = dict() ret['ambiguous'] = xml.find('.//AmbiguousAddressIndicator') is not None ret['valid'] = xml.find('.//ValidAddressIndicator') is not None ret['no_candidates'] = xml.find('.//NoCandidatesIndicator') is not None ret['classification'] = xmltodict(xml.find('.//AddressClassification')) ret['addresses'] = list() for item in xml.findall('.//AddressKeyFormat'): address = xmltodict(item) address['classification'] = xmltodict( item.find('.//AddressClassification')) ret['addresses'].append(address) return ret
def parse_xml(self, xml): ret = dict() ret['ShipmentCharges'] = xmltodict(xml.find('.//ShipmentCharges')) ret['BillingWeight'] = Decimal(xml.find('.//BilllingWeight/Weight').text) ret['ShipmentIdentificationNumber'] = xml.find('.//ShipmentIdentificationNumber').text ret['ShipmentDigest'] = xml.find('.//ShipmentDigest').text return ret