eu.peppol.validation.commons.schematron
Class SchematronHelper

java.lang.Object
  extended by eu.peppol.validation.commons.schematron.SchematronHelper

@Immutable
public final class SchematronHelper
extends Object

This is a helper class that provides a way to easily apply an Schematron resource on an XML resource.

Author:
PEPPOL.AT, BRZ, Philip Helger

Method Summary
static SchematronOutputType applySchematron(ISchematronResource aSchematron, com.phloc.commons.io.IReadableResource aXML)
          Apply the passed schematron on the passed XML resource using a custom error handler.
static SchematronOutputType applySchematron(ISchematronResource aSchematron, Source aXML)
          Apply the passed schematron on the passed XML resource.
static com.phloc.commons.error.IResourceErrorGroup convertToResourceErrorGroup(SchematronOutputType aSchematronOutput, String sResourceName)
          Convert a SchematronOutputType to an IResourceErrorGroup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

applySchematron

@Nullable
public static SchematronOutputType applySchematron(@Nonnull
                                                            ISchematronResource aSchematron,
                                                            @Nonnull
                                                            com.phloc.commons.io.IReadableResource aXML)
Apply the passed schematron on the passed XML resource using a custom error handler.

Parameters:
aSchematron - The Schematron resource. May not be null.
aXML - The XML resource. May not be null.
Returns:
null if either the Schematron or the XML could not be read.
Throws:
IllegalStateException - if the processing throws an unexpected exception.

applySchematron

@Nullable
public static SchematronOutputType applySchematron(@Nonnull
                                                            ISchematronResource aSchematron,
                                                            @Nonnull
                                                            Source aXML)
Apply the passed schematron on the passed XML resource.

Parameters:
aSchematron - The Schematron resource. May not be null.
aXML - The XML resource. May not be null.
Returns:
null if either the Schematron or the XML could not be read.
Throws:
IllegalStateException - if the processing throws an unexpected exception.

convertToResourceErrorGroup

@Nonnull
public static com.phloc.commons.error.IResourceErrorGroup convertToResourceErrorGroup(@Nonnull
                                                                                              SchematronOutputType aSchematronOutput,
                                                                                              @Nullable
                                                                                              String sResourceName)
Convert a SchematronOutputType to an IResourceErrorGroup.

Parameters:
aSchematronOutput - The result of Schematron validation
sResourceName - The name of the resource that was validated (may be a file path etc.)
Returns:
List non-null error list of SVRLResourceError objects.


Copyright © 2011 PEPPOL project. All Rights Reserved.