Free Trial - Stylus Studio, The World's Best XML IDE!


com.saxonica.validate
Class SchemaAwareConfiguration

java.lang.Object
  |
  +--net.sf.saxon.Configuration
        |
        +--com.saxonica.validate.SchemaAwareConfiguration
All Implemented Interfaces:
java.io.Serializable

public class SchemaAwareConfiguration
extends Configuration

A subclass of Configuration that defines a schema-aware processor. This contains helper methods invoked both at compile time and at run-time to perform operations that are allowed only in a schema-aware processor; the superclass Configuration contains the dummy versions of these methods used in a non-schema-aware processor. The interface is designed so that the calling classes contain no references to classes that are available only in the schema-aware product.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.Configuration
DO_NOT_RECOVER, RECOVER_SILENTLY, RECOVER_WITH_WARNINGS, XQUERY, XSLT
 
Constructor Summary
SchemaAwareConfiguration()
           
 
Method Summary
 void addSchema(SchemaMarker schema)
          Add a schema to the cache
 void addSchema(javax.xml.transform.Source schemaSource)
          Load a schema, which will be available for use by all subsequent operations using this TransformerFactory.
 void displayLicenseMessage()
          Display a message about the license status
 SchemaDeclaration getAttributeDeclaration(int fingerprint)
          Get a global attribute declaration
 SchemaType getAttributeType(SchemaDeclaration attributeDecl)
          Get the schema type corresponding to an attribute declaration
 ValidationContext getContainedValidationContext(ValidationContext outer, int fingerprint, boolean isType)
          Get a validation context nested within an existing validation context (XQuery only)
 Receiver getDocumentValidator(Receiver receiver, java.lang.String systemId, NamePool namePool, int validationMode)
          Get a document-level validator to add to a Receiver pipeline
 SchemaDeclaration getElementDeclaration(int fingerprint)
          Get a global element declaration
 SchemaType getElementType(SchemaDeclaration elementDecl)
          Get the schema type corresponding to an element declaration
 Receiver getElementValidator(Receiver out, int nameCode, SchemaType schemaType, int validation, ValidationContext validationContext, NamePool pool)
          Get a Receiver that can be used to validate an element, and that passes the validated element on to a target receiver.
 java.lang.String getProductTitle()
          Get a message used to identify this product when a transformation is run using the -t option
 SchemaMarker getSchema(java.lang.String namespace)
          Get a schema from the cache.
 SchemaType getSchemaType(int fingerprint)
          Get the top-level schema type with a given fingerprint.
 SuperSchema getSuperSchema()
          Get the SuperSchema, containing references to all names defined in all known schemas
 boolean isSchemaAware()
          Determine if the configuration is schema-aware
 NodeTest makeSubstitutionGroupTest(SchemaDeclaration elementDecl)
          Make a test for elements corresponding to a give element declaration
 java.lang.String readSchema(java.lang.String baseURI, java.lang.String schemaLocation, java.lang.String expected)
          Read a schema from a given schema location
 long validateAttribute(int nameCode, java.lang.CharSequence value, int validation)
          Validate an attribute value (XSLT only)
 
Methods inherited from class net.sf.saxon.Configuration
addQueryLibraryModule, getErrorListener, getHostLanguage, getLocale, getMessageEmitterClass, getNamePool, getOutputURIResolver, getQueryLibraryModule, getRecoveryPolicy, getSourceParser, getSourceParserClass, getStyleParser, getStyleParserClass, getTraceListener, getTreeModel, getURIResolver, isAllowExternalFunctions, isLineNumbering, isSchemaValidation, isStripsAllWhiteSpace, isTiming, isTraceExternalFunctions, isValidation, makeParser, setAllowExternalFunctions, setErrorListener, setHostLanguage, setLineNumbering, setMessageEmitterClass, setNamePool, setOutputURIResolver, setRecoveryPolicy, setSchemaValidation, setSourceParserClass, setStripsAllWhiteSpace, setStyleParserClass, setTiming, setTraceExternalFunctions, setTraceListener, setTreeModel, setURIResolver, setValidation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaAwareConfiguration

public SchemaAwareConfiguration()
Method Detail

getProductTitle

public java.lang.String getProductTitle()
Get a message used to identify this product when a transformation is run using the -t option

Overrides:
getProductTitle in class Configuration
Returns:
A string containing both the product name and the product version

isSchemaAware

public final boolean isSchemaAware()
Determine if the configuration is schema-aware

Overrides:
isSchemaAware in class Configuration

displayLicenseMessage

public void displayLicenseMessage()
Display a message about the license status

Overrides:
displayLicenseMessage in class Configuration

readSchema

public java.lang.String readSchema(java.lang.String baseURI,
                                   java.lang.String schemaLocation,
                                   java.lang.String expected)
                            throws SchemaException
Read a schema from a given schema location

Overrides:
readSchema in class Configuration
Parameters:
baseURI - the base URI for resolving relative URIs
schemaLocation - the location "hint" where to find the schema document. Must not be null.
expected - the target namespace expected; null if there is no expectation
Returns:
the actual target namespace of the schema
SchemaException

addSchema

public void addSchema(javax.xml.transform.Source schemaSource)
               throws javax.xml.transform.TransformerException
Load a schema, which will be available for use by all subsequent operations using this TransformerFactory.

Overrides:
addSchema in class Configuration
Parameters:
schemaSource - the JAXP Source object identifying the schema document to be loaded
Throws:
javax.xml.transform.TransformerException - if the schema cannot be read or parsed or if it is invalid

addSchema

public void addSchema(SchemaMarker schema)
Add a schema to the cache

Overrides:
addSchema in class Configuration

getSchema

public SchemaMarker getSchema(java.lang.String namespace)
Get a schema from the cache. Return null if not found. The result will always be a Schema object, but must be cast by the caller.

Overrides:
getSchema in class Configuration

getSuperSchema

public SuperSchema getSuperSchema()
Get the SuperSchema, containing references to all names defined in all known schemas


getElementDeclaration

public SchemaDeclaration getElementDeclaration(int fingerprint)
Get a global element declaration

Overrides:
getElementDeclaration in class Configuration
Returns:
the element declaration whose name matches the given fingerprint, or null if no element declaration with this name has been registered.

getAttributeDeclaration

public SchemaDeclaration getAttributeDeclaration(int fingerprint)
Get a global attribute declaration

Overrides:
getAttributeDeclaration in class Configuration
Returns:
the attribute declaration whose name matches the given fingerprint, or null if no element declaration with this name has been registered.

getSchemaType

public SchemaType getSchemaType(int fingerprint)
Get the top-level schema type with a given fingerprint.

Overrides:
getSchemaType in class Configuration
Parameters:
fingerprint - the fingerprint of the schema type
Returns:
the schema type , or null if there is none with this name.

getDocumentValidator

public Receiver getDocumentValidator(Receiver receiver,
                                     java.lang.String systemId,
                                     NamePool namePool,
                                     int validationMode)
Get a document-level validator to add to a Receiver pipeline

Overrides:
getDocumentValidator in class Configuration
Parameters:
receiver - The receiver to which events should be sent after validation
systemId - the base URI of the document being validated
namePool - the namePool to be used by the validator
validationMode - for example Validation.STRICT or Validation.STRIP
Returns:
A Receiver to which events can be sent for validation

getElementValidator

public Receiver getElementValidator(Receiver out,
                                    int nameCode,
                                    SchemaType schemaType,
                                    int validation,
                                    ValidationContext validationContext,
                                    NamePool pool)
                             throws javax.xml.transform.TransformerException
Get a Receiver that can be used to validate an element, and that passes the validated element on to a target receiver. If validation is not supported, the returned receiver will be the target receiver.

Overrides:
getElementValidator in class Configuration
Parameters:
out - the target receiver to receive the validated element
nameCode - the nameCode of the element to be validated. This must correspond to the name of an element declaration in a loaded schema
schemaType - the schema type (typically a complex type) against which the element is to be validated
validation - The validation mode, for example Validation.STRICT or Validation.LAX
pool - The name pool
Returns:
The newly created receiver, which performs the validation and passes the validated elements on to the target receiver.
javax.xml.transform.TransformerException

getContainedValidationContext

public ValidationContext getContainedValidationContext(ValidationContext outer,
                                                       int fingerprint,
                                                       boolean isType)
                                                throws XPathException
Get a validation context nested within an existing validation context (XQuery only)

Overrides:
getContainedValidationContext in class Configuration
XPathException

validateAttribute

public long validateAttribute(int nameCode,
                              java.lang.CharSequence value,
                              int validation)
                       throws ValidationException
Validate an attribute value (XSLT only)

Overrides:
validateAttribute in class Configuration
Parameters:
nameCode - the name of the attribute
value - the value of the attribute as a string
validation - STRICT or LAX
Returns:
a long, containing the type annotation to apply to the attribute node in the bottom half, and special properties (especially a flag to require prefix checking for namespace-sensitive content) in the top half
Throws:
ValidationException - if the value is invalid

getAttributeType

public SchemaType getAttributeType(SchemaDeclaration attributeDecl)
Get the schema type corresponding to an attribute declaration

Overrides:
getAttributeType in class Configuration

getElementType

public SchemaType getElementType(SchemaDeclaration elementDecl)
Get the schema type corresponding to an element declaration

Overrides:
getElementType in class Configuration

makeSubstitutionGroupTest

public NodeTest makeSubstitutionGroupTest(SchemaDeclaration elementDecl)
Make a test for elements corresponding to a give element declaration

Overrides:
makeSubstitutionGroupTest in class Configuration


Stylus Studio features integrated development and debugging support for Saxon in the XQuery editor and XSLT editor.