/** * 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"); }
/** Switch to specified lex state. */ public void SwitchTo(int lexState) throws XPathException { if (lexState >= 1 || lexState < 0) throw new XPathException("c-general-xpath"); else curLexState = lexState; }
/** * Obtains the token at the current position, then advance * the current position by one. * * If there's no such next token, this method throws * <tt>new XPathException("c-general-xpath");</tt>. */ public int nextToken() throws XPathException { if( fCurrentTokenIndex==fTokenCount ) throw new XPathException("c-general-xpath"); return fTokens[fCurrentTokenIndex++]; } /**
/** * Obtains the token at the current position, without advancing * the current position. * * If there's no such next token, this method throws * <tt>new XPathException("c-general-xpath");</tt>. */ public int peekToken() throws XPathException { if( fCurrentTokenIndex==fTokenCount ) throw new XPathException("c-general-xpath"); return fTokens[fCurrentTokenIndex]; } /**
public CastNode(XPathSyntaxTreeNode child, QName type) throws XPathException { this.child = child; if (!XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(type.uri)) { throw new XPathException("Casted type is not a built-in type"); } castedType = dvFactory.getBuiltInType(type.localpart); if (castedType == null) { throw new XPathException("Casted type is not a built-in type"); } }
public FunctionNode(QName name, XPathSyntaxTreeNode child) throws XPathException { if (!"not".equals(name.localpart) || !"http://www.w3.org/2005/xpath-functions".equals(name.uri)) { throw new XPathException("Only support fn:not function."); } this.name = name; this.child = child; }
public Object getValue(XMLAttributes attributes, NamespaceContext nsContext) throws Exception { String attrValue = attributes.getValue(name.uri, name.localpart); if (attrValue == null) { throw new XPathException("Attribute value is null"); } return attrValue; }
/** Constructs a selector XPath expression. */ public XPath(String xpath, SymbolTable symbolTable, NamespaceContext context) throws XPathException { super(normalize(xpath), symbolTable, context); // verify that an attribute is not selected for (int i=0;i<fLocationPaths.length;i++) { org.apache.xerces.impl.xpath.XPath.Axis axis = fLocationPaths[i].steps[fLocationPaths[i].steps.length-1].axis; if (axis.type == XPath.Axis.ATTRIBUTE) { throw new XPathException("c-selector-xpath"); } } } // <init>(String,SymbolTable,NamespacesScope)
private Token consumeToken(int kind) throws XPathException { Token oldToken; if ((oldToken = token).next != null) { token = token.next; } else { token = token.next = tokenSource.getNextToken(); } nextTokenIndex = -1; if (token.kind == kind) { gen++; return token; } token = oldToken; throw new XPathException("c-general-xpath"); }
/** Constructs a field XPath expression. */ public XPath(String xpath, SymbolTable symbolTable, NamespaceContext context) throws XPathException { super(fixupXPath(xpath), symbolTable, context); // verify that only one attribute is selected per branch for (int i=0;i<fLocationPaths.length;i++) { for(int j=0; j<fLocationPaths[i].steps.length; j++) { org.apache.xerces.impl.xpath.XPath.Axis axis = fLocationPaths[i].steps[j].axis; if (axis.type == XPath.Axis.ATTRIBUTE && (j < fLocationPaths[i].steps.length-1)) { throw new XPathException("c-fields-xpaths"); } } } } // <init>(String,SymbolTable,NamespacesContext)
protected void addToken(XPath.Tokens tokens, int token) throws XPathException { if ( token == XPath.Tokens.EXPRTOKEN_ATSIGN || token == XPath.Tokens.EXPRTOKEN_NAMETEST_QNAME || token == XPath.Tokens.EXPRTOKEN_OPERATOR_SLASH || token == XPath.Tokens.EXPRTOKEN_PERIOD || token == XPath.Tokens.EXPRTOKEN_NAMETEST_ANY || token == XPath.Tokens.EXPRTOKEN_NAMETEST_NAMESPACE || token == XPath.Tokens.EXPRTOKEN_OPERATOR_DOUBLE_SLASH || token == XPath.Tokens.EXPRTOKEN_OPERATOR_UNION || token == XPath.Tokens.EXPRTOKEN_AXISNAME_CHILD || token == XPath.Tokens.EXPRTOKEN_AXISNAME_ATTRIBUTE || token == XPath.Tokens.EXPRTOKEN_DOUBLE_COLON // ) { super.addToken(tokens, token); return; } throw new XPathException("c-general-xpath"); } };
/** * 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; }
private XPathSyntaxTreeNode Literal() throws XPathException { Token t; switch ((nextTokenIndex == -1) ? nextToken() : nextTokenIndex) { case NUMERIC_LITERAL: t = consumeToken(NUMERIC_LITERAL); return new LiteralNode(t.image, true); case STRING_LITERAL: t = consumeToken(STRING_LITERAL); return new LiteralNode(t.image.substring(1, t.image .length() - 1), false); default: array1[9] = gen; consumeToken(-1); throw new XPathException("c-general-xpath"); } }
private XPathSyntaxTreeNode SimpleValue() throws XPathException { XPathSyntaxTreeNode n; switch ((nextTokenIndex == -1) ? nextToken() : nextTokenIndex) { case SYMBOL_AT: n = AttrName(); return n; case NUMERIC_LITERAL: case STRING_LITERAL: n = Literal(); return n; default: array1[8] = gen; consumeToken(-1); throw new XPathException("c-general-xpath"); } }
throw new XPathException("c-general-xpath-ns"); throw new XPathException("c-general-xpath");
private XPathSyntaxTreeNode ValueExpr() throws XPathException { switch ((nextTokenIndex == -1) ? nextToken() : nextTokenIndex) { case NCNAME: QName name = QName(); consumeToken(OPEN_PARAN); XPathSyntaxTreeNode n1 = SimpleValue(); consumeToken(CLOSE_PARAN); return new CastNode(n1, name); case SYMBOL_AT: case NUMERIC_LITERAL: case STRING_LITERAL: return CastExpr(); default: array1[3] = gen; consumeToken(-1); throw new XPathException("c-general-xpath"); } }
array1[5] = gen; consumeToken(-1); throw new XPathException("c-general-xpath");
throw new XPathException("Casted type is not a built-in type"); throw new XPathException("Casted type is not a built-in type"); throw new XPathException("Casted type is not a built-in type"); throw new XPathException("Casted type is not a built-in type"); return DataMatcher.compareActualValues(obj1, obj2, comp, simpleType); } else { throw new XPathException("Invalid comparison between incompatible types"); throw new XPathException("Invalid comparison");
array1[3] = gen; consumeToken(-1); throw new XPathException("c-general-xpath");
input_stream.backup(1); throw new XPathException("c-general-xpath");