}
public XpathExpression convert(XpathExprType newType)
throws InvalidXpathTypeConversion {
if (!this.getXpathType().equals(XpathExprType.NODE_SET_EXPR_TYPE) &&
newType.equals(XpathExprType.NODE_SET_EXPR_TYPE))
throw new InvalidXpathTypeConversion();
else if (!this.getXpathType().equals(XpathExprType.NULL_EXPR_TYPE) &&
!this.getXpathType().equals(XpathExprType.UNKNOWN_EXPR_TYPE)){
if (newType.equals(XpathExprType.BOOLEAN_EXPR_TYPE))
return new XpathBoolFunction(this);
else if (newType.equals(XpathExprType.NUMBER_EXPR_TYPE))
return new XpathNumberFunction(this);
else if (newType.equals(XpathExprType.STRING_EXPR_TYPE))
return new XpathStringFunction(this);
} else
throw new InvalidXpathTypeConversion();
return null;
}