Class TinyAttributeCollection

  • All Implemented Interfaces:
    AttributeCollection

    public class TinyAttributeCollection
    extends Object
    implements AttributeCollection
    An implementation of the AttributeCollection interface based directly on the TinyTree data structure.
    • Field Detail

      • element

        int element
      • firstAttribute

        int firstAttribute
    • Constructor Detail

      • TinyAttributeCollection

        public TinyAttributeCollection​(TinyTree tree,
                                       int element)
    • Method Detail

      • getLength

        public int getLength()
        Return the number of attributes in the list.
        Specified by:
        getLength in interface AttributeCollection
        Returns:
        The number of attributes in the list.
      • getFingerprint

        public int getFingerprint​(int index)
        Description copied from interface: AttributeCollection
        Get the fingerprint of an attribute (by position).
        Specified by:
        getFingerprint in interface AttributeCollection
        Parameters:
        index - The position of the attribute in the list.
        Returns:
        The name code of the attribute, or -1 if there is no attribute at that position.
      • getNodeName

        public NodeName getNodeName​(int index)
        Get the node name of an attribute (by position)
        Specified by:
        getNodeName in interface AttributeCollection
        Parameters:
        index - The position of the attribute in the list
        Returns:
        The node name of the attribute, or null if there is no attribute in that position
      • getTypeAnnotation

        public SimpleType getTypeAnnotation​(int index)
        Get the type annotation of an attribute (by position).
        Specified by:
        getTypeAnnotation in interface AttributeCollection
        Parameters:
        index - The position of the attribute in the list.
        Returns:
        The type annotation of the attribute
      • getLocation

        public Location getLocation​(int index)
        Get the location of an attribute (by position)
        Specified by:
        getLocation in interface AttributeCollection
        Parameters:
        index - The position of the attribute in the list.
        Returns:
        The location of the attribute, where available
      • getSystemId

        public String getSystemId​(int index)
        Get the systemId part of the location of an attribute, at a given index.

        Attribute location information is not available from a SAX parser, so this method is not useful for getting the location of an attribute in a source document. However, in a Saxon result document, the location information represents the location in the stylesheet of the instruction used to generate this attribute, which is useful for debugging.

        Specified by:
        getSystemId in interface AttributeCollection
        Parameters:
        index - the required attribute
        Returns:
        the systemId of the location of the attribute
      • getLineNumber

        public int getLineNumber​(int index)
        Get the line number part of the location of an attribute, at a given index.

        Attribute location information is not available from a SAX parser, so this method is not useful for getting the location of an attribute in a source document. However, in a Saxon result document, the location information represents the location in the stylesheet of the instruction used to generate this attribute, which is useful for debugging.

        Specified by:
        getLineNumber in interface AttributeCollection
        Parameters:
        index - the required attribute
        Returns:
        the line number of the location of the attribute
      • getProperties

        public int getProperties​(int index)
        Get the properties of an attribute (by position)
        Specified by:
        getProperties in interface AttributeCollection
        Parameters:
        index - The position of the attribute in the list.
        Returns:
        The properties of the attribute. This is a set of bit-settings defined in class ReceiverOptions. The most interesting of these is {ReceiverOptions.DEFAULTED_ATTRIBUTE, which indicates an attribute that was added to an element as a result of schema validation.
      • getPrefix

        public String getPrefix​(int index)
        Get the prefix of the name of an attribute (by position).
        Specified by:
        getPrefix in interface AttributeCollection
        Parameters:
        index - The position of the attribute in the list.
        Returns:
        The prefix of the attribute name as a string, or null if there is no attribute at that position. Returns "" for an attribute that has no prefix.
      • getQName

        public String getQName​(int index)
        Get the lexical QName of an attribute (by position).
        Specified by:
        getQName in interface AttributeCollection
        Parameters:
        index - The position of the attribute in the list.
        Returns:
        The lexical QName of the attribute as a string, or null if there is no attribute at that position.
      • getLocalName

        public String getLocalName​(int index)
        Get the local name of an attribute (by position).
        Specified by:
        getLocalName in interface AttributeCollection
        Parameters:
        index - The position of the attribute in the list.
        Returns:
        The local name of the attribute as a string, or null if there is no attribute at that position.
      • getURI

        public String getURI​(int index)
        Get the namespace URI of an attribute (by position).
        Specified by:
        getURI in interface AttributeCollection
        Parameters:
        index - The position of the attribute in the list.
        Returns:
        The local name of the attribute as a string, or null if there is no attribute at that position.
      • getIndex

        public int getIndex​(String uri,
                            String localname)
        Get the index of an attribute (by name).
        Specified by:
        getIndex in interface AttributeCollection
        Parameters:
        uri - The namespace uri of the attribute.
        localname - The local name of the attribute.
        Returns:
        The index position of the attribute, or -1 if there is no attribute with this name
      • getIndexByFingerprint

        public int getIndexByFingerprint​(int fingerprint)
        Get the index, given the fingerprint
        Specified by:
        getIndexByFingerprint in interface AttributeCollection
        Parameters:
        fingerprint - the NamePool fingerprint of the required attribute name
        Returns:
        The index position of the attribute, or -1 if there is no attribute with this name
      • getValue

        public String getValue​(String uri,
                               String localname)
        Get the value of an attribute (by name).
        Specified by:
        getValue in interface AttributeCollection
        Parameters:
        uri - The namespace uri of the attribute.
        localname - The local name of the attribute.
        Returns:
        The index position of the attribute
      • getValue

        public String getValue​(int index)
        Get the value of an attribute (by position).
        Specified by:
        getValue in interface AttributeCollection
        Parameters:
        index - The position of the attribute in the list.
        Returns:
        The attribute value as a string, or null if there is no attribute at that position.
      • isId

        public boolean isId​(int index)
        Determine whether a given attribute has the is-ID property set
        Specified by:
        isId in interface AttributeCollection
      • isIdref

        public boolean isIdref​(int index)
        Determine whether a given attribute has the is-idref property set
        Specified by:
        isIdref in interface AttributeCollection