phax / ph-schematron

Java Schematron library that supports XSLT and native application
Apache License 2.0
116 stars 36 forks source link

Echo all error levels #71

Closed stefan-jung closed 5 years ago

stefan-jung commented 6 years ago

Hi,

It seems, that [warning] messages are not echoed. I'm using the engine pure with Apache Ant. I'd expect, that all fatals, errors, warnings and infos are reported as [error].

[schematron] 2 Schematron errors for XML file '/tmp/temp20180930130010635/be423729cc97c0bdf090b1ee78853eaaa7f0c569.dita'
[schematron]   [error] in /topic/title @ /tmp/temp20180930130010635/be423729cc97c0bdf090b1ee78853eaaa7f0c569.dita [image-in-title] Bold formatting in <title> is not allowed.
[schematron]   [error] in /topic/title @ /tmp/temp20180930130010635/be423729cc97c0bdf090b1ee78853eaaa7f0c569.dita [image-in-title] <image> in <title> is not allowed.

-schematron-validate-topics:
[schematron] Validating XML file '/tmp/temp20180930130010635/e7a801267f137d98e591604ff067559ba6637cc8.dita' against Schematron rules from 'termchecker.sch' expecting success
[schematron] XML file '/tmp/temp20180930130010635/e7a801267f137d98e591604ff067559ba6637cc8.dita' was validated against Schematron '/home/stefan/workspace/schematron-presentation/rules/termchecker.sch' and matches the rules - only 1 Schematron warning are contained

Could you please implement that?

Greetings, Stefan

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

phax commented 5 years ago

~@xephon2 I'm closing this in favour of https://github.com/phax/ph-schematron/issues/50 (see my last comment there)~

Sorry, the previous comment was crap. Nevertheless it is fixed in 5.0.11 release.

nkutsche commented 5 years ago

Hey,

are you sure, this was fixed correctly?

My result for ph-schematron-ant-task-5.0.8-jar-with-dependencies.jar was:

Buildfile: C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\build.xml

db.common.validation.schematron:
[schematron] Successfully parsed Schematron file 'C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\test.sch'
[schematron] Validating XML file 'C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\test.xml' against Schematron rules from 'test.sch' expecting success
[schematron] [main] INFO com.helger.jaxb.JAXBContextCache - Creating JAXB context for package org.oclc.purl.dsdl.svrl using ClassLoader sun.misc.Launcher$AppClassLoader@5c647e05

BUILD FAILED
C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\build.xml:19: 1 Schematron error for XML file 'C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\test.xml'
  [error] in /foo @ C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\test.xml foo should contain bar.

Total time: 2 seconds

With ph-schematron-ant-task-5.1.0-jar-with-dependencies.jar I'm getting now this:

Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.0_211\lib\tools.jar
Buildfile: C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\build.xml

db.common.validation.schematron:
[schematron] Successfully parsed Schematron file 'C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\test.sch'
[schematron] Validating XML file 'C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\test.xml' against Schematron rules from 'test.sch' expecting success
[schematron] [main] INFO com.helger.jaxb.JAXBContextCache - Creating JAXB context for package org.oclc.purl.dsdl.svrl using ClassLoader sun.misc.Launcher$AppClassLoader@5c647e05

BUILD FAILED
C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\build.xml:19: 1 Schematron error for XML file 'C:\Users\Nico\Desktop\tests\ant\schematron\ph-schematron-usage\test.xml'

Total time: 2 seconds

So the log is gone (or only in my case?). Do I have to change something in ant?

Btw, this is my ant script:

<project basedir="." name="ph-schematron test" default="db.common.validation.schematron">

    <taskdef name="schematron" classname="com.helger.schematron.ant.Schematron">
        <classpath>
            <fileset dir="lib">
                <include name="*.jar"/>
            </fileset>
        </classpath>
    </taskdef>

    <target name="db.common.validation.schematron">
        <schematron schematronFile="test.sch" expectSuccess="true" failonerror="true">
            <file file="test.xml"/>
        </schematron>
    </target>

</project>

Background infos:

phax commented 5 years ago

You are right - my bad :( 5.1.1 is on it's way.

nkutsche commented 5 years ago

Great, now it works. Thanks for the really fast reaction!