org.weborganic.ox.tool
Class SchematronCommand

java.lang.Object
  extended by org.weborganic.ox.tool.SchematronCommand
All Implemented Interfaces:
Command<SchematronCommand.SchemaResult>

public class SchematronCommand
extends Object
implements Command<SchematronCommand.SchemaResult>

Runs schematron on the specified document.

Version:
28 October 2013
Author:
Christophe Lauret

Nested Class Summary
 class SchematronCommand.SchemaResult
           
 
Field Summary
static String DEFAULT_SCHEMA
          The name of the default schematron to use for this.
 
Constructor Summary
SchematronCommand(Model model)
          Create a new command.
 
Method Summary
static org.weborganic.schematron.Validator getBuiltinValidator()
          Returns the built-in validator
 Model getModel()
          Return the model this command uses.
 org.weborganic.schematron.Validator getValidator(String schematron)
          Returns the Schematron validator used.
 SchematronCommand.SchemaResult process(PackageData data)
          Processes the specified package data according to the model defined for this command.
 void setDocumentPath(String path)
           
 void setSchema(String schema)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SCHEMA

public static final String DEFAULT_SCHEMA
The name of the default schematron to use for this.

See Also:
Constant Field Values
Constructor Detail

SchematronCommand

public SchematronCommand(Model model)
Create a new command.

Parameters:
model - The model to use
Method Detail

setDocumentPath

public void setDocumentPath(String path)
Parameters:
path - The path to the document to validate.

setSchema

public void setSchema(String schema)
Parameters:
schema - The path to the schema to use within the model.

getModel

public Model getModel()
Description copied from interface: Command
Return the model this command uses.

Specified by:
getModel in interface Command<SchematronCommand.SchemaResult>
Returns:
the model this command uses.

process

public SchematronCommand.SchemaResult process(PackageData data)
Description copied from interface: Command
Processes the specified package data according to the model defined for this command.

This method should intercept errors occurring during processing and include them in the results.

Specified by:
process in interface Command<SchematronCommand.SchemaResult>
Returns:
the result of processing specific to this command and data.

getValidator

public org.weborganic.schematron.Validator getValidator(String schematron)
                                                 throws org.weborganic.schematron.SchematronException
Returns the Schematron validator used.

This method will return the schematron in the model if one is found; otherwise it will revert to using the default built-in schematron.

Returns:
the Schematron validator used.
Throws:
org.weborganic.schematron.SchematronException - If the schematron could not be parsed as a validator.

getBuiltinValidator

public static org.weborganic.schematron.Validator getBuiltinValidator()
                                                               throws org.weborganic.schematron.SchematronException
Returns the built-in validator

Returns:
The built-in validator.
Throws:
org.weborganic.schematron.SchematronException - If the schematron could not be parsed as a validator.