java - How can I check if an XML response contains a pattern? -


my response below.

<reply>     <status description="error: rest call http://localhost:8090/nmradapter/nmr/geticciddetails/123 failed: server returned http response code: 503 url: http://localhost:8090/nmradapter/nmr/geticciddetails/123 " /> </reply> 

i have used xml parser parse response , response need check if status description contains response code 503.

edit:

i wonder if there way can match 3 words (say http, response code, 503) using regex if words don't occur in same order in sentence.

can suggest regex using groovy match condition?

in groovy, can use following check (assuming text variable holding string provided in question):

if (text=~/server returned http response code: 503\b/){    println "503 code detected" } else {    println "503 code not detected" } 

but seems can use contains:

if (text.contains('http response code: 503 ') {...} 

Comments

Popular posts from this blog

php - How can an email be returned from Stripe Checkout? -

SQL php on different pages to Insert (mysqli) -

linked list - Get the index of the Node in a LinkedList which contains the given value in java -