From: <bo...@us...> - 2014-12-09 16:56:10
|
Revision: 569 http://sourceforge.net/p/xmlunit/code/569 Author: bodewig Date: 2014-12-09 16:56:07 +0000 (Tue, 09 Dec 2014) Log Message: ----------- Bug#64 - validator ignores schameLocation - actually this is by JAXP's design Modified Paths: -------------- branches/xmlunit-1.x/src/java/org/custommonkey/xmlunit/jaxp13/Validator.java branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/jaxp13/test_Validator.java Added Paths: ----------- branches/xmlunit-1.x/tests/etc/BookXsdGeneratedWithFixedSchemaLocation.xml Modified: branches/xmlunit-1.x/src/java/org/custommonkey/xmlunit/jaxp13/Validator.java =================================================================== --- branches/xmlunit-1.x/src/java/org/custommonkey/xmlunit/jaxp13/Validator.java 2014-12-05 13:41:11 UTC (rev 568) +++ branches/xmlunit-1.x/src/java/org/custommonkey/xmlunit/jaxp13/Validator.java 2014-12-09 16:56:07 UTC (rev 569) @@ -199,8 +199,10 @@ : SchemaFactory.newInstance(schemaLanguage); fac.setErrorHandler(h); try { - return fac.newSchema((Source[]) - sources.toArray(new Source[sources.size()])); + return sources.size() > 0 + ? fac.newSchema((Source[]) + sources.toArray(new Source[sources.size()])) + : fac.newSchema(); } finally { fac.setErrorHandler(null); } Copied: branches/xmlunit-1.x/tests/etc/BookXsdGeneratedWithFixedSchemaLocation.xml (from rev 543, branches/xmlunit-1.x/tests/etc/BookXsdGenerated.xml) =================================================================== --- branches/xmlunit-1.x/tests/etc/BookXsdGeneratedWithFixedSchemaLocation.xml (rev 0) +++ branches/xmlunit-1.x/tests/etc/BookXsdGeneratedWithFixedSchemaLocation.xml 2014-12-09 16:56:07 UTC (rev 569) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Book xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" xmlns="http://www.publishing.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.publishing.org Book.xsd"> + <Title>Chicken Soup for the Soul</Title> + <Author>Jack Canfield</Author> + <Author>Mark Victor Hansen</Author> + <Date>1993</Date> + <ISBN>1-55874-262-X</ISBN> + <Publisher>Health Communications, Inc.</Publisher> +</Book> Modified: branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/jaxp13/test_Validator.java =================================================================== --- branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/jaxp13/test_Validator.java 2014-12-05 13:41:11 UTC (rev 568) +++ branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/jaxp13/test_Validator.java 2014-12-09 16:56:07 UTC (rev 569) @@ -104,6 +104,14 @@ assertTrue(v.isInstanceValid(s)); } + public void testGoodInstanceIsValidNoSchemaSource() throws Exception { + Validator v = new Validator(); + StreamSource s = + new StreamSource(new File(test_Constants.BASEDIR + + "/tests/etc/BookXsdGeneratedWithFixedSchemaLocation.xml")); + assertTrue(v.isInstanceValid(s)); + } + public void testBadInstanceIsInvalid() throws Exception { Validator v = new Validator(); v.addSchemaSource(new StreamSource(new File(test_Constants.BASEDIR This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |