Regular expressions to parse arithmetic expression

Hello,
I would like to parse arithmetic expressions like the following
"5.2 + cos($PI/2) * -5"where valid expression entities are numbers, operations, variables and paranthesis. Until now I have figured out some regular expressions to match every type of entities that I need, and combine them into one big regex supplied to a pattern and matcher. I will paste some code now to see what I wrote:
public class RegexTest {
    /** A regular expression matching numeric expressions (floating point numbers) */
    private static final String REGEX_NUMERIC = "(-?[0-9]+([0-9]*|[\\.]?[0-9]+))";
    /** A regular expression matching a valid variable name */
    private static final String REGEX_VARIABLE = "(\\$[a-zA-Z][a-zA-Z0-9]*)";
    /** A regular expression matching a valid operation string */
    public static final String REGEX_OPERATION = "(([a-zA-Z][a-zA-Z0-9]+)|([\\*\\/\\+\\-\\|\\?\\:\\@\\&\\^<>'`=%#]{1,2}))";
    /** A regular expression matching a valid paranthesis */
    private static final String REGEX_PARANTHESIS = "([\\(\\)])";
    public static void main(String[] args) {
        String s = "5.2 + cos($PI/2) * -5".replaceAll(" ", "");
        Pattern p = Pattern.compile(REGEX_OPERATION + "|" + REGEX_NUMERIC + "|" + REGEX_VARIABLE + "|" + REGEX_PARANTHESIS);
        Matcher m = p.matcher(s);
        while (m.find()) {
            System.out.println(m.group());
}The output is
5
2
+
cos
$PI
2
5There are a few problems:
1. It splits "5.2" into "5" and "2" instead of keeping it together (so there might pe a problem with REGEX_NUMERIC although "5.2".matches(REGEX_NUMERIC) returns true)
2. It interprets "... * -5" as the operation " *- " and the number "5" instead of " * " and "-5".
Any solution to solve these 2 problems are greately appreciated. Thank you in advance.
Radu Cosmin.

cosminr wrote:
So, I've written some concludent examples and the output after parsing (separated by " , " ):
String e1 = "abs(-5) + -3";
// output now: abs , ( , - , 5 , ) , + , - , 3 ,
// should be:  abs , ( , -5 , ) , + , - , 3 , (Notice the -5)
I presume that should also be "-3" instead of ["-", "3"].
String e2 = "sqrt(abs($x=1 + -10))";
// output now: sqrt , ( , abs , ( , $x , = , 1 , + , - , 10 , ) , ) ,
// should be:  sqrt , ( , abs , ( , $x , = , 1 , + , -10 , ) , ) ,   (Notice the -10)
String e3 = "$e * -1 + (2 - sqrt(4))";
// output now: $e , * , - , 1 , + , ( , 2 , - , sqrt , ( , 4 , ) , ) ,
// should be:  $e , * , -1 , + , ( , 2 , - , sqrt , ( , 4 , ) , ) ,
String e4 = "sin($PI/4) - 3";
// output now: sin , ( , $PI , / , 4 , ) , - , 3 , (This one is correct)
String e5 = "sin($PI/4) - -3 - (-4)";
// output now: sin , ( , $PI , / , 4 , ) , - , - , 3 , - , ( , - , 4 , ) ,
// should be:  sin , ( , $PI , / , 4 , ) , - , -3 , - , ( , -4 , ) ,  (Notice -3 and -4)I hope they are relevant, If not I will supply some more.I made a small change to REGEX_NUMERIC and also put REGEX_NUMERIC at the start of the "complete pattern" when the Matcher is created:
import java.util.regex.*;
class Test {
    private static final String REGEX_NUMERIC = "(((?<=[-+*/(])|(?<=^))-)?\\d+(\\.\\d+)?";
    private static final String REGEX_VARIABLE = "\\$[a-zA-Z][a-zA-Z0-9]*";
    public static final String REGEX_OPERATION = "[a-zA-Z][a-zA-Z0-9]+|[-*/+|?:@&^<>'`=%#]";
    private static final String REGEX_PARANTHESIS = "[()]";
    public static void main(String[] args) {
        String[] tests = {
            "abs(-5) + -3",
            "sqrt(abs($x=1 + -10))",
            "$e * -1 + (2 - sqrt(4))",
            "sin($PI/4) - 3",
            "sin($PI/4) - -3 - (-4)",
            "-2-4" // minus sign at the start of the expression
        Pattern p = Pattern.compile(REGEX_NUMERIC + "|" + REGEX_OPERATION + "|" + REGEX_VARIABLE + "|" + REGEX_PARANTHESIS);
        for(String s: tests) {
            s = s.replaceAll("\\s", "");
            Matcher m = p.matcher(s);
            System.out.printf("%-21s-->", s);
            while (m.find()) {
                System.out.printf("%6s", m.group());
            System.out.println();
}Note that since Java's regex engine does not support "variable length look behinds", you will need to remove the white spaces from your expression, otherwise REGEX_NUMERIC will go wrong if a String looks like this:
"1 - - 1"Good luck!

Similar Messages

  • Parsing an arithmetic expression

    Hi,
    I'd like to get the result of an arithmetic expression. I found some algorithms which describe how to get the result of an expression with parens and the four basic operations (+, -, *, /). Now I want to do this to an expression with all the operations you can find on a scientific calculator, for example sin, cos, log, ^, sqrt, nCr, ! ...
    I mean something like this:
    sin(2x)*sqrt(8.5x/1.25)+5/x^3-x^(2-5x)-5!
    The algorithm would have to return -123.1322 in this case.
    Does anyone know how normal calculators does this? I am more interested in the basic idea and not the coding itself.
    I thought about something like this:
    solve(expression)
       do until there is a result:
          if there are no other operations in the expression than +, -, *,/ and parens, then:
             calculate the result and return it
          else:
             search the first operation which is not +, -, * or / , for example sin(...)
             get the caption in the brackets
             solve(caption in the brackets)      <--- recursive functionDo you have a better idea? I am nor sure this is a good algorithm.
    DrummerB
    Edited by: DrummerB on Feb 28, 2008 5:30 PM

    Hello DrummerB,
    I reckon that without getting into the theory (which I recommend), the simplest way to achieve the goal is using cascading.
    1. Order all operations by precedence, example:
    operators | precedence
         +, - | 0
         *, / | 1
            ! | 2
            - | 3 (unary minus)2. Create a parsing/solving algorithm, example:
    solveExpr(e)
        ts := token stream for e
        return solveAdditiveExpr(ts)
    solveAdditiveExpr(ts)
        left := solveMultiplicativeExpr(ts)
        while next token in ts is "+" or "-"
            right := solveMultiplicativeExpr(ts)
            if next token in ts is "+"
                left := left + right
            else
                left := left - right
            consume next token in ts
        return left
    solveMultiplicativeExpr(ts)
        left := solveFacultyExpr(ts)
        while next token in ts is "*" or "/"
            right := solveFacultyExpr(ts)
            if next token in ts is "*"
                left := left * right
            else
                left := left / right
            consume next token in ts
        return left
    solveFacultyExpr(ts)
        left := solveUnaryMinusExpr(ts)
        while next token in ts is "!"
            left := faculty of left
            consume next token in ts
        return left
    solveUnaryMinusExpr(ts)
        negative := false
        while next token in ts is "-"
            negative := !negative
            consume next token in ts
        if negative
            return -number(ts)
        else
            return number(ts)
    number(ts)
        the next token in ts must be a number, consume and return itExample:
    e := "10 + -5 / 3 * 5! - - - - -7"
    => ts := <10, "+", "-", 5, "/", 3, "*", 5, "!", "-", "-", "-", "-", "-", 7>
    solveExpr(e) = (10 + (((-5) / 3) * (5!))) - 7 = -197With kind regards
    Ben

  • Regex for arithmetic expressions

    Hi all,
    I am new to Java. I was wondering if anyone can help me understand how regular expressions work. My problem is how to come up with a regular expression that would match a simple arithmetic expression like:
    a + b + c + d
    And I want to capture things by groups. I largely suspect that I should use something like:
    (\\w+)(\\s\\+\\s(\\w+))*
    (I use the \\s here because \\b doesn't seem to work)
    would work by capturing the first word like sequence with (\\w+), and the succeeding repeats of the plus sign and another word being captured by (\\s\\+\\s(\\w+))*. Didn't work though. Can anyone tell me what's wrong and how to think of a better way of handling these sort of expressions?
    The code I tried goes like:
    String patt = "(\\w+)(\\s\\+\\s(\\w+))*";
    String feed = "a + b + c + d";
    Pattern p = Pattern.compile(patt);
    Matcher m = p.matcher(feed);
    /* here I want to see if the groupings work somehow*/
    if(m.find()){
    for(int i=0; i<=m.groupCount(); i++)
    System.out.println(m.group(i));
    Thanks

    Sorry about that. Here's the correctly formatted post:
    So, with a simple arithmetic expression like:
    a + b + c + dI want to capture things by groups and I thought of using something like:
    (\\w+)(\\s\\+\\s(\\w+))*(I use the \\s here because \\b doesn't seem to work)
    with the idea of capturing the first word like sequence with (\\w+), and the succeeding repeats of the plus sign and another word being captured by (\\s\\+\\s(\\w+))*. As this didn't work, can anyone tell me what's wrong and how to think of a better way of handling these sort of expressions?
    The code I tried goes like:
    String patt = "(\\w+)(\\s\\+\\s(\\w+))*";
    String feed = "a + b + c + d";
    Pattern p = Pattern.compile(patt);
    Matcher m = p.matcher(feed);then I want to see if the groupings work somehow
    if(m.find()){
    for(int i=0; i<=m.groupCount(); i++)
    System.out.println(m.group(i));
    }and yes, I am wondering if arithmetic parsing would be possible with regex. I have implemented something similar before using combinations of simple tokenization and character checks, but I want to make cleaner looking code. Would using regular expressions be a bad choice? What if I feed something like:
    (a + b) + (c + d)

  • Thread to evaluate arithmetic expressions

    I'm trying to write a program that evalutaes arithmetic expression concurrently using Java concurency primitives. The idea behind the threading is to avoid multiple evaluations of common subexpression. I have attached the code that I have written so far but was hoping someone could offer me a hand with the evaluate() and run() methods contained at the end of the program. Thanks.
    public class Example {
         public static void main(String[] args) {
              BinaryOp plus = new BinaryOp() {
                   public int apply(int n1, int n2) {
                        return n1 + n2;
              BinaryOp times = new BinaryOp() {
                   public int apply(int n1, int n2) {
                        return n1 * n2;
              Arith e1 = new Operator(plus, new Number(4), new Number(5));
              Arith e2 = new Operator(plus,new Operator(times, new Number(3), e1),
                   new Operator(plus, e1, new Number(6)));
              Arith e3 = new Operator(times, e2, e2);
              System.out.println(e3.evaluate());
    interface BinaryOp {
         // An operator that can be applied to two numbers
         int apply(int n1, int n2);
    interface Arith {
         // An arithmetic expression that can be evaluated.
         int evaluate();
    class Number implements Arith {
         private int n;
         Number(int n) {
              this.n = n;
         public int evaluate() { // A number evaluates to itself.
              return n;
    class Operator implements Arith, Runnable {
         private BinaryOp op;
         private Arith e1;
         private Arith e2;
         private boolean done = false;
         private int result = 0; // holds the result of previous evaluation
         Operator(BinaryOp op, Arith e1, Arith e2) {
              this.op = op;
              this.e1 = e1;
              this.e2 = e2;
              (new Thread(this)).start();
         public int evaluate() {
         public void run() {
    }

    I'm trying to write a program that evalutaes arithmetic expression
    concurrently using Java concurency primitives. The idea behind the
    threading is to avoid multiple evaluations of common subexpression. Interesting ... the main problem however is to find those common
    subexpressions. Most of the evaluation of those common subexpressions
    can be done in the parse/compile phase though, effectively elliminating
    the need for threads, e.g. (foo+bar)-(foo+bar) can be deduced to be
    equal to zero if both 'foo' and 'bar' happen to referential transparent,
    i.e. they don't have side effects.
    What you're doing now is just starting a new thread for every binary operator.
    This is, most likely, not what you want. The strategy of what thread to
    start for which subexpression must have layed out the sequence of
    threads to start before actual evaluation is started (also see above).
    kind regards,
    Jos

  • Parsing XPath Expressions

    Is there a Java API that parses XPath expressions and produces the resultant XPath tree in memory?
    For example the xpath expression: /a/b[c/d]/e/f
    will produce a tree with "a" as the root node, "b" as a sub-node, "c" and "e" as subnodes of "b" and so on.
    I don't want one that is to be evaluate against and XML document. I just want the XPath Expression tree to be build in memory.
    Thanks

    hi,
    look at javacc, a compiler very popular, with many examples.
    Raymond

  • Why I'm getting the jxls Error : Can't parse an expression rm.exec

    Hi,
    I used the RowSet in JXLS and it's working perfectly, but I'm getting Error when I use the SQL Reporting in JXLS
    Error : java.lang.RuntimeException: Can't parse an expression rm.exec('select name from Designer' )
    My Java File :
    package net.sf.jxls.report;
    import net.sf.jxls.exception.ParsePropertyException;
    import net.sf.jxls.transformer.XLSTransformer;
    import net.sf.jxls.report.ReportManager;
    import net.sf.jxls.report.ReportManagerImpl;
    import java.sql.*;
    import java.util.Map;
    import java.util.HashMap;
    public class QReport {
    private static String templateFileName = "examples/Report/QReport.xls";
    private static String destFileName = "examples/Report/QReport_Out.xls";
    public static void main(String[] args) throws Exception, ClassNotFoundException, SQLException {
    if (args.length >= 2) {
    templateFileName = args[0];
    destFileName = args[1];
    try {
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
         Connection con = DriverManager.getConnection("jdbc:odbc:NewDB");
         Map beans = new HashMap();
         ReportManager reportmanager = new ReportManagerImpl(con, beans);
         beans.put("rm", reportmanager);
         XLSTransformer transformer = new XLSTransformer();
         transformer.transformXLS(templateFileName, beans, destFileName);
    }catch(Exception e){
         System.out.println("Error : "+e);
    The Excel file as follows
    <jx:forEach items="${rm.exec('select name from Designer' )}" var="design">
    ${design.name}
    </jx:forEach>
    Thanks in advance.

    Hi,
    I don't know JXLS and this for sure is the wrong forum to ask this question (I suggest to discuss problems with the source code originator at Sourceforge), however
    ${rm.exec('select name from Designer' )}"
    can't work because by definition, Expression language doesn't take arguments. There is only one option to pass an argument to Expression Language and this is when the method you access in fact is a wrapped hashmap. So my assumption is that the exception occurs because of the wrong use of EL.
    If you looked at the sample on SourceForge you could see that I am right
    http://jxls.sourceforge.net/samples/tagsample.html
    Frank

  • "ABAP Basics" Book - arithmetic expression error in the sample code

    Hi all,
    I have just started learning ABAP on mini SAP system (NW7.01) by following "ABAP Basics" book.
    This question might be a FAQ, but I have spent a few days searching a right answer without success.
    I appreciate if you could help me on this.
    On the page 162, there is a function module sample, which contains the line as following:
    e_amount = i_km * '0.3'.
    Here l_km (import) is type of i, and e_amount (export) is type of f.
    Though I do not think of any problem with this line, it throws an arithmetic expression error when executed directly for testing as well as when called from a program.
    When I tried a similar thing in a program, it was fine.
    However within a function module it throws this error.
    Thanks in advance.
    Terry

    Like I said before, I do not think any problem about the code itself.
    I suspect some environmental things?
    I should have mentioned SAP mini system NW7.01 is running on Vista Business?
    To be specifc, I receive this message:
    Arithmetic operations are only expected for operands that can be converted to numbers.
    (numeric operands). - (numeric operands). - - - -
    with the following function module:
    [code]
    FUNCTION ZPTB00_CALCULATE_TRAVEL_EXPENS.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_KM) TYPE REF TO  I
    *"  EXPORTING
    *"     VALUE(E_AMOUNT) TYPE REF TO  F
    *"  EXCEPTIONS
    *"      FAILED
    e_amount = i_km * '0.3'.
    IF sy-subrc <> 0.
      RAISE failed.
    ENDIF.
    ENDFUNCTION.
    [/code]

  • Need help regarding Arithmetic Expressions

    Hi Experts,
    I have a requirement where in I need to pass Arithmetic Expressions (+,-,/) as constants to a subroutine.For ex:
    constants:c_p   type char1 value '+',
                     c_m   type char1 value '-',
    data:v_a type char1 value '2',
             v_b type char1 value '6',
            v_r    type string.
    v_r = v_ a   + v_b.
    In the above instead of + I want use c_p.Please help me out is there any other way in defining Arithmetic expresiions where I could use constants or variables instead of directly using these expressions(+,-).Thanks in advance.
    With Regards,
    Srini..

    Hello Srini,
    I think you must have a look at the FMs belonging to FuGr. CALC.
    For e.g.,  EVAL_FORMULA which evaluates Literal or Variable formulas
    CONSTANTS:
    C_P TYPE CHAR1 VALUE '+',
    C_M TYPE CHAR1 VALUE '-'.
    DATA:
    V_A TYPE CHAR1 VALUE '2',
    V_B TYPE CHAR1 VALUE '6',
    V_FORMULA TYPE STRING,
    V_RES_F   TYPE F,
    V_RES_P   TYPE P.
    CONCATENATE V_A C_P V_B INTO V_FORMULA SEPARATED BY SPACE.
    CALL FUNCTION 'EVAL_FORMULA'
      EXPORTING
        FORMULA                 = V_FORMULA
      IMPORTING
        VALUE                   = V_RES_F
      EXCEPTIONS
        DIVISION_BY_ZERO        = 1
        EXP_ERROR               = 2
        FORMULA_TABLE_NOT_VALID = 3
        INVALID_EXPRESSION      = 4
        INVALID_VALUE           = 5
        LOG_ERROR               = 6
        PARAMETER_ERROR         = 7
        SQRT_ERROR              = 8
        UNITS_NOT_VALID         = 9
        MISSING_PARAMETER       = 10
        OTHERS                  = 11.
    IF SY-SUBRC = 0.
      MOVE V_RES_F TO V_RES_P.
      WRITE: V_RES_P .
    ENDIF.
    BR,
    Suhas

  • Add spaces in arithmetic expressions

    Hi experts,
    i have to insert spaces in arithmetical expressions written by users.
    For example:
    INPUT (by USERS): A+B-SQRT(C)/(D**2)
    OUTPUT (by Program): A + B - SQRT( C ) / ( D ** 2 )
    Possible arithmetic operators are:
    +; - ; *; /; **; SQRT()
    Any hints will be rewarded.
    Thanks in advance.
    Fabio.

    Thanks to all guys!
    the right code is a mixt of yours hints:
      l_len = STRLEN( tb_mzcatc-/bic/zformatc ).
      DO.
        l_char = input+n(1).
        CASE l_char.
          WHEN 'Q' OR
               'R'.
            CONCATENATE formula l_char INTO formula.
          WHEN 'T'.
            l_char = input+n(2).
            CONCATENATE formula l_char INTO formula.
            n = n + 1.
          WHEN '*'.
            IF input+n(2) = '**'.
              l_char = input+n(2).
              CONCATENATE formula l_char INTO formula SEPARATED BY ' '.
              n = n + 1.
            ELSE.
              CONCATENATE formula l_char INTO formula SEPARATED BY ' '.
            ENDIF.
          WHEN OTHERS.
            CONCATENATE formula l_char INTO formula SEPARATED BY ' '.
        ENDCASE.
        n = n + 1.
        IF n GT l_len.
          EXIT.
        ENDIF.
      ENDDO.
    Message was edited by:
            Fabio Cappabianca

  • Arithmetic Expression validation

    Can somebody help me in giving me a java program which can
    validate an arithmetic expression.
    For eg ( A + b1 ) / (2 * c) + d
    If someone already has a code snippet which takes an expression String
    and returns a boolean which tells if the expression is valid or not, please post it..... My project is running out of coding time :))))

    With due respect....Its not the question of not trying
    it.. I just thought it would not be judicious to
    re-invent the wheel. Depends on what you are doing.
    If you are working in industry, or are doing a final year project, code re-use is an excellent time saver.
    If you are doing homework which asks you to write an equation validator, code re-use is pretty much cheating. If you did this, you might as welll let the brightets person in the class write the code, and everyone else hand in the same code.

  • Fully parentized arithmetic expression

    Hi,
    Would any one be able to tell how does following fully parentized arithmetic expression turns 28?
    I don't get it.
    As an example of using identifiers and assignment, consider the FPAE
    (x0 = ((3 + (x1 = 4)) * x1))
    This expression evaluates to 28 and has the side effects of making the values associated to x0 and x1 28 and 4, respectively. Hence, if the next FPAE to be evaluated were
    (x1 = (x0 - x1))
    the result would be 28 - 4, or 24, and, as a side effect, the value of x1 would be changed to 24. The intent, then, is for identifiers to retain their values (or to have them changed, via assignment) as evaluation continues from one FPAE to another.
    Thanks

    (x0 = ((3 + (x1 = 4)) * x1))
    3+(x1=4)At this point x1 = 4 so the value is 7.
    (3+(x1=4))*x1x1 is still 4, so 7 x 4 = 28.
    Operands are evaluated strictly left to right.

  • Arithmetic expression performance

    Hi,
    Is there any difference in arithmetic expression evaluation performance between one big expression and several smaller that save their partial results in variables?
    For example: Which solution will work faster:
    1)
    int i;
    for(i=1000000; i>=0; i--)
      x=i*a+b*c; //a, b, c - some variables
    }2) int i,p1, p2;
    for(i=1000000; i>=0; i--)
    //a, b, c - some variables
    p1 = i*a;
    p2 = b*c;
    x[i] = p1+p2;

    I some cases I can replace a division with a multiplication.
    Instead of:
    for(int i=0; i<1000; i++)
      tab=tab[i]/5;
    }I can use:int scale = (1<<16)/5;
    for(int i=0; i<1000; i++)
    tab[i]=(tab[i] * scale)>>16;
    }The second solution gives the same result and avoids division by replacing it with multiplication and very fast bit shift operation.
    I can see that my problem is wider that I  thought. Processor manuals are quite precise, but I'm programming in java, not in assebler. So most important issue for me is the way the JVM implementation will execute each bytecode operation. I think that various JVM for various platforms may execute instructions differently. So I'm looking for general tips which operations should be avoided when performance is the key issue.
    I'm writing image processing aplication for mobile devices, so any milisecond counts for me.
    I found some java performance tips on the inernet, but, frankly, I don't trust them. For example: It is recommended to avoid 2-dimensional tables and implement them as 1D table. So instead of:int[][] tab = new int[100][100];
    tab[x][y] = c;one should use:int[] tab = new int[10000];
    tab[y*100+x]=c;It seems reasonable, but the second solution needs multiplication. In the first solution compiler can generate code that store pointers to "second dimension tables" in "first dimension" (table with references to tables). Pointers (references, i mean) have size of 2^n. Integers in second dimension are also of size 2^n. So theoretically compiler may produce byte code that will need no multiplication but only very fast bit-shift operations.
    My question is - how does the compiler cope with 2d arrays.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • ORABPEL-09503 Invalid xpath expression in a CASE expression

    Hi I have the following case statement in my BPEL process -
    <switch name="checkAuthenticateResult">
    <case condition="upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_RETURN_STATUS')))='S' AND upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')bpws:getVariableData('isAuthenticCaller'))) = 'T'">
    <bpelx:annotation>
    <bpelx:pattern>authenticatePass
    </bpelx:pattern>
    </bpelx:annotation>
    <assign name="assignTktOutput">
    <copy>
    <from expression="boolean(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')='T')"/>
    <to variable="outputVariable" part="payload" query="/client:WshSendTxnToOtmServiceProcessResponse/client:result/ns2:authenticated"/>
    </copy>
    </assign>
    </case>
    <otherwise>
    <throw name="throwAuthenticateFail" faultVariable="g_faultVariable" faultName="faultError"/>
    </otherwise>
    </switch>
    When I run my process in 10.1.2, it works fine, but when I run it in 10.1.3.1, it errors out with the following error -
    <Faulthttp://schemas.xmlsoap.org/soap/envelope/>
    <faultcode>env:Server</faultcode>
    <faultstring>ORABPEL-09503 Invalid xpath expression. Error while parsing xpath expression "upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_RETURN_STATUS')))='S' AND upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')bpws:getVariableData('isAuthenticCaller'))) = 'T'", the reason is Unknown expression at EOF: upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_RETURN_STATUS')))='S' AND upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')bpws:getVariableData('isAuthenticCaller'))) = 'T'..
    Please verify the xpath query "upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_RETURN_STATUS')))='S' AND upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')bpws:getVariableData('isAuthenticCaller'))) = 'T'" which is defined in BPEL process.
    </faultstring><faultactor></faultactor></env:Fault></env:Body></env:Envelope>
    Do you think there was a bug in the expression that has surfaced due to some additional validations in 10.1.3.1 or am I missing something here?
    Thanks a lot for your help.
    Thanks.
    RV

    AND upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')bpws:getVariableData('isAuthenticCaller'))) = 'T'"
    what is this bold part about? this looks wrong to me..
    /clemens

  • Empty variable/expression result. xpath variable/expression expression

    Hi,
    I am new to BPEL, I have created one Process and trying to Call Procedure with the help of Invoke Process Activity. Database Procedure having one input parameter and one output parameter. When i am trying to execute deployed webservice it gives me error like
    <Faulthttp://schemas.xmlsoap.org/soap/envelope/>
    <faultcode>env:Server</faultcode>
    <faultstring>com.oracle.bpel.client.delivery.ReceiveTimeOutException: Waiting for response has timed out. The conversation id is 94218a8977e86d41:78a12598:12e474197b6:-7f6f. Please check the process instance for detail.</faultstring>
    </Fault>
    Server Trace for this: From Audit Instance
    receiveInput
    [2011/02/21 17:07:04] Received "inputVariable" call from partner "client"More...
    - <inputVariable>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
    - <ns1:DBAdaptorParam2ProcessRequest xmlns:ns1="http://xmlns.oracle.com/DBAdaptorParam2">
    <ns1:input>wwww</ns1:input></ns1:DBAdaptorParam2ProcessRequest></part></inputVariable>
    Assign_in
    [2011/02/21 17:07:04] Updated variable "Invoke_DBService_DBAdaptor2_Service_InputVariable" More...
    - <Invoke_DBService_DBAdaptor2_Service_InputVariable>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="InputParameters">
    - <InputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/APPS/GETCONCATESTRING/">
    <PARAM1>wwww</PARAM1></InputParameters></part>
    </Invoke_DBService_DBAdaptor2_Service_InputVariable>
    Invoke_DBService
    [2011/02/21 17:07:04] Invoked 2-way operation "DBAdaptor2_Service" on partner "DBAdaptor2_Service".less
    - <messages>
    - <Invoke_DBService_DBAdaptor2_Service_InputVariable>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="InputParameters">
    - <InputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/APPS/GETCONCATESTRING/"><PARAM1>wwww</PARAM1>
    </InputParameters></part>
    </Invoke_DBService_DBAdaptor2_Service_InputVariable>
    - <Invoke_DBService_DBAdaptor2_Service_OutputVariable>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
    - <db:OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/APPS/GETCONCATESTRING/"><PARAM2>wwww Extra added</PARAM2></db:OutputParameters></part>
    <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="response-headers">[]</part>
    </Invoke_DBService_DBAdaptor2_Service_OutputVariable>
    </messages>
    Assign_out (faulted)
    [2011/02/21 17:07:04] Error in evaluate <from> expression at line "87". The result is empty for the XPath expression : "/ns2:OutputParameters/ns2:PARAM2".less
    oracle.xml.parser.v2.XMLElement@7cc53
    [2011/02/21 17:07:04] "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.less
    - <selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    - <part name="summary">
    <summary>
    empty variable/expression result.
    xpath variable/expression expression "/ns2:OutputParameters/ns2:PARAM2" is empty at line 87, when attempting reading/copying it.
    Please make sure the variable/expression result "/ns2:OutputParameters/ns2:PARAM2" is not empty.
    </summary></part></selectionFailure>
    I am not able to fix this issue please help me out.
    Thanks in Advance
    Thanks,Abhijit

    Hi,
    Thanks for reply.
    For the development guideline i had followed "http://www.erpschools.com/apps/oracle-applications/articles/Fusion-Middleware/SOA/BPEL/BPEL-Database-Adapter-Part-2/index.aspx" this document. Instead of using "select" query, here I am using database procedure to get output.
    For this I am giving input as "Abhijit" and database procedure "GETCONCATESTRING" is returning value as "Abhijit Extra added",
    but finally i am getting this error:
    Invoke_DBService
    [2011/02/22 12:55:08]
    Invoked 2-way operation "DBAdaptor2_Service" on partner "DBAdaptor2_Service".
    - <messages>
    - <Invoke_DBService_DBAdaptor2_Service_InputVariable>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="InputParameters">
    - <InputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/APPS/GETCONCATESTRING/">
    <PARAM1> Abhijit </PARAM1> </InputParameters> </part> </Invoke_DBService_DBAdaptor2_Service_InputVariable>
    - <Invoke_DBService_DBAdaptor2_Service_OutputVariable>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
    - <db:OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/APPS/ *GETCONCATESTRING* /">
    <PARAM2> Abhijit     Extra added </PARAM2></db:OutputParameters></part>
    <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="response-headers">[]</part>
    </Invoke_DBService_DBAdaptor2_Service_OutputVariable></messages>
    Please Guide me to use Receive Activity for output.
    Edited by: 815926 on Feb 21, 2011 11:41 PM
    Edited by: 815926 on Feb 21, 2011 11:42 PM

  • I want to upgrade my old airport express to the new express. Can I just switch out the old for the new or must I delete the old network first and start from scratch with the new express?

    I want to upgrade my old airport express to the new express. Can I just switch out the old for the new or must I delete the old network first and start from scratch with the new express?

    It is not necessary to delete your old wireless networks first, but doing so may eliminate confusion. If you wish to do that, open System Preferences > Network, and select Wi-Fi from the left column. Click the Advanced... button, then select your old wireless networks and delete them with the "–" (minus) button. Make sure the "Remember networks this computer has joined" remains checked.
    OK then Apply.
    This prevents your Mac from searching for your previous network which will no longer exist.
    A new Express creates an open wireless network that you must select before you can configure it. It appears in your Wi-Fi menu like this:
    Select it. AirPort Utility will load and walk you through its configuration.
    Edit: If you are really using OS X 10.5.1 as shown in your profile, the above screenshot is not applicable. Instead, select the network called "Apple network nnnnnn" and then launch AirPort Utility.

Maybe you are looking for

  • How do i print comments in numbers?

    I hae a spreadsheet with some comments in cells and would like to see those comments when I print the sheet. How to do that? Thanks!

  • ADF issue on weblogic

    Hi All, I deplyed the ADF application on weblogic92, but when I tried to render the CLOB object on to the UI page I do not see the CLOB object instead I see the following weblogic.jdbc.wrapper.Clob_oracle_sql_CLOB@163 instead of xml text. Any pointer

  • Rome Total War won't let me play at resolutions higher than 1024x768

    Laptop is a GE70 2PE Apache Pro Every other game lets me play up to 1920x1080 but for some strange reason RTW won't go higher than 1024x768. And yes I forced the the game to use the Nvidia GPU in the Nvidia Controll panel. And yes I'm in "High Perfor

  • IPhone5 says its connecting to WiFi......but doesn't

    So I just picked up my gf's new iPhone5 AT&T 16gb White, everything works properly except the darn Wifi. I have read similiar problems, but have not seen the EXACT problem Im having. I got to Settings>Wi-Fi>Hit my Wi-Fi Network>The status circle star

  • Installing HP DESKJET 2050 ALL-IN-ONE On windows 8

    I want to install my HP 2050 J510 series on my laptop with windows 8, but it's rejected (not supported). I had previously had windows 7 and the printer had installed okay. How do I upgrade to be able to install the 2050 on windows 8? Davekam