com.saxonica.validate
Class SimpleContentValidator

java.lang.Object
  extended bynet.sf.saxon.event.SequenceReceiver
      extended bynet.sf.saxon.event.ProxyReceiver
          extended bycom.saxonica.validate.ContentValidator
              extended bycom.saxonica.validate.AttributeValidator
                  extended bycom.saxonica.validate.SimpleContentValidator
All Implemented Interfaces:
Receiver, javax.xml.transform.Result

public class SimpleContentValidator
extends AttributeValidator

This class is a filter that is used to validate that an element has simple content conforming to a given simple type. This filter accumulates the character data in a buffer and invokes the validation method of the simple type at the time that endElement() is called. Child elements are rejected as invalid. This validator can handle simple types, or complex types with simple content: the attributes are validated by the superclass, Validator.


Field Summary
 
Fields inherited from class com.saxonica.validate.AttributeValidator
nil
 
Fields inherited from class com.saxonica.validate.ContentValidator
invalid, pendingMessages, xsiType
 
Fields inherited from class net.sf.saxon.event.ProxyReceiver
nextReceiver, systemId
 
Fields inherited from class net.sf.saxon.event.SequenceReceiver
pipelineConfiguration, previousAtomic
 
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
 
Constructor Summary
SimpleContentValidator(ElementDecl declaration, SchemaType type)
          Create a simple content validator
 
Method Summary
 void characters(java.lang.CharSequence chars, int locationId, int properties)
          Handle character data appearing as a child of the element being validated
 void endElement()
          End of element being validated
protected  ContentValidator getChildValidator()
          Return a validator to handle the children of the element just started.
 SchemaType getSchemaType()
           
 SimpleType getSimpleType()
           
 void setSchemaType(SchemaType type)
           
 void startElement(int nameCode, int typeCode, int locationId, int properties)
          Output element start tag (for a child of the element being validated)
 
Methods inherited from class com.saxonica.validate.AttributeValidator
attribute, isNil, setAttributeGroup, startContent
 
Methods inherited from class com.saxonica.validate.ContentValidator
endDocument, getAnnotation, getContainingElement, getContainingElementLocationId, getContainingElementName, getElementDeclaration, getNamespaceResolver, isInvalid, isNillable, isOutput, makeValidator, makeValidator, makeValidator, reportValidationError, setAnnotation, setContainingElement, setElementDeclaration, setIsOutput, setNamespaceResolver, setNillable, setXSIType
 
Methods inherited from class net.sf.saxon.event.ProxyReceiver
close, comment, getConfiguration, getDocumentLocator, getNamePool, getSystemId, getUnderlyingReceiver, namespace, open, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startDocument
 
Methods inherited from class net.sf.saxon.event.SequenceReceiver
append, getPipelineConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleContentValidator

public SimpleContentValidator(ElementDecl declaration,
                              SchemaType type)
                       throws ValidationException
Create a simple content validator

Parameters:
declaration - The element declaration (may be null). Used to check fixed/default values
type - The schema type of the element
Method Detail

getSimpleType

public SimpleType getSimpleType()

getSchemaType

public SchemaType getSchemaType()

setSchemaType

public void setSchemaType(SchemaType type)
                   throws ValidationException
Throws:
ValidationException

startElement

public void startElement(int nameCode,
                         int typeCode,
                         int locationId,
                         int properties)
                  throws XPathException
Output element start tag (for a child of the element being validated)

Specified by:
startElement in interface Receiver
Overrides:
startElement in class AttributeValidator
Throws:
XPathException

getChildValidator

protected ContentValidator getChildValidator()
Return a validator to handle the children of the element just started. This will only be called during error recovery, because an exception would have been thrown when the element was started

Specified by:
getChildValidator in class ContentValidator

characters

public void characters(java.lang.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
Throws:
XPathException - If the character data is invalid

endElement

public void endElement()
                throws XPathException
End of element being validated

Specified by:
endElement in interface Receiver
Overrides:
endElement in class ProxyReceiver
Throws:
XPathException