I am trying to run probatron4j. Here is the source project
https://code.google.com/archive/p/probatron4j/downloads
I build this project using ant and I got probatron.jar in dist folder.
But when I try to verify my XML against Schematron schema this is showing
C:\Users\sukumar\Downloads\probatron4j-source-0.7.4>java -jar dist\probatron.jar xml\sample.xml sch\sample.sch Error on line 4 column 16
SXXP0003: Error reported by XML parser: Content is not allowed in prolog.
FATAL org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 16; Content is not allowed in prolog.
Exception in thread "main" java.lang.RuntimeException: Cannot instantiate XSLT transformer,
or transformation failure: org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 16; Content is not allowed in prolog.
at org.probatron.SchematronSchema.validateCandidate(Unknown Source) at org.probatron.SchematronSchema.validateCandidate(Unknown Source)
at org.probatron.Session.doValidation(Unknown Source)
at org.probatron.Driver.main(Unknown Source)
Caused by: net.sf.saxon.trans.XPathException: org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 16; Content is not allowed in prolog.
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:418) at net.sf.saxon.event.Sender.send(Sender.java:214)
at net.sf.saxon.event.Sender.send(Sender.java:50) at net.sf.saxon.Controller.transform(Controller.java:1611)
... 4 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 16; Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:999)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:404) ... 7 more
Here is the schematron xml
<?xml version="1.0" encoding="utf-8"?>
<schema xmlns="http://www.ascc.net/xml/schematron" >
<pattern name="Print negative result only">
<rule context="AAA">
<assert test="BBB">BBB element is missing.</assert>
<assert test="@name">AAA misses attribute name.</assert>
</rule>
</pattern>
</schema>
and xml that needs to test
<AAA>
<BBB/>
</AAA>
the command that I am using to run the jar file
C:\Users\sukumar\Downloads\probatron4j-source-0.7.4>java -jar dist\probatron.jar xml\sample.xml sch\sample.sch
There was the problem with Schematron namespace. I have changed namespace
to this
and that worked for me.