## com.saxonica.schema
Interface Selection

All Known Implementing Classes:
  PathSelection, UnionSelection

    public interface Selection

A selection represents the restricted form of path expression permitted in XML Schema (both the selector and field variants)

Method Summary
`boolean` `canMatchAttributes()` Determine whether the selection can match attribute nodes
`boolean` `canMatchElementContent()` Determine whether the selection can match element content
`ItemType` `getItemType(TypeHierarchy th)` Return the type of the nodes selected by this selection
`boolean` `matchesAttribute(int nameCode)` Determine whether a given attribute matches the Selection
`boolean` `matchesElement(int[] stack, int length, int contextPosition)` Determine whether the selector matches a given element.
`String` `typeCheck(StaticContext env, ItemType contextItemType)` Check that the selection makes sense in the context of a given ItemType.

Method Detail

### matchesElement

    boolean matchesElement(int[] stack,
                           int length,
                           int contextPosition)

  Determine whether the selector matches a given element. The element is identified by an array of integers representing the fingerprints of the names of this element and each of its ancestors, in document order (i.e., root element first, matched element last).

  Parameters:
    `stack` - the array of name fingerprints
    `length` - the effective length of the array; any items beyond this position are ignored
    `contextPosition` - the position in this array of the context element for the selection.
  Returns:
    true if the element matches

### matchesAttribute

    boolean matchesAttribute(int nameCode)
                             throws ValidationException

  Determine whether a given attribute matches the Selection

  Returns:
    true if it matches, false if it does not match
  Throws:
    `ValidationException` - if there is more than one attribute that matches

### canMatchAttributes

    boolean canMatchAttributes()

  Determine whether the selection can match attribute nodes

### canMatchElementContent

    boolean canMatchElementContent()

  Determine whether the selection can match element content

### typeCheck

    String typeCheck(StaticContext env,
                     ItemType contextItemType)

  Check that the selection makes sense in the context of a given ItemType. Return null if the selection is OK, otherwise an error message

### getItemType

    ItemType getItemType(TypeHierarchy th)

  Return the type of the nodes selected by this selection

Copyright (C) Michael H. Kay. All rights reserved.