com.saxonica.validate
Class AttributeValidator

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
All Implemented Interfaces:
Result, Receiver
Direct Known Subclasses:
AllElementValidator, ComplexContentValidator, EmptyContentValidator, SimpleContentValidator

public abstract class AttributeValidator
extends ContentValidator

This class is an abstract superclass for all the receivers that do element content validation. Since all kinds of element content can be associated with attributes, the attribute validation is handled at this level.


Field Summary
 
Fields inherited from class com.saxonica.validate.ContentValidator
NIL_ALLOWED, NIL_DISALLOWED, NIL_IGNORED
 
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
 
Constructor Summary
AttributeValidator()
           
 
Method Summary
 void attribute(int nameCode, int typeCode, CharSequence value, int locationId, int properties)
          Handle an attribute
 void characters(CharSequence chars, int locationId, int properties)
          Handle character data appearing as a child of the element being validated
 void setAttributeGroup(AttributeGroupDecl attributeGroup)
          Identify the set of attributes permitted by the complex type being validated.
 void startContent()
          Notify the start of the content, that is, the completion of all attributes and namespaces.
 void startElement(int nameCode, int 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.ContentValidator
endDocument, getContainingElement, getContainingElementLocationId, getNamespaceResolver, getNillability, getSchemaType, isNil, makeValidator, makeValidator, setNamespaceResolver, setNillability, setXSIType
 
Methods inherited from class com.saxonica.validate.ValidatingFilter
setErrorCode
 
Methods inherited from class net.sf.saxon.event.ProxyReceiver
append, close, comment, endElement, getConfiguration, getDocumentLocator, getNamePool, getUnderlyingReceiver, namespace, open, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startDocument
 
Methods inherited from class net.sf.saxon.event.SequenceReceiver
getPipelineConfiguration, getSystemId
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeValidator

public AttributeValidator()
Method Detail

setAttributeGroup

public void setAttributeGroup(AttributeGroupDecl attributeGroup)
                       throws ValidationException
Identify the set of attributes permitted by the complex type being validated. This is called during initialization of the AttributeValidator. It is not called if the type is a simple type; in such cases any attribute is an error, except for the xsi: attributes permitted on all elements.

Parameters:
attributeGroup - the set of attributes declared for this complex type
Throws:
ValidationException

attribute

public void attribute(int nameCode,
                      int typeCode,
                      CharSequence value,
                      int locationId,
                      int properties)
               throws XPathException
Handle an attribute

Specified by:
attribute in interface Receiver
Overrides:
attribute in class ProxyReceiver
Parameters:
nameCode - integer identifying the name of the attribute
typeCode - integer identifying the type annotation (ignored)
value - the value of the attribute
properties - additional properties of the attribute
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 - On any failure to write the attribute

startElement

public void startElement(int nameCode,
                         int 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 ContentValidator
Parameters:
nameCode - 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

startContent

public final void startContent()
                        throws XPathException
Notify the start of the content, that is, the completion of all attributes and namespaces. The ValidationStack class is responsible for detecting this event and calling this method. Note that this event is reported for every element even if it has no attributes, no namespaces, and no content.

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

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 ProxyReceiver
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


Copyright (C) Michael H. Kay. All rights reserved.