Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.exist.dom
Interface NodeSet

All Superinterfaces:
  org.w3c.dom.NodeList, Sequence

All Known Implementing Classes:
  AbstractNodeSet, NodeProxy

public interface NodeSet
extends Sequence, org.w3c.dom.NodeList

Author:
  wolf

Field Summary
`static int` | `ANCESTOR`
`static int` | `DESCENDANT`
`static NodeSet` | `EMPTY_SET` Constant representing an empty node set.
`static int` | `FOLLOWING`
`static int` | `PRECEDING`

Fields inherited from interface org.exist.xquery.value.Sequence
`EMPTY_SEQUENCE`

Method Summary
`void` | `add(NodeProxy proxy)` Add a new proxy object to the node set.
`void` | `add(NodeProxy proxy, int sizeHint)` Add a proxy object to the node set.
`void` | `addAll(NodeSet other)` Add all nodes from the given node set.
`boolean` | `contains(NodeProxy proxy)` Check if this node set contains a node matching the document and node-id of the given NodeProxy object.
`boolean` | `containsDoc(DocumentImpl doc)` Check if this node set contains nodes belonging to the given document.
`NodeSet` | `deepIntersection(NodeSet other)` Return a new node set, containing all nodes in this node set that are contained or have descendants in the other node set.
`NodeSet` | `directSelectAttribute(QName qname, int contextId)` Optimized method to select attributes.
`NodeSet` | `except(NodeSet other)` Return a new node set containing all nodes from this node set except those nodes which are also contained in the argument node set.
`NodeProxy` | `get(DocumentImpl doc, NodeId nodeId)`
`NodeProxy` | `get(int pos)` Get the node at position pos within this node set.
`NodeProxy` | `get(NodeProxy p)` Get a node from this node set matching the document and node id of the given NodeProxy.
`NodeSet` | `getAncestors(int contextId, boolean includeSelf)`
`NodeSet` | `getContextNodes(int contextId)` Returns all context nodes associated with the nodes in this node set.
`DocumentSet` | `getDocumentSet()` Returns the set of documents from which the node items in this sequence have been selected.
`int` | `getIndexType()` If all nodes in this set have an index, returns the common supertype used to build the index, e.g.
`NodeSet` | `getParents(int contextId)` Return a new node set containing the parent nodes of all nodes in the current set.
`boolean` | `getProcessInReverseOrder()`
`int` | `getSizeHint(DocumentImpl doc)` Get a hint about how many nodes in this node set belong to the specified document.
`int` | `getState()`
`boolean` | `hasChanged(int previousState)`
`boolean` | `hasMixedContent()`
`boolean` | `hasTextIndex()`
`NodeSet` | `intersection(NodeSet other)` Return a new node set, which represents the intersection of the current node set with the given node set.
`NodeSetIterator` | `iterator()` Return an iterator on the nodes in this list.
`NodeProxy` | `parentWithChild(DocumentImpl doc, NodeId nodeId, boolean directParent, boolean includeSelf)` Check if the node identified by its node id has an ancestor contained in this node set and return the ancestor found.
`NodeProxy` | `parentWithChild(NodeProxy proxy, boolean directParent, boolean includeSelf, int level)` Check if the given node has an ancestor contained in this node set and return the ancestor found.
`NodeSet` | `selectAncestorDescendant(NodeSet al, int mode, boolean includeSelf, int contextId)` Check if any descendant nodes are found within this node set for a given set of potential ancestor nodes.
`NodeSet` | `selectAncestors(NodeSet descendants, boolean includeSelf, int contextId)` For a given set of potential ancestor nodes, return all ancestors having descendants in this node set.
`NodeSet` | `selectFollowing(NodeSet following)`
`NodeSet` | `selectFollowingSiblings(NodeSet siblings, int contextId)` Select all nodes from the passed node set, which are following siblings of the nodes in this set.
`NodeSet` | `selectParentChild(NodeSet al, int mode)` Check if any child nodes are found within this node set for a given set of potential parent nodes.
`NodeSet` | `selectParentChild(NodeSet al, int mode, int contextId)` Check if any child nodes are found within this node set for a given set of potential parent nodes.
`NodeSet` | `selectPreceding(NodeSet preceding)`
`NodeSet` | `selectPrecedingSiblings(NodeSet siblings, int contextId)` Select all nodes from the passed node set, which are preceding siblings of the nodes in this set.
`void` | `setProcessInReverseOrder(boolean inReverseOrder)`
`NodeSet` | `union(NodeSet other)` Return a new node set which represents the union of the current node set and the given node set.

Methods inherited from interface org.exist.xquery.value.Sequence
`add, addAll, clearContext, conversionPreference, convertTo, effectiveBooleanValue, getCardinality, getItemType, getLength, getStringValue, hasMany, hasOne, isCached, isEmpty, isPersistentSet, itemAt, iterate, removeDuplicates, setIsCached, setSelfAsContext, toJavaObject, toNodeSet, unorderedIterator`

Methods inherited from interface org.w3c.dom.NodeList
`getLength, item`

Field Detail

### ANCESTOR

    public static final int ANCESTOR

See Also:
  Constant Field Values

### DESCENDANT

    public static final int DESCENDANT

See Also:
  Constant Field Values

### PRECEDING

    public static final int PRECEDING

See Also:
  Constant Field Values

### FOLLOWING

    public static final int FOLLOWING

See Also:
  Constant Field Values

### EMPTY_SET

    public static final NodeSet EMPTY_SET

  Constant representing an empty node set.

Method Detail

### iterator

    public NodeSetIterator iterator()

  Return an iterator on the nodes in this list. The iterator returns nodes according to the internal ordering of nodes (i.e. level first), not in document- order.

### contains

    public boolean contains(NodeProxy proxy)

  Check if this node set contains a node matching the document and node-id of the given NodeProxy object.

  Parameters:
    `proxy` -

### containsDoc

    public boolean containsDoc(DocumentImpl doc)

  Check if this node set contains nodes belonging to the given document.

  Parameters:
    `doc` -

### getDocumentSet

    public DocumentSet getDocumentSet()

  Description copied from interface: `Sequence`
  Returns the set of documents from which the node items in this sequence have been selected. This is for internal use only.

  Specified by:
    `getDocumentSet` in interface `Sequence`

### add

    public void add(NodeProxy proxy)

  Add a new proxy object to the node set. Please note: node set implementations may allow duplicates.

  Parameters:
    `proxy` -

### add

    public void add(NodeProxy proxy,
                    int sizeHint)

  Add a proxy object to the node set. The sizeHint parameter gives a hint about the number of items to be expected for the current document.

  Parameters:
    `proxy` -
    `sizeHint` -

### addAll

    public void addAll(NodeSet other)

  Add all nodes from the given node set.

  Parameters:
    `other` -

### get

    public NodeProxy get(int pos)

  Get the node at position pos within this node set.

  Parameters:
    `pos` -

### get

    public NodeProxy get(NodeProxy p)

  Get a node from this node set matching the document and node id of the given NodeProxy.

  Parameters:
    `p` -

### get

    public NodeProxy get(DocumentImpl doc,
                         NodeId nodeId)

### selectParentChild

    public NodeSet selectParentChild(NodeSet al,
                                     int mode)

  Check if any child nodes are found within this node set for a given set of potential parent nodes. If mode is `DESCENDANT`, the returned node set will contain all child nodes found in this node set for each parent node. If mode is `ANCESTOR`, the returned set will contain those parent nodes, for which children have been found.

  Parameters:
    `al` - a node set containing potential parent nodes
    `mode` - selection mode

### selectParentChild

    public NodeSet selectParentChild(NodeSet al,
                                     int mode,
                                     int contextId)

  Check if any child nodes are found within this node set for a given set of potential parent nodes. If mode is `DESCENDANT`, the returned node set will contain all child nodes found in this node set for each parent node. If mode is `ANCESTOR`, the returned set will contain those parent nodes, for which children have been found.

  Parameters:
    `al` - a node set containing potential parent nodes
    `mode` - selection mode
    `contextId` - used to track context nodes when evaluating predicate expressions. If contextId != `Expression.NO_CONTEXT_ID`, the current context will be added to each result of the of the selection.

### selectAncestorDescendant

    public NodeSet selectAncestorDescendant(NodeSet al,
                                            int mode,
                                            boolean includeSelf,
                                            int contextId)

  Check if any descendant nodes are found within this node set for a given set of potential ancestor nodes. If mode is `DESCENDANT`, the returned node set will contain all descendant nodes found in this node set for each ancestor. If mode is `ANCESTOR`, the returned set will contain those ancestor nodes, for which descendants have been found.

  Parameters:
    `al` - a node set containing potential parent nodes
    `mode` - selection mode
    `includeSelf` - if true, check if the ancestor node itself is contained in the set of descendant nodes (descendant-or-self axis)
    `contextId` - used to track context nodes when evaluating predicate expressions. If contextId != `Expression.NO_CONTEXT_ID`, the current context will be added to each result of the of the selection.

### selectAncestors

    public NodeSet selectAncestors(NodeSet descendants,
                                   boolean includeSelf,
                                   int contextId)

  For a given set of potential ancestor nodes, return all ancestors having descendants in this node set.

  Parameters:
    `descendants` - node set containing potential ancestors
    `includeSelf` - if true, check if the ancestor node itself is contained in this node set (ancestor-or-self axis)
    `contextId` - used to track context nodes when evaluating predicate expressions. If contextId != `Expression.NO_CONTEXT_ID`, the current context will be added to each result of the of the selection.

### selectPrecedingSiblings

    public NodeSet selectPrecedingSiblings(NodeSet siblings,
                                           int contextId)

  Select all nodes from the passed node set, which are preceding siblings of the nodes in this set.

  Parameters:
    `siblings` - a node set containing potential siblings
    `contextId` - used to track context nodes when evaluating predicate expressions. If contextId != `Expression.NO_CONTEXT_ID`, the current context will be added to each result of the of the selection.

### selectFollowingSiblings

    public NodeSet selectFollowingSiblings(NodeSet siblings,
                                           int contextId)

  Select all nodes from the passed node set, which are following siblings of the nodes in this set.

  Parameters:
    `siblings` - a node set containing potential siblings
    `contextId` - used to track context nodes when evaluating predicate expressions. If contextId != `Expression.NO_CONTEXT_ID`, the current context will be added to each result of the of the selection.

### selectPreceding

    public NodeSet selectPreceding(NodeSet preceding)
                            throws XPathException

  Throws:
    `XPathException`

### selectFollowing

    public NodeSet selectFollowing(NodeSet following)
                            throws XPathException

  Throws:
    `XPathException`

### parentWithChild

    public NodeProxy parentWithChild(DocumentImpl doc,
                                     NodeId nodeId,
                                     boolean directParent,
                                     boolean includeSelf)

  Check if the node identified by its node id has an ancestor contained in this node set and return the ancestor found. If directParent is true, only immediate ancestors (parents) are considered. Otherwise the method will call itself recursively for all the node's parents. If includeSelf is true, the method returns also true if the node itself is contained in the node set.

### parentWithChild

    public NodeProxy parentWithChild(NodeProxy proxy,
                                     boolean directParent,
                                     boolean includeSelf,
                                     int level)

  Check if the given node has an ancestor contained in this node set and return the ancestor found. If directParent is true, only immediate ancestors (parents) are considered. Otherwise the method will call itself recursively for all the node's parents. If includeSelf is true, the method returns also true if the node itself is contained in the node set.

### getParents

    public NodeSet getParents(int contextId)

  Return a new node set containing the parent nodes of all nodes in the current set.

### getAncestors

    public NodeSet getAncestors(int contextId,
                                boolean includeSelf)

### directSelectAttribute

    public NodeSet directSelectAttribute(QName qname,
                                         int contextId)

  Optimized method to select attributes. Use this if the context has just one or two nodes. Attributes will be directly looked up in the persistent DOM store.

  Parameters:
    `qname` - the QName of the attribute
    `contextId` - used to track context nodes when evaluating predicate expressions. If contextId != `Expression.NO_CONTEXT_ID`, the current context will be added to each result of the of the selection.

### getIndexType

    public int getIndexType()

  If all nodes in this set have an index, returns the common supertype used to build the index, e.g. xs:integer or xs:string. If the nodes have different index types or no node has been indexed, returns `Type.ITEM`.

  See Also:
    `GeneralComparison`, `ValueComparison`

### hasTextIndex

    public boolean hasTextIndex()

### hasMixedContent

    public boolean hasMixedContent()

### getSizeHint

    public int getSizeHint(DocumentImpl doc)

  Get a hint about how many nodes in this node set belong to the specified document. This is just used for allocating new node sets. The information does not need to be exact. -1 is returned if the size cannot be determined (the default).

  Parameters:
    `doc` -

### intersection

    public NodeSet intersection(NodeSet other)

  Return a new node set, which represents the intersection of the current node set with the given node set.

  Parameters:
    `other` -

### deepIntersection

    public NodeSet deepIntersection(NodeSet other)

  Return a new node set, containing all nodes in this node set that are contained or have descendants in the other node set.

  Parameters:
    `other` -

### union

    public NodeSet union(NodeSet other)

  Return a new node set which represents the union of the current node set and the given node set.

  Parameters:
    `other` -

### except

    public NodeSet except(NodeSet other)

  Return a new node set containing all nodes from this node set except those nodes which are also contained in the argument node set.

  Parameters:
    `other` -

### setProcessInReverseOrder

    public void setProcessInReverseOrder(boolean inReverseOrder)

### getProcessInReverseOrder

    public boolean getProcessInReverseOrder()

### getContextNodes

    public NodeSet getContextNodes(int contextId)

  Returns all context nodes associated with the nodes in this node set.

  Parameters:
    `contextId` - used to track context nodes when evaluating predicate expressions. If contextId != `Expression.NO_CONTEXT_ID`, the current context will be added to each result of the of the selection.

### hasChanged

    public boolean hasChanged(int previousState)

### getState

    public int getState()

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Wolfgang Meier. All rights reserved.