Class SimpleContentValidator

  • All Implemented Interfaces:
    javax.xml.transform.Result, Receiver

    public class SimpleContentValidator
    extends AttributeValidator
    This class is a filter that is used to validate that an element has simple content conforming to a given simple type. This filter accumulates the character data in a buffer and invokes the validation method of the simple type at the time that endElement() is called. Child elements are rejected as invalid. This validator can handle simple types, or complex types with simple content: the attributes are validated by the superclass, Validator.
    • Constructor Detail

      • SimpleContentValidator

        public SimpleContentValidator​(ElementDecl declaration,
                                      SchemaType type,
                                      Receiver next)
                               throws MissingComponentException
        Create a simple content validator
        declaration - The element declaration (may be null). Used to check fixed/default values
        type - The schema type of the element
        next - The next receiver in the pipeline
        MissingComponentException - if a validator cannot be constructed because the schema is incomplete
    • Method Detail

      • startElement

        public void startElement​(NodeName elemName,
                                 SchemaType type,
                                 AttributeMap attributes,
                                 NamespaceMap namespaces,
                                 Location location,
                                 int properties)
                          throws XPathException
        Output element start tag (for a child of the element being validated)
        Specified by:
        startElement in interface Receiver
        startElement in class AttributeValidator
        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
        XPathException - if an error occurs
      • getChildValidator

        protected ContentValidator getChildValidator()
        Return a validator to handle the children of the element just started. This will only be called during error recovery, because an exception would have been thrown when the element was started
        Specified by:
        getChildValidator in class ContentValidator
        the validator to be used to handle the children
      • 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
        characters in class AttributeValidator
        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
        XPathException - if an error occurs