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)
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)
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)
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)