schxslt / schxslt-java

Java classes for Schematron validation with SchXslt
MIT License
6 stars 4 forks source link

error when validating #51

Open eduarddrenth opened 3 years ago

eduarddrenth commented 3 years ago

I am struggling with this error:

Error 
   Error reported by XML parser processing
  jar:file:/home/eduard/.m2/repository/name/dmaus/schxslt/java/2.0.4/java-2.0.4.jar!/name/dmaus/schxslt/: Premature end of file.: Premature end of file.

schematron is loaded from jar, perhaps related to #4

Did not pinpoint the problem yet

eduarddrenth commented 3 years ago

Written this junit test for it:

    @Test
    public void testValidation() throws IOException, SchematronException {
        String xml = new String(Files.readAllBytes(new File("src/test/resources/achter.xml").toPath()));
        String xmlnok = new String(Files.readAllBytes(new File("src/test/resources/fout.xml").toPath()));

        Schematron schematron = Schematron.newInstance(new SAXSource(new InputSource(
                SchematronHelper.class.getResourceAsStream("/schematron/tei_dictionaries.sch"))));

        Result result = schematron.validate(new SAXSource(new InputSource(new StringReader(xml))));
        if (!result.isValid()) {
            Assert.fail("should be valid: " + result.getValidationMessages().toString());
        }

        result = schematron.validate(new SAXSource(new InputSource(new StringReader(xmlnok))));
        if (result.isValid()) {
            Assert.fail("should not be valid");
        }
    }
eduarddrenth commented 3 years ago

does not matter to load schematron from filesystem. It could be (not) inherited maven dependencies causing the lib with the xslt not being included => NO, THAT"S NOT IT

eduarddrenth commented 3 years ago

Test runs fine on master branch

eduarddrenth commented 3 years ago

Test runs fine in 204 branche as well. Must be something with the way I depend on schxslt from my own project

eduarddrenth commented 3 years ago

Validation succeeds, error message remains but does not influence validation.

Perhaps something in the xslt's and the way saxonica pick that up leads to Premature end of file

dmj commented 3 years ago

Are you using a custom URI resolver?

eduarddrenth commented 3 years ago

no, and #resolve isn't called, checked that in debugging