## 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.

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
`AttributeValidator()` Create an 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
`SimpleType` `getMostRecentAttributeType()` Get the SimpleType used for validating the most recent attribute, if any
`protected int` `processWildcardTerm(Wildcard card, int nameCode, int 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` `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, getAnnotation, getChildValidator, getContainingElement, getContainingElementLocationId, getContainingElementName, getElementDeclaration, getNamespaceResolver, getNillability, getSchemaType, getStartTagBuffer, isNil, makeValidator, makeValidatorForType, setAnnotation, setContainingElement, setElementDeclaration, setNillability, setStartTagBuffer, setXSIType`

Methods inherited from class com.saxonica.validate.ValidatingFilter
`getErrorCode, getInvalidity, isInvalid, reportIfInvalid, reportValidationError, setErrorCode, setInvalidity, usesTypeAnnotations`

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
`append, getPipelineConfiguration, getSystemId`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AttributeValidator

    public AttributeValidator()

  Create an 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

### 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(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

### processWildcardTerm

    protected int processWildcardTerm(Wildcard card,
                                      int nameCode,
                                      int 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 matched
    `nameCode` - the name of the child element
    `locationId` - the location of the child element
  Returns:
    the type annotation to be used for the child element
  Throws:
    `XPathException`

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