Exemple #1
0
 def testValidate(self):
     validDoc=XmlTreeDoc(self.good_xml)
     invalidDoc=XmlTreeDoc(self.bad_xml)
     schema=XmlSchema(self.test_schema)
     # if valid, no exception is raised
     schema.validate(validDoc)
     self.assertRaises(InvalidObjectError, schema.validate, invalidDoc)
Exemple #2
0
 def testValidate(self):
     validDoc = XmlTreeDoc(self.good_xml)
     invalidDoc = XmlTreeDoc(self.bad_xml)
     schema = XmlSchema(self.test_schema)
     # if valid, no exception is raised
     schema.validate(validDoc)
     self.assertRaises(InvalidObjectError, schema.validate, invalidDoc)
Exemple #3
0
class Schema(DocBase):
    db_table = schema_tab

    def __init__(self, *args, **kwargs):
        DocBase.__init__(self, *args, **kwargs)
        self._parsed_doc = None

    def validate(self, resource):
        if not self._parsed_doc:
            self._parsed_doc = XmlSchema(self.resource.document.data,
                                         self._type)
        self._parsed_doc.validate(resource.document.xml_doc)
Exemple #4
0
 def validate(self, resource):
     if not self._parsed_doc:
         self._parsed_doc = XmlSchema(self.resource.document.data,
                                      self._type)
     self._parsed_doc.validate(resource.document.xml_doc)