/** * Determine the data type of the items returned by this expression * * @return Type.NODE or a subtype, based on the NodeTest in the axis step, plus information about * the content type if this is known from schema analysis * @param th the type hierarchy cache */ public final ItemType getItemType(TypeHierarchy th) { if (itemType != null) { return itemType; } int p = Axis.principalNodeType[axis]; switch (p) { case Type.ATTRIBUTE: case Type.NAMESPACE: return NodeKindTest.makeNodeKindTest(p); default: if (test == null) { return AnyNodeTest.getInstance(); } else { return test; // return NodeKindTest.makeNodeKindTest(test.getPrimitiveType()); } } }