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
 void displayExpression(ExpressionPresenter out)
          Diagnostic print of expression structure.
 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(ExpressionVisitor visitor, 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

Parameters:
nameCode - the integer nameCode of an attribute
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

Returns:
true if the selection can match attributes

canMatchElementContent

boolean canMatchElementContent()
Determine whether the selection can match element content

Returns:
true if the selection can match elements

typeCheck

String typeCheck(ExpressionVisitor visitor,
                 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

Parameters:
visitor - the expression visitor
contextItemType - the type of the context item
Returns:
an error messge if the expression is invalid

getItemType

ItemType getItemType(TypeHierarchy th)
Return the type of the nodes selected by this selection

Parameters:
th - the type hierarchy cache
Returns:
the item type of the selected nodes

displayExpression

void displayExpression(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

Parameters:
out - the place where the structure is to be written


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