Closed stefan-jung closed 5 years ago
I followed your suggested, trimed stuff and added error handling support. But unfortunately the source XML position cannot be emitted, because it is not part of the created SVRL
Hmm... that's a pity. 😞 Should I add line support as a new enhancement issue? If you use Schematron for validating DITA-XML, so to check style guide rules, the line is absolutely mandatory to find the violating snippet.
The library used in oXygen XML is able to determine the line:
System-ID: /home/stefan/workspace/org.doctales.schematron/samples/topic-1.dita
Haupt-Validierungsdatei: /home/stefan/workspace/org.doctales.schematron/samples/topic-1.dita
Schema: /home/stefan/workspace/org.doctales.schematron/rules/topic-validation.sch
Programmname: ISO Schematron
Fehlerlevel: warning
Beschreibung: Do not use inline formatting in <title>
Anfang: 4:0
So if you're stuck somewhere and just need food for thought, maybe dropping a line to them might help. They'll surely strongly appreciate your work.
I will dig into the Locator API and see what I can do...
The log looks much better now: https://travis-ci.org/doctales/org.doctales.schematron/builds/267180664#L702
Haha - weird side effects :) I was thinking more like:
if (byte stream used) then
{
Reader
that uses the charset from step 1. and includes line counting (with the problem that the Locator is only updated AFTER something was read)Locator
(or Locator2
) based on the position of the Reader in step 2
}
-> if this helps as well - I'm happy :)
Defintiely +1 on level support: would further improve the lib usage via ANT, dramatically.
Level support is already in
Right, I can see the error level in the logs. Alluding to the original request of making builds fail only on fatal or error.
Thanks for the new release @phax!
Log levels still do not work as expected.
Schematron
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt">
<sch:pattern>
<sch:rule context="*[contains(@class, 'topic/title')]">
<sch:report test="*[contains(@class, 'hi-d/')]" role="warning">
Do not use inline formatting in <title>
</sch:report>
</sch:rule>
</sch:pattern>
</sch:schema>
This should create a warning
, but leads to an error
:
[error] in /topic/title @ /tmp/temp20180103183533704/faf922d8f51b3838f7fbdbae96dd1460d7fac5ae.dita Do not use inline formatting in <title>
See build #31
Then the build crashes and this should not happen for warnings.
Thanks for testing. I needed to get 5.0 out because of other dependencies - that's why I postponed this to 5.1 :(
I was confused by the addition of the failOnError
parameter initially, thanks for the reminder!
This is indeed required to create better reports and not have to artificially create phases.
I looked a bit into it and I'm currently only interpreting the flag
attribute but not the role
attribute. I will make a change that will take the role
attribute if the flag
attribute is not present
Excellent :smiley:
v5.0.2 SNAPSHOT 17 and later should do the trick: https://oss.sonatype.org/content/repositories/snapshots/com/helger/ph-schematron/5.0.2-SNAPSHOT/
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.
@xephon2 if you could crosscheck, it would be appreicated :)
@phax, will try to do so.
As the log shows, nothing has changed.
Thank you @xephon2 for your input.
failOnError
but nothing else. And this property applies not just to SVRL results but also to other criticial issues (e.g. IO errors). If I understand you correctly, you need something to break your build only depending on the validation output (SVRL).
The following example assumes you expect a successful validation. So if an error is in SVRL and "fail on error" is true, the build should be aborted. If The SVRL contains at least one warning and "fail on warning" is true, the build should be aborted etc. Is this assumption correct? In that case I would need to create new properties like failOnSVRLError
, failOnSVRLWarning
and failOnSVRLInfo
- does that sound reasonable?Finally fixed in 5.0.11
Unfortunately error levels are not supported, see #16. I've changed the
<report>
level towarning
, so the build should throw a warning and no error and should not fail. Builds should fail only onfatal
orerror
.Current output
It would be nice, if the output would be one line per
<report>
/<assert>
. This would make it easier to implement a log parser/filter. I'd recommend (as a replacement for the snippet above):