com.saxonica.validate
Class AttributeValidator
java.lang.Object
net.sf.saxon.event.SequenceReceiver
net.sf.saxon.event.ProxyReceiver
com.saxonica.validate.ValidatingFilter
com.saxonica.validate.ContentValidator
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.
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 net.sf.saxon.event.ProxyReceiver |
append, close, comment, endElement, getConfiguration, getDocumentLocator, getNamePool, getUnderlyingReceiver, namespace, open, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startDocument |
AttributeValidator
public AttributeValidator()
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 attributetypeCode
- integer identifying the type annotation (ignored)value
- the value of the attributeproperties
- additional properties of the attributelocationId
- 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 contentproperties
- Additional propertieslocationId
- 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.