|
@@ -105,7 +105,7 @@ public void run() throws SaxonApiException { |
|
|
boolean checkIdRefs = getOption(_dtd_id_idref_warnings,false); |
|
|
boolean dtdAugment = getOption(_dtd_attribute_values,false); |
|
|
|
|
|
ErrorHandler eh = new RNGErrorHandler(); |
|
|
RNGErrorHandler eh = new RNGErrorHandler(); |
|
|
PropertyMapBuilder properties = new PropertyMapBuilder(); |
|
|
properties.put(ValidateProperty.ERROR_HANDLER, eh); |
|
|
properties.put(ValidateProperty.URI_RESOLVER, runtime.getResolver()); |
|
@@ -156,15 +156,15 @@ public void run() throws SaxonApiException { |
|
|
InputSource din = S9apiUtils.xdmToInputSource(runtime, doc); |
|
|
if (!driver.validate(din)) { |
|
|
if (assertValid) { |
|
|
throw XProcException.stepError(53); |
|
|
throw XProcException.stepError(53, eh.getErr()); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
throw new XProcException(step.getNode(), "Error loading schema"); |
|
|
} |
|
|
} catch (SAXParseException e) { |
|
|
if (assertValid) { |
|
|
throw XProcException.stepError(53); |
|
|
throw XProcException.stepError(53, e); |
|
|
} |
|
|
} catch (SAXException e) { |
|
|
throw new XProcException("SAX Exception", e); |
|
@@ -188,6 +188,10 @@ private String compactSchema(XdmNode doc) { |
|
|
class RNGErrorHandler implements ErrorHandler { |
|
|
SAXParseException err = null; |
|
|
|
|
|
public SAXParseException getErr() { |
|
|
return err; |
|
|
} |
|
|
|
|
|
public void fatalError(SAXParseException e) throws SAXException { |
|
|
error(e); |
|
|
} |
|
@@ -213,7 +217,7 @@ public void error(SAXParseException e) throws SAXException { |
|
|
treeWriter.endDocument(); |
|
|
|
|
|
step.reportError(treeWriter.getResult()); |
|
|
if (err != null) { |
|
|
if (err == null) { |
|
|
err = e; |
|
|
} |
|
|
} |
|
|