Package our.apache.commons.jxpath

Examples of our.apache.commons.jxpath.JXPathException


                  getSequence();
            for (int j=0; j<seq.getLength(); j++) {
          itemsArray.add(seq.getItem(j+1));
              }
        } catch (Exception e) {
            throw new JXPathException("Cannot evaluate nested expression " +
                                this.toString());
        }
           }
           Item[] items = (Item[]) itemsArray.toArray(new Item[] {});
           result = factory.createSequence(items);
View Full Code Here


                    getSequence();

            result = PipelineExpressionHelper.compare(lseq, rseq, comparator);
        } catch (ExpressionException e) {
            // Tunnel the exception out in a JXPath runtime exception
            throw new JXPathException(
                    "Illegal argument to comparison: " + e);
        }
        return result;
    }
View Full Code Here

                    .getSequence();

            result = PipelineExpressionHelper.compute(lseq, rseq, operator);
        } catch (ExpressionException e) {
            // Tunnel the exception out in a JXPath runtime exception
            throw new JXPathException("Illegal argument to operation: " + e);
        }
        return result;
    }
View Full Code Here

            Sequence seq = JXPathExpression.asValue(factory, arg).getSequence();

            result = PipelineExpressionHelper.compute(seq, operator);
        } catch (ExpressionException e) {
            // Tunnel the exception out in a JXPath runtime exception
            throw new JXPathException("Illegal argument to operation: " + e);
        }
        return result;
    }
View Full Code Here

                        factory, operandEval).getSequence();

                // convert the sequence to the "effective boolean value"
                eval = PipelineExpressionHelper.fnBoolean(sequence);
            } catch (ExpressionException e) {
                throw new JXPathException("Error when evaluating the " + i +
                                          "operand of the OR function", e);
            }
        }
        // return the result as an Object
        return eval;
View Full Code Here

            Sequence sequence =
                    JXPathExpression.asValue(factory, operand).getSequence();
            return PipelineExpressionHelper.fnNumber(sequence, factory);
        } catch (ExpressionException e) {
            // Tunnel the exception out in a JXPath runtime exception
            throw new JXPathException(
                    "Illegal argument to fn:number(): " + e);
        }
    }
View Full Code Here

            Sequence sequence =
                    JXPathExpression.asValue(factory, operand).getSequence();
            return PipelineExpressionHelper.fnNot(sequence);
        } catch (ExpressionException e) {
            // Tunnel the exception out in a JXPath runtime exception
            throw new JXPathException(
                    "Illegal argument to fn:not(): " + e);
        }
    }
View Full Code Here

            Sequence sequence =
                    JXPathExpression.asValue(factory, operand).getSequence();
            return PipelineExpressionHelper.fnBoolean(sequence);
        } catch (ExpressionException e) {
            // Tunnel the exception out in a JXPath runtime exception
            throw new JXPathException(
                    "Illegal argument to fn:boolean(): " + e);
        }
    }
View Full Code Here

    // javadoc inherited
    protected Object functionConcat(EvalContext context) {
        if (getArgumentCount() < 2) {
            // the concat function must be invoked with 2 or more arguments
            throw new JXPathException(
                    "concat function must have at least two arguments. " +
                    "Actual argument count is " + getArgumentCount());
        }

        // use a string buffer to perform the concatenation
        StringBuffer buffer = new StringBuffer();
        Expression[] operands = getArguments();
        Sequence sequence;
        try {
            for (int i = 0; i < operands.length; i++) {

                // evaluate the operand and convert it to a sequence
                sequence = JXPathExpression.asValue(
                        factory,
                        operands[i].computeValue(context)).getSequence();

                int length = sequence.getLength();
                // 1) If sequence is empty then we append the empty string.
                // 2) If sequence has one item we convert the item to a string
                //    and append to the buffer
                // 3) If sequence contains more that one item we raise an error
                if (length == 1) {
                    buffer.append(
                            sequence.getItem(1).stringValue().asJavaString());
                } else if (length > 1) {
                    throw new JXPathException(
                            "fn:concat cannot accept a sequence operand " +
                            "with more than one item");
                }
            }
        } catch (ExpressionException e) {
            // Tunnel the exception out in a JXPath runtime exception
            throw new JXPathException(
                    "Illegal argument to fn:concat(): " + e);
        }
        // return the concatenated arguments as a StringValue
        return factory.createStringValue(buffer.toString());
    }
View Full Code Here

     * </p>
     * @param count the expected argument count
     */
    private void assertArgumentCount(int count) {
        if (getArgumentCount() != count) {
            throw new JXPathException("Incorrect number of arguments: " + this);
        }
    }
View Full Code Here

TOP

Related Classes of our.apache.commons.jxpath.JXPathException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.