|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.saxonica.schema.PathSelection
public class PathSelection
A PathSelection is a Selection that applies a NodeTest to each element between the context element and the node being tested, and returns true if they all match. This class is used internally in the validation of instance documents against uniqueness and identity constraints; it is not intended for use by user applications.
Constructor Summary | |
---|---|
PathSelection(NodeTest[] tests,
boolean anchored,
NodeTest attributeTest,
Expression xpath)
Create a PathSelection - a limited form of XPath expression that can be evaluated on-the-fly |
Method Summary | |
---|---|
boolean |
canMatchAttributes()
Determine whether the selection can match attribute nodes |
boolean |
canMatchElementContent()
Determin whether the selection can match element content |
void |
displayExpression(ExpressionPresenter out)
Diagnostic print of expression structure. |
NodeTest |
getAttributeTest()
Get the attribute test at the end of the path, if there is one |
ItemType |
getItemType()
Determine the item type of the nodes matched by the last NodeTest |
ItemType |
getItemType(TypeHierarchy th)
Return the type of the nodes selected by this selection |
boolean |
matchesAttribute(int fingerprint)
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PathSelection(NodeTest[] tests, boolean anchored, NodeTest attributeTest, Expression xpath)
tests
- an array of node tests, representing a sequence of axis steps; these are all tests
on the child axis, except possibly the last, which is a test on the attribute axis if attributeTest is trueanchored
- if true, the first test applies to children of the root node; if false, it applies to
descendants of the root nodeattributeTest
- if true, the last test applies to attributes rather than elements.xpath
- An XPath expression equivalent to the PathSelection. This is never evaluated, but is
used for type analysis and diagnostic display.Method Detail |
---|
public boolean matchesElement(int[] stack, int length, int contextPosition)
matchesElement
in interface Selection
stack
- the array of name fingerprintslength
- the effective length of the array; any items beyond this
position are ignoredcontextPosition
- the position in this array of the context element
for the selection.
public NodeTest getAttributeTest()
public boolean matchesAttribute(int fingerprint)
matchesAttribute
in interface Selection
fingerprint
- the integer nameCode of an attribute
public boolean canMatchAttributes()
canMatchAttributes
in interface Selection
public boolean canMatchElementContent()
canMatchElementContent
in interface Selection
public ItemType getItemType()
public String typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
typeCheck
in interface Selection
visitor
- the expression visitorcontextItemType
- the type of the context item
public ItemType getItemType(TypeHierarchy th)
getItemType
in interface Selection
th
- the type hierarchy cache
public void displayExpression(ExpressionPresenter out)
displayExpression
in interface Selection
out
- the place where the structure is to be written
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |