Forum Discussion

Staffan_Iversta's avatar
Staffan_Iversta
New Contributor
16 years ago

Conditional goto using "contains"

Hi,
I try to use conditional goto and the function contains. I try to validate a phone number but it does not work. It also seems as the function transfers 0 (zero) to O. Anyone got an idea how to do it - I'd rather not get into groovy script.

Example:
this is the line of code that does not work:
contains (//s:Body/ns1:GetUserDataMsg/Response/Telekom/phone, 222333444)
When I validate a word (like hello) it works, but when I try to do it with a number it does not work (no condition true..)
Cheers
Staffan

7 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Staffan,

    hmm.. can you show the entire response message and the exact xpath expression you are using?

    regards!

    /Ole
    eviware.com
  • Hi,
    the response is:

     
         
           

                Test
                2009-01-12T14:00:03
           

           
                Olle
                JOHANSSON
               
                 
                  Gatan 1
                  666 66
                  JÖNKÖPING
                 
                  2007-02-08
               

               
                  Lampa
                  GFAB
                  433 33
                  Göteborg
                 
                  2005-09-05
                  2008-09-05
                  2005-09-05
               

               
                  031-3333232
                  2009-01-12
               

           

         

     


    And the xpath expression is
    declare namespace ns1='http://Test.Service';
    declare namespace ns0='http://Test.Service/HeaderV1R00';
    declare namespace s='http://schemas.xmlsoap.org/soap/envelope/';
    contains (//s:Body/ns1:GetUserDataMsg/Response/Telekom/phone, 031-333)

    Br
    Staffan
  • Hi,
    I stripped the namespaces to hide the service I am working with. The namespaces etc are working and I succeed in getting a match when I use the text "hello" instead of a phone number.

    Staffan
  • omatzura's avatar
    omatzura
    Super Contributor
    oh, ok.. :-)

    In that case, maybe you need to surround the value you are checking for with quotes? (in your example it seems these are missing...)

    regards!

    /Ole
    eviware.com
  • I tried but it doesn't help if I add quotes. Is there a way for me to print to the log the value that is extracted in the "contains" function?
    /Staffan
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    No logging possibility here unforunately..

    hmm.. what if you append /text() to the xpath expression.. any difference?

    regards!

    /ole
    eviware.com