def _get_xml(self): if self._dom is None: try: self._dom = xpath.domify(self._xml) except Exception, e: print self._xml print str(e) raise e
def _get_xml(self): if self._dom is None: try : self._dom = xpath.domify(self._xml) except Exception, e: print self._xml print str(e) raise e
def parse(self, xml, namespace): matches = xpath.find_all(xml, self.xpath, namespace) if not BaseField in self.field_type.__bases__: results = [self.field_type(xml=match) for match in matches] else: field = self.field_type(xpath = '.') results = [field.parse(xpath.domify(match), namespace) for match in matches] if self.order_by: results.sort(lambda a,b : cmp(getattr(a, self.order_by), getattr(b, self.order_by))) return results
def parse(self, xml, namespace): matches = xpath.find_all(xml, self.xpath, namespace) if not BaseField in self.field_type.__bases__: results = [self.field_type(xml=match) for match in matches] else: field = self.field_type(xpath='.') results = [ field.parse(xpath.domify(match), namespace) for match in matches ] if self.order_by: results.sort(lambda a, b: cmp(getattr(a, self.order_by), getattr(b, self.order_by))) return results