Esempio n. 1
0
 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
Esempio n. 2
0
 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
Esempio n. 3
0
    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
Esempio n. 4
0
    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