org.inria.ns.reflex.processor.asl
Class ValidateAction

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.processor.asl.ValidateAction
All Implemented Interfaces:
Executable, Presentable, NamespaceContextFactory

public class ValidateAction
extends AbstractAction

The <asl:validate> element validates an XML document or an XML element.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.core.AbstractAction
AbstractAction.ParameterAdapter, AbstractAction.UselessAction
 
Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractAction
actions, parent, processorInstance
 
Constructor Summary
ValidateAction(Expression schema, Expression node, boolean deepValidation, boolean augment, QExpression report, Element element, AbstractAction parent)
          Creates a new instance of ValidateAction.
 
Method Summary
 void runAction(DataSet dataSet)
          Validate the node with the schema.
static AbstractAction unmarshal(AbstractAction parent, Element element)
          XML unmarshaller for StepAction.
static void validate(Element element, MasterSchema masterSchema, List reportErrorList, boolean deepValidation, boolean augment)
          Validates an element.
static void validate(Node node, MasterSchema masterSchema, List reportErrorList, boolean deepValidation, boolean augment)
          Validates a node.
 void validate(Node node, Schema schema, List reportErrorList)
          Validates a node.
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractAction
addAction, addFallbackAction, createContext, getCanonicalPath, getFallbackAction, getLocalFallbackAction, getLogger, getNamespaceContext, getNode, getParent, recover, recover, removeFallbackAction, reorganize, run, runActions, toPrettyString, toPrettyString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidateAction

public ValidateAction(Expression schema,
                      Expression node,
                      boolean deepValidation,
                      boolean augment,
                      QExpression report,
                      Element element,
                      AbstractAction parent)
Creates a new instance of ValidateAction.

Parameters:
schema - The schema to use for validation, as an Expression ; null is also applicable ; in anyway, the validation will use schemas found in the catalog if needed (when foreign namespaces are found).
node - The node to validate, as an Expression.
deepValidation - Indicates whether the validation must be perform recursively or not.
element - The node from which the action has been unmarshalled. Used for namespace prefix resolution when performing XPath expressions.
parent - The action depending from.
Method Detail

unmarshal

public static AbstractAction unmarshal(AbstractAction parent,
                                       Element element)
                                throws XMLException
XML unmarshaller for StepAction.

Parameters:
parent - The action depending from.
element - The XML element to unmarshall.
report - The name of the report validation property.
Returns:
The ElementAction created.
Throws:
UnmarshalException - When the element and its content is not those expected.
XMLException

runAction

public void runAction(DataSet dataSet)
               throws ExecutionException,
                      XPathException
Validate the node with the schema.

Overrides:
runAction in class AbstractAction
Parameters:
dataSet - The set of datas used when the action is running.
Throws:
ExecutionException - If the action can't be performed.
XPathException

validate

public void validate(Node node,
                     Schema schema,
                     List reportErrorList)
              throws ExecutionException
Validates a node.

Parameters:
node - The node to validate.
schema - The schema used for validation, or null ; the processor instance that has unmarshalled this action will be used to get schemata or catalogs when needed (when a foreign element or attribute is found).
reportErrorList - Report error list.
Throws:
ExecutionException

validate

public static void validate(Node node,
                            MasterSchema masterSchema,
                            List reportErrorList,
                            boolean deepValidation,
                            boolean augment)
                     throws ExecutionException
Validates a node.

Parameters:
node - The node to validate.
masterSchema - The master schema used for the validatation ; it holds the schemata and may perform catalog lookup when needed.
reportErrorList - Report error list.
deepValidation - Indicates whether the validation must be perform recursively or not.
augment - Indicates whether the amount of data have to be augmented or not (PSVI).
Throws:
ExecutionException

validate

public static void validate(Element element,
                            MasterSchema masterSchema,
                            List reportErrorList,
                            boolean deepValidation,
                            boolean augment)
                     throws ExecutionException
Validates an element.

Parameters:
element - The element to validate.
masterSchema - The master schema used for the validatation ; it holds the schemata and may perform catalog lookup when needed.
reportErrorList - Report error list.
deepValidation - Indicates whether the validation must be performed recursively or not.
augment - Indicates whether the amount of data have to be augmented or not (PSVI).
Throws:
ExecutionException