[Kernow] Return value of SchemaValidator.validateDirectory()
Brought to you by:
ajwelch
From: Florent G. <dar...@ya...> - 2007-08-01 17:17:33
|
Hi I wonder whats exactly should return validateDirectory() on SchemaValidator. As it returns a boolean, I would expect it returns false if the schema itself is not valid, or if one document it attempts to validate is not valid. But it seems to always return true, if I understand correctly. Is it on purpose? I've update the unit tests for SchemaValidator and the two following tests I've just added fail (xml/invalid/ contains two invalid documents, and xml/partially-valid/ contains one valid and one invalid documents): /** * Test validateDirectory() with invalid input and valid schema. */ public void testValidateDirectoryInvalid() { System.out.println("testValidateDirectoryInvalid"); String xmlDirPath = "test/xml/invalid"; String schemaPath = "test/xsd/videos.xsd"; File input = new File(xmlDirPath); Source schema = new StreamSource(new File(schemaPath)); assertFalse(new SchemaValidator().validateDirectory(input, schema)); } /** * Test validateDirectory() with partially valid input and valid schema. */ public void testValidateDirectoryPartiallyValid() { System.out.println("testValidateDirectoryPartiallyValid"); String xmlDirPath = "test/xml/partially-valid"; String schemaPath = "test/xsd/videos.xsd"; File input = new File(xmlDirPath); Source schema = new StreamSource(new File(schemaPath)); assertFalse(new SchemaValidator().validateDirectory(input, schema)); } Regards, --drkm _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail |