Here are the examples of the python api scrapi.base.helpers.xml_text_only taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Example 1
Project: scrapi Source File: noaa_nodc.py
def parse_contributors(parties):
'''Turn list of gmd:CI_ResponsibleParty elements into
SHARE-compliant contributors list
'''
# The NODC schema doesn't explicitly distinguish between
# organizations and individuals. Every party has an
# organizationName tag, individuals have an individualName tag as well.
contributors = []
for party in parties:
contributor = {}
individual = extract_individual(party)
organization = extract_organization(party)
if individual:
contributor = individual
if organization:
contributor['affiliation'] = [organization]
elif organization:
contributor = organization
# the email address is tied to the party, so wait until we know
# who the contributor is before extracting
email = party.xpath('./gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress', namespaces=party.nsmap)
if email:
contributor['email'] = xml_text_only(email[0])
contributors.append(contributor)
return contributors