Class AttributeValidator

    • 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 class ContentValidator
        Parameters:
        in - the supplied attribute collection
        additionalNamespaces - 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 interface Receiver
        Overrides:
        startElement in class ContentValidator
        Parameters:
        elemName - the name of the element.
        type - the type annotation of the element.
        attributes - the attributes of this element
        namespaces - the in-scope namespaces of this element: generally this is all the in-scope namespaces, without relying on inheriting namespaces from parent elements
        location - an object providing information about the module, line, and column where the node originated
        properties - bit-significant properties of the element node. If there are no relevant properties, zero is supplied. The definitions of the bits are in class ReceiverOption
        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 interface Receiver
        Overrides:
        characters in class ProxyReceiver
        Parameters:
        chars - The character content
        locationId - the location of the node in the source, or of the instruction that created it
        properties - 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 matched
        elementName - 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 - if the content is invalid