com.oxygenxml.validate.nvdl
Class SchemaImpl

java.lang.Object
  extended by com.thaiopensource.validate.AbstractSchema
      extended by com.oxygenxml.validate.nvdl.SchemaImpl
All Implemented Interfaces:
Schema

 class SchemaImpl
extends AbstractSchema

Schema implementation for NVDL scripts.


Nested Class Summary
private  class SchemaImpl.Handler
          This class is registered as content handler on the XMLReader that parses the NVDL script.
private static class SchemaImpl.MustSupportOption
          Stores information about options that must be supported by the validator.
private static class SchemaImpl.WrappedIOException
          Wrapps an IOException as a RuntimeException.
 
Field Summary
private  boolean attributesSchema
          Flag indicating if the schema needs to be changed to handle attributes only, the element in this case is a placeholder.
private  Mode defaultBaseMode
          Default base mode, rejects everything.
private static String IMPLICIT_MODE_NAME
          Mode name used when the script does not define modes and just enters namespace and anyNamespace mappings directly inside rules.
private  Hashtable modeMap
          A hash with the modes.
(package private) static String NVDL_URI
          The NVDL URI.
private  Mode startMode
          The start mode.
private  Triggers triggers
          A hash with the triggers on namespace.
private static String WRAPPER_MODE_NAME
          Mode name used when we have to use this script as an attributes schema.
 
Constructor Summary
SchemaImpl(PropertyMap properties)
          Creates a NVDL schema implementation.
 
Method Summary
 Validator createValidator(PropertyMap properties)
          Creates a Validator for validating XML documents against this NVDL script.
private  Mode getModeAttribute(Attributes attributes, String localName)
          Get the mode specified by an attribute from no namespace.
(package private)  SchemaFuture installHandlers(XMLReader in, SchemaReceiverImpl sr)
          Installs the schema handler on the reader.
private  Mode lookupCreateMode(String name)
          Gets a mode with the given name from the mode map.
private  Mode makeBuiltinMode(String name, Class cls)
          Makes a built in mode.
 
Methods inherited from class com.thaiopensource.validate.AbstractSchema
filterProperties, getProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMPLICIT_MODE_NAME

private static final String IMPLICIT_MODE_NAME
Mode name used when the script does not define modes and just enters namespace and anyNamespace mappings directly inside rules.

See Also:
Constant Field Values

WRAPPER_MODE_NAME

private static final String WRAPPER_MODE_NAME
Mode name used when we have to use this script as an attributes schema. The wrapper mode allows elements from any namespace.

See Also:
Constant Field Values

NVDL_URI

static final String NVDL_URI
The NVDL URI.

See Also:
Constant Field Values

modeMap

private final Hashtable modeMap
A hash with the modes.


triggers

private final Triggers triggers
A hash with the triggers on namespace. Element names are stored concatenated in a string, each name preceded by #.


startMode

private Mode startMode
The start mode.


defaultBaseMode

private final Mode defaultBaseMode
Default base mode, rejects everything.


attributesSchema

private final boolean attributesSchema
Flag indicating if the schema needs to be changed to handle attributes only, the element in this case is a placeholder.

Constructor Detail

SchemaImpl

SchemaImpl(PropertyMap properties)
Creates a NVDL schema implementation. Initializes the attributesSchema flag and the built in modes.

Parameters:
properties - Properties.
Method Detail

makeBuiltinMode

private Mode makeBuiltinMode(String name,
                             Class cls)
Makes a built in mode.

Parameters:
name - The mode name.
cls - The action class.
Returns:
A Mode object.

installHandlers

SchemaFuture installHandlers(XMLReader in,
                             SchemaReceiverImpl sr)
Installs the schema handler on the reader.

Parameters:
in - The reader.
sr - The schema receiver.
Returns:
The installed handler that implements also SchemaFuture.

createValidator

public Validator createValidator(PropertyMap properties)
Creates a Validator for validating XML documents against this NVDL script.

Parameters:
properties - properties.
Returns:
a new Validator that can be used to validate an XML document with respect to this schema; never null
See Also:
ValidateProperty.ERROR_HANDLER

getModeAttribute

private Mode getModeAttribute(Attributes attributes,
                              String localName)
Get the mode specified by an attribute from no namespace.

Parameters:
attributes - The attributes.
localName - The attribute name.
Returns:
The mode refered by the licanName attribute.

lookupCreateMode

private Mode lookupCreateMode(String name)
Gets a mode with the given name from the mode map. If not present then it creates a new mode extending the default base mode.

Parameters:
name - The mode to look for or create if it does not exist.
Returns:
Always a not null mode.