/** Constructor. */ public XPath20Parser(java.io.Reader stream, NamespaceContext nsContext) { fNsContext = nsContext; inputStream = new SimpleCharStream(stream, 1, 1); tokenSource = new XPath20ParserTokenManager(inputStream); token = new Token(); nextTokenIndex = -1; gen = 0; for (int i = 0; i < 10; i++) array1[i] = -1; }
private int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; jjmatchedPos = pos; try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { return pos + 1; } return jjMoveNfa_0(state, pos + 1); }
/** * 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; }
/** Constructs an XPath object from the specified expression. */ public XPath(String xpath, SymbolTable symbolTable, NamespaceContext context) throws XPathException { fExpression = xpath; fSymbolTable = symbolTable; fLocationPaths = parseExpression(context); if (DEBUG_XPATH_PARSE) { System.out.println(">>> "+fLocationPaths); } } // <init>(String,SymbolTable,NamespaceContext)
/** * Returns a representation of all location paths for this XPath. * XPath = locationPath ( '|' locationPath) */ public LocationPath[] getLocationPaths() { LocationPath[] ret=new LocationPath[fLocationPaths.length]; for (int i=0;i<fLocationPaths.length;i++){ ret[i]=(LocationPath)fLocationPaths[i].clone(); } return ret; } // getLocationPath(LocationPath)
/** * Used by the {@link #parseExpression(NamespaceContext)} method * to verify the assumption. * * If <tt>b</tt> is false, this method throws XPathException * to report the error. */ private static void check( boolean b ) throws XPathException { if(!b) throw new XPathException("c-general-xpath"); }
private XPathSyntaxTreeNode AttrName() throws XPathException { consumeToken(SYMBOL_AT); return new AttrNode(NameTest()); }
private XPathSyntaxTreeNode Test() throws XPathException { XPathSyntaxTreeNode n; n = OrExpr(); consumeToken(25); return n; }
/** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); }
/** Start. */ public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; }
/** Reinitialise parser. */ public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); }
private int nextToken() throws XPathException { if ((nextToken = token.next) == null) { return (nextTokenIndex = (token.next = tokenSource.getNextToken()).kind); } else { return (nextTokenIndex = nextToken.kind); } } }
/** Constructor. */ public XPath20ParserTokenManager(SimpleCharStream stream, int lexState) throws XPathException { this(stream); SwitchTo(lexState); }
public boolean evaluate(QName element, XMLAttributes attributes, NamespaceContext nsContext) throws Exception { boolean lhs = child1.evaluate(element, attributes, nsContext); boolean rhs = child2.evaluate(element, attributes, nsContext); if (conjunction == OR) { return lhs || rhs; } else { return lhs && rhs; } } }
/** Copy constructor. */ protected LocationPath(LocationPath path) { steps = new Step[path.steps.length]; for (int i = 0; i < steps.length; i++) { steps[i] = (Step)path.steps[i].clone(); } } // <init>(LocationPath)
/** * 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)
/** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); }
/** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); }