com.saxonica.validate
Class ComplexContentValidator

java.lang.Object
  extended by net.sf.saxon.event.SequenceReceiver
      extended by net.sf.saxon.event.ProxyReceiver
          extended by com.saxonica.validate.ValidatingFilter
              extended by com.saxonica.validate.ContentValidator
                  extended by com.saxonica.validate.AttributeValidator
                      extended by com.saxonica.validate.ComplexContentValidator
All Implemented Interfaces:
Result, Receiver

public class ComplexContentValidator
extends AttributeValidator

This class is a filter that is used to validate the content of an element with a complex type. As each child element is encountered, it is used to compute a transition in the finite state machine compiled for the given complex type.


Field Summary
 
Fields inherited from class com.saxonica.validate.ContentValidator
nil, NIL_ALLOWED, NIL_DISALLOWED, NIL_IGNORED, pendingMessages, xsiType
 
Fields inherited from class net.sf.saxon.event.ProxyReceiver
nextReceiver
 
Fields inherited from class net.sf.saxon.event.SequenceReceiver
pipelineConfiguration, previousAtomic, systemId
 
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
 
Constructor Summary
ComplexContentValidator(ElementDecl declaration, UserComplexType type, Receiver next)
          Create a ComplexContentValidator for a given type
 
Method Summary
 void characters(CharSequence chars, int locationId, int properties)
          Handle character data appearing as a child of the element being validated
 void endElement()
          Validation at the end of the element being validated.
protected  ContentValidator getChildValidator()
          Get a validator to handle the children of the current element.
 SchemaType getSchemaType()
          Get the schema type against which we are validating, if any
 void setPipelineConfiguration(PipelineConfiguration pipe)
          Set the pipeline configuration
 void setSchemaType(UserComplexType type)
          Set the schema type against which this validator is to validate the instance element
 void startElement(NodeName elemName, SchemaType typeCode, int locationId, int properties)
          Handle the start tag for a child element of the element being validated
 
Methods inherited from class com.saxonica.validate.AttributeValidator
attribute, getMostRecentAttributeType, noCharactersWhenNil, processWildcardTerm, setAttributeGroup, startContent
 
Methods inherited from class com.saxonica.validate.ContentValidator
endDocument, getAnnotation, getConstraintChecker, getContainingElement, getContainingElementLocationId, getContainingElementName, getElementDeclaration, getNamespaceResolver, getNillability, getStartTagBuffer, isNil, makeValidator, makeValidatorForType, setAnnotation, setConstraintChecker, setContainingElement, setElementDeclaration, setNillability, setStartTagBuffer, setXSIType
 
Methods inherited from class com.saxonica.validate.ValidatingFilter
append, getErrorCode, getInvalidity, isInvalid, reportIfInvalid, reportValidationError, setErrorCode, setInvalidity, usesTypeAnnotations
 
Methods inherited from class net.sf.saxon.event.ProxyReceiver
close, comment, getNamePool, getUnderlyingReceiver, namespace, open, processingInstruction, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startDocument
 
Methods inherited from class net.sf.saxon.event.SequenceReceiver
append, getConfiguration, getPipelineConfiguration, getSystemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComplexContentValidator

public ComplexContentValidator(ElementDecl declaration,
                               UserComplexType type,
                               Receiver next)
                        throws ValidationException
Create a ComplexContentValidator for a given type

Parameters:
declaration - the element declaration, if available, or null otherwise.
type - the complex type
next - the next receiver in the pipeline
Throws:
ValidationException - if the schema is incomplete or invalid
Method Detail

setPipelineConfiguration

public void setPipelineConfiguration(PipelineConfiguration pipe)
Description copied from interface: Receiver
Set the pipeline configuration

Specified by:
setPipelineConfiguration in interface Receiver
Overrides:
setPipelineConfiguration in class ProxyReceiver
Parameters:
pipe - the pipeline configuration

setSchemaType

public void setSchemaType(UserComplexType type)
                   throws ValidationException
Set the schema type against which this validator is to validate the instance element

Parameters:
type - the schema type used for validation
Throws:
ValidationException - if there is a problem with the schema

getSchemaType

public SchemaType getSchemaType()
Description copied from class: ContentValidator
Get the schema type against which we are validating, if any

Specified by:
getSchemaType in class ContentValidator
Returns:
the schema type that this validator is validating against, or null

startElement

public void startElement(NodeName elemName,
                         SchemaType typeCode,
                         int locationId,
                         int properties)
                  throws XPathException
Handle the start tag for a child element of the element being validated

Specified by:
startElement in interface Receiver
Overrides:
startElement in class AttributeValidator
Parameters:
elemName - integer code identifying the name of the element within the name pool.
typeCode - integer code identifying the element's type within the name pool.
locationId - an integer which can be interpreted using a LocationProvider to return information such as line number and system ID. If no location information is available, the value zero is supplied.
properties - properties of the element node
Throws:
XPathException - if an error occurs

getChildValidator

protected ContentValidator getChildValidator()
Get a validator to handle the children of the current element. This is called immediately on return from the startElement call that starts this element.

Specified by:
getChildValidator in class ContentValidator
Returns:
the validator to be used to handle the children

characters

public void characters(CharSequence chars,
                       int locationId,
                       int properties)
                throws XPathException
Handle character data appearing as a child of the element being validated

Specified by:
characters in interface Receiver
Overrides:
characters in class AttributeValidator
Parameters:
chars - The character content
properties - Additional properties
locationId - an integer which can be interpreted using a LocationProvider to return information such as line number and system ID. If no location information is available, the value zero is supplied.
Throws:
XPathException - If this element does not allow character data

endElement

public void endElement()
                throws XPathException
Validation at the end of the element being validated. (Note this is a different element from the one passed to startElement).

Specified by:
endElement in interface Receiver
Overrides:
endElement in class ProxyReceiver
Throws:
XPathException - if the element is invalid


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.