Skip to content

Commit

Permalink
Silence schematron-related SXWN9000 Saxon error
Browse files Browse the repository at this point in the history
Fixes #240
  • Loading branch information
sideshowbarker committed Dec 11, 2018
1 parent 8193952 commit f3350d7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ public void initTransformerFactory(TransformerFactory factory) {
}
factory.setAttribute(FeatureKeys.LINE_NUMBERING, Boolean.TRUE);
factory.setAttribute(FeatureKeys.VERSION_WARNING, Boolean.FALSE);
factory.setErrorListener(new SilencingErrorListener());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.thaiopensource.validate.schematron;

import net.sf.saxon.lib.StandardErrorListener;
import net.sf.saxon.trans.XPathException;

import javax.xml.transform.TransformerException;

public class SilencingErrorListener extends StandardErrorListener {
@Override
public void warning(TransformerException exception)
throws TransformerException {
if (exception instanceof XPathException) {
XPathException xe = (XPathException) exception;
if ("SXWN9000".equals(xe.getErrorCodeLocalPart())) {
return;
}
}
super.warning(exception);
}
}

0 comments on commit f3350d7

Please sign in to comment.