def __init__(self, xml_or_file=None, parser=None): """ Parser may be lxml of minidom. If you set to None then lxml will be used if installed otherwise minidom. """ self.init(xml_or_file) self.gpx = mod_gpx.GPX() self.xml_parser_type = parser
def init(self, xml_or_file): text = xml_or_file.read() if hasattr(xml_or_file, 'read') else xml_or_file self.xml = mod_utils.make_str(text) self.valid = False self.error = None self.gpx = mod_gpx.GPX()
def init(self, xml_or_file): if hasattr(xml_or_file, 'read'): self.xml = xml_or_file.read() else: if isinstance(xml_or_file, unicode): self.xml = xml_or_file.encode('utf-8') else: self.xml = str(xml_or_file) self.valid = False self.error = None self.gpx = mod_gpx.GPX()
def __init__(self, xml_or_file=None): self.init(xml_or_file) self.gpx = mod_gpx.GPX()