Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Use parser that strips whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Graves committed Oct 26, 2015
1 parent 7bbbfb9 commit ba2cd88
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions magma/upload.py
Expand Up @@ -35,9 +35,12 @@ def data_type(self):
return ("Vector", ogr.GeometryTypeToName(self.layer.GetGeomType()))


parser = etree.XMLParser(remove_blank_text=True)


class FGDC(object):
def __init__(self, file):
self.doc = etree.parse(file)
self.doc = etree.parse(file, parser=parser)
self.root = self.doc.getroot()

def write(self):
Expand Down Expand Up @@ -80,16 +83,16 @@ def set_name(self, name):
return self

def set_distribution(self):
distinfo = etree.XML(_distribution_info)
distinfo = etree.XML(_distribution_info, parser=parser)
distrib = etree.SubElement(distinfo, 'distrib')
distrib.append(etree.XML(_contact_info))
distrib.append(etree.XML(_contact_info, parser=parser))
self.root.append(distinfo)
return self

def set_metadata_contact(self):
metc = self._get_path('metainfo/metc')
if metc.find('cntinfo') is None:
metc.append(etree.XML(_contact_info))
metc.append(etree.XML(_contact_info, parser=parser))
return self

def _get_path(self, path):
Expand Down

0 comments on commit ba2cd88

Please sign in to comment.