case EXPRTOKEN_NAMETEST_NAMESPACE: System.out.print("<NAMETEST_NAMESPACE"); System.out.print(" prefix=\"" + getTokenString(fTokens[++i]) + "\""); System.out.print("/>"); break; System.out.print("<NAMETEST_QNAME"); if (fTokens[++i] != -1) System.out.print(" prefix=\"" + getTokenString(fTokens[i]) + "\""); System.out.print(" localpart=\"" + getTokenString(fTokens[++i]) + "\""); System.out.print("/>"); break; System.out.print("<FUNCTION_NAME"); if (fTokens[++i] != -1) System.out.print(" prefix=\"" + getTokenString(fTokens[i]) + "\""); System.out.print(" localpart=\"" + getTokenString(fTokens[++i]) + "\""); System.out.print("/>"); break; case EXPRTOKEN_LITERAL: System.out.print("<LITERAL"); System.out.print(" value=\"" + getTokenString(fTokens[++i]) + "\""); System.out.print("/>"); break; case EXPRTOKEN_NUMBER: System.out.print("<NUMBER"); System.out.print(" whole=\"" + getTokenString(fTokens[++i]) + "\""); System.out.print(" part=\"" + getTokenString(fTokens[++i]) + "\"");
addToken(tokens, XPath.Tokens.EXPRTOKEN_LITERAL); starIsMultiplyOperator = true; tokens.addToken(symbolTable.addSymbol(data.substring(litOffset, litOffset + litLength))); if (++currentOffset == endOffset) { break; tokens.addToken(prefixHandle); tokens.addToken(nameHandle); break; } else { addToken(tokens, XPath.Tokens.EXPRTOKEN_FUNCTION_NAME); tokens.addToken(prefixHandle); tokens.addToken(nameHandle); addToken(tokens, XPath.Tokens.EXPRTOKEN_NAMETEST_NAMESPACE); starIsMultiplyOperator = true; tokens.addToken(nameHandle); } else { addToken(tokens, XPath.Tokens.EXPRTOKEN_NAMETEST_QNAME); starIsMultiplyOperator = true; tokens.addToken(prefixHandle); tokens.addToken(nameHandle);
final XPath.Tokens xtokens = new XPath.Tokens(fSymbolTable); while (xtokens.hasMore()) { final int token = xtokens.nextToken(); Step step = new Step( new Axis(Axis.ATTRIBUTE), parseNodeTest(xtokens.nextToken(),xtokens,context)); stepsVector.addElement(step); expectingStep=false; if (xtokens.nextToken() != XPath.Tokens.EXPRTOKEN_DOUBLE_COLON) { throw new XPathException("c-general-xpath"); parseNodeTest(xtokens.nextToken(),xtokens,context)); stepsVector.addElement(step); expectingStep = false; if (xtokens.nextToken() != XPath.Tokens.EXPRTOKEN_DOUBLE_COLON) { throw new XPathException("c-general-xpath"); parseNodeTest(xtokens.nextToken(),xtokens,context)); stepsVector.addElement(step); expectingStep = false; if( xtokens.hasMore() && xtokens.peekToken() == XPath.Tokens.EXPRTOKEN_OPERATOR_DOUBLE_SLASH){ xtokens.nextToken();
case XPath.Tokens.EXPRTOKEN_NAMETEST_QNAME: String prefix = xtokens.nextTokenAsString(); String uri = null; if (context != null && prefix != XMLSymbols.EMPTY_STRING) { return new NodeTest(prefix,uri); String localpart = xtokens.nextTokenAsString(); String rawname = prefix != XMLSymbols.EMPTY_STRING ? fSymbolTable.addSymbol(prefix+':'+localpart)
/** * Obtains the token at the current position as a String. * * If there's no current token or if the current token * is not a string token, this method throws * <tt>new XPathException("c-general-xpath");</tt>. */ public String nextTokenAsString() throws XPathException { String s = getTokenString(nextToken()); if(s==null) throw new XPathException("c-general-xpath"); return s; }
/** * This method adds the specified token to the token list. By * default, this method allows all tokens. However, subclasses * of the XPathExprScanner can override this method in order * to disallow certain tokens from being used in the scanned * XPath expression. This is a convenient way of allowing only * a subset of XPath. */ protected void addToken(XPath.Tokens tokens, int token) throws XPathException { tokens.addToken(token); } // addToken(int)
public void addToken(String tokenStr) { Integer tokenInt = (Integer)fTokenNames.get(tokenStr); if (tokenInt == null) { tokenInt = new Integer(fTokenNames.size()); fTokenNames.put(tokenInt, tokenStr); } addToken(tokenInt.intValue()); }