Class AttributeImpl

    • Constructor Detail

      • AttributeImpl

        public AttributeImpl​(ElementImpl element,
                             int index)
        Construct an Attribute node for the n'th attribute of a given element
        Parameters:
        element - The element containing the relevant attribute
        index - The index position of the attribute starting at zero
    • Method Detail

      • getNameCode

        public int getNameCode()
        Get the name code, which enables the name to be located in the name pool
        Specified by:
        getNameCode in interface NodeInfo
        Overrides:
        getNameCode in class NodeImpl
        Returns:
        an integer name code, which may be used to obtain the actual node name from the name pool. For unnamed nodes (text nodes, comments, document nodes, and namespace nodes for the default namespace), returns -1.
        See Also:
        allocate, getFingerprint
      • getTypeAnnotation

        public int getTypeAnnotation()
        Get the type annotation of this node, if any
        Specified by:
        getTypeAnnotation in interface NodeInfo
        Overrides:
        getTypeAnnotation in class NodeImpl
        Returns:
        the type annotation of the node, under the mask NamePool.FP_MASK, and optionally the bit setting IS_DTD_TYPE in the case of a DTD-derived ID or IDREF/S type (which is treated as untypedAtomic for the purposes of obtaining the typed value).

        The result is undefined for nodes other than elements and attributes.

      • isId

        public boolean isId()
        Determine whether this node has the is-id property
        Specified by:
        isId in interface ExtendedNodeInfo
        Returns:
        true if the node is an ID
      • isIdref

        public boolean isIdref()
        Determine whether this node has the is-idref property
        Specified by:
        isIdref in interface ExtendedNodeInfo
        Returns:
        true if the node is an IDREF or IDREFS element or attribute
      • isNilled

        public boolean isNilled()
        Determine whether the node has the is-nilled property
        Specified by:
        isNilled in interface ExtendedNodeInfo
        Returns:
        true if the node has the is-nilled property
      • isSameNodeInfo

        public boolean isSameNodeInfo​(NodeInfo other)
        Determine whether this is the same node as another node
        Specified by:
        isSameNodeInfo in interface NodeInfo
        Overrides:
        isSameNodeInfo in class NodeImpl
        Parameters:
        other - the node to be compared with this node
        Returns:
        true if this Node object and the supplied Node object represent the same node in the tree.
      • hashCode

        public int hashCode()
        The hashCode() method obeys the contract for hashCode(): that is, if two objects are equal (represent the same node) then they must have the same hashCode()
        Specified by:
        hashCode in interface NodeInfo
        Overrides:
        hashCode in class NodeImpl
        Since:
        8.7 Previously, the effect of the equals() and hashCode() methods was not defined. Callers should therefore be aware that third party implementations of the NodeInfo interface may not implement the correct semantics.
      • getSequenceNumber

        protected long getSequenceNumber()
        Get the node sequence number (in document order). Sequence numbers are monotonic but not consecutive. In the current implementation, parent nodes (elements and roots) have a zero least-significant word, while namespaces, attributes, text nodes, comments, and PIs have the top word the same as their owner and the bottom half reflecting their relative position.
        Overrides:
        getSequenceNumber in class NodeImpl
      • getNodeKind

        public final int getNodeKind()
        Return the type of node.
        Specified by:
        getNodeKind in interface NodeInfo
        Returns:
        Node.ATTRIBUTE
        See Also:
        Type
      • getNextSibling

        public NodeInfo getNextSibling()
        Get next sibling - not defined for attributes
        Overrides:
        getNextSibling in class NodeImpl
        Returns:
        The next sibling node of the required type. Returns null if the current node is the last child of its parent.
      • getPreviousSibling

        public NodeInfo getPreviousSibling()
        Get previous sibling - not defined for attributes
        Overrides:
        getPreviousSibling in class NodeImpl
        Returns:
        The previous sibling node. Returns null if the current node is the first child of its parent.
      • getPreviousInDocument

        public NodeImpl getPreviousInDocument()
        Get the previous node in document order (skipping attributes)
        Overrides:
        getPreviousInDocument in class NodeImpl
        Returns:
        the previous node in the document, or null if there is no such node
      • getNextInDocument

        public NodeImpl getNextInDocument​(NodeImpl anchor)
        Get the next node in document order (skipping attributes)
        Overrides:
        getNextInDocument in class NodeImpl
        Parameters:
        anchor - the scan stops when it reaches a node that is not a descendant of the specified anchor node
        Returns:
        the next node in the document, or null if there is no such node
      • generateId

        public void generateId​(FastStringBuffer buffer)
        Get sequential key. Returns key of owning element with the attribute index as a suffix
        Specified by:
        generateId in interface NodeInfo
        Overrides:
        generateId in class NodeImpl
        Parameters:
        buffer -
      • copy

        public void copy​(Receiver out,
                         int whichNamespaces,
                         boolean copyAnnotations,
                         int locationId)
                  throws XPathException
        Copy this node to a given outputter
        Specified by:
        copy in interface NodeInfo
        Parameters:
        out - the Receiver to which the node should be copied
        whichNamespaces - in the case of an element, controls which namespace nodes should be copied. Values are NodeInfo.NO_NAMESPACES, NodeInfo.LOCAL_NAMESPACES, NodeInfo.ALL_NAMESPACES
        copyAnnotations - indicates whether the type annotations of element and attribute nodes should be copied
        locationId - If non-zero, identifies the location of the instruction that requested this copy. If zero, indicates that the location information for the original node is to be copied; in this case the Receiver must be a LocationCopier
        Throws:
        XPathException