Package com.saxonica.ee.validate
Class AttributeValidator
- java.lang.Object
-
- net.sf.saxon.event.SequenceReceiver
-
- net.sf.saxon.event.ProxyReceiver
-
- com.saxonica.ee.validate.ValidatingFilter
-
- com.saxonica.ee.validate.ContentValidator
-
- com.saxonica.ee.validate.AttributeValidator
-
- All Implemented Interfaces:
javax.xml.transform.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.saxonica.ee.validate.ContentValidator
ContentValidator.Nillability
-
-
Field Summary
-
Fields inherited from class com.saxonica.ee.validate.ContentValidator
childValidator, nilled, pendingMessages
-
Fields inherited from class net.sf.saxon.event.ProxyReceiver
nextReceiver
-
Fields inherited from class net.sf.saxon.event.SequenceReceiver
pipelineConfiguration, previousAtomic, systemId
-
-
Constructor Summary
Constructors Constructor Description AttributeValidator(Receiver next)
Create an AttributeValidator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(UnicodeString chars, Location locationId, int properties)
Handle character data appearing as a child of the element being validatedSimpleType
getMostRecentAttributeType()
Get the SimpleType used for validating the most recent attribute, if anyprotected SchemaType
processWildcardTerm(Wildcard card, NodeName elementName, Location locationId)
Process a wildcard term found in complex content or "all" content groups.void
setAttributeGroup(AttributeGroupDecl attributeGroup)
Identify the set of attributes permitted by the complex type being validated.void
startElement(NodeName elemName, SchemaType type, AttributeMap attributes, NamespaceMap namespaces, Location location, int properties)
Handle the start tag for a child element of the element being validatedAttributeMap
validateAttributes(AttributeMap in, java.util.List<NamespaceBinding> additionalNamespaces)
Handle the attributes-
Methods inherited from class com.saxonica.ee.validate.ContentValidator
checkNoCharactersWhenNil, checkNoChildrenWhenNil, endDocument, getAnnotation, getChildValidator, getContainingElement, getContainingElementLocationId, getContainingElementName, getElementDeclaration, getNamespaceResolver, getNillability, getSchemaType, isNilled, makeChildValidator, makeValidator, makeValidatorForType, setAnnotation, setContainingElement, setElementDeclaration, setNillability, setNilled
-
Methods inherited from class com.saxonica.ee.validate.ValidatingFilter
append, getAttributeInheritor, getConstraintChecker, getValidationContext, reportIfInvalid, reportValidationError, setConstraintChecker, setStartTagBuffer, setValidationContext, usesTypeAnnotations
-
Methods inherited from class net.sf.saxon.event.ProxyReceiver
close, comment, endElement, getNamePool, getNextReceiver, open, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startDocument
-
Methods inherited from class net.sf.saxon.event.SequenceReceiver
append, decompose, flatten, getConfiguration, getErrorCodeForDecomposingFunctionItems, getPipelineConfiguration, getSystemId, handlesAppend
-
-
-
-
Constructor Detail
-
AttributeValidator
public AttributeValidator(Receiver next)
Create an AttributeValidator- Parameters:
next
- the next receiver in the pipeline
-
-
Method Detail
-
setAttributeGroup
public void setAttributeGroup(AttributeGroupDecl attributeGroup)
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:
MissingComponentException
- if an unresolved reference is found
-
validateAttributes
public AttributeMap validateAttributes(AttributeMap in, java.util.List<NamespaceBinding> additionalNamespaces) throws XPathException
Handle the attributes- Overrides:
validateAttributes
in classContentValidator
- Parameters:
in
- the supplied attribute collectionadditionalNamespaces
- a mutable list to which additional namespace bindings can be added in the event that validation of attributes requires new namespaces (to support fixed or default values of QName-valued attributes)- Returns:
- the validated attribute collection
- Throws:
XPathException
-
getMostRecentAttributeType
public SimpleType getMostRecentAttributeType()
Get the SimpleType used for validating the most recent attribute, if any- Returns:
- the SimpleType of the most recent attribute
-
startElement
public void startElement(NodeName elemName, SchemaType type, AttributeMap attributes, NamespaceMap namespaces, Location location, int properties) throws XPathException
Handle the start tag for a child element of the element being validated- Specified by:
startElement
in interfaceReceiver
- Overrides:
startElement
in classContentValidator
- Parameters:
elemName
- the name of the element.type
- the type annotation of the element.attributes
- the attributes of this elementnamespaces
- the in-scope namespaces of this element: generally this is all the in-scope namespaces, without relying on inheriting namespaces from parent elementslocation
- an object providing information about the module, line, and column where the node originatedproperties
- bit-significant properties of the element node. If there are no relevant properties, zero is supplied. The definitions of the bits are in classReceiverOption
- Throws:
XPathException
- if an error occurs
-
characters
public void characters(UnicodeString chars, Location locationId, int properties) throws XPathException
Handle character data appearing as a child of the element being validated- Specified by:
characters
in interfaceReceiver
- Overrides:
characters
in classProxyReceiver
- Parameters:
chars
- The character contentlocationId
- the location of the node in the source, or of the instruction that created itproperties
- Additional properties @throws net.sf.saxon.trans.XPathException- Throws:
XPathException
- if an error occurs
-
processWildcardTerm
protected SchemaType processWildcardTerm(Wildcard card, NodeName elementName, Location locationId) throws XPathException
Process a wildcard term found in complex content or "all" content groups. This method is called when the validator is processing a child element of the relevant group and has established that it matches a wildcard term. The purpose of the method is (a) to determine whether the "processContents=strict" condition is satisfied (that is, there must be a matching global element declaration), and (b) to allocate a childValidator for the child element.- Parameters:
card
- the Wildcard that has been matchedelementName
- the name of the child elementlocationId
- the location of the child element- Returns:
- the type annotation to be used for the child element
- Throws:
XPathException
- if the content is invalid
-
-