1

I have this XML string:

   <TransactionId>1231231</TransactionId>
   <TransactionDescription>Card was succesfully created: DDCARD-26913899</TransactionDescription>
   <Error>00</Error>
   <ExpiryDate>1084412</ExpiryDate>

I need to extract the string after the colon( which is unique) and containing the number, in this case (DDCARD-26913899). The string after the value i want to extract is an XML tag and can be any other tag other than TransactionDescription.

I want to do it by using regular expression in Java , but i don't know how. Appreciate any help

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
Alex2330
  • 347
  • 1
  • 7
  • 21
  • 1
    Don't parse XML using regex; use a real parser. See [**How to retrieve element value of XML using Java?**](http://stackoverflow.com/questions/4076910/how-to-retrieve-element-value-of-xml-using-java) or [**How to read XML using XPath in Java**](http://stackoverflow.com/questions/2811001/how-to-read-xml-using-xpath-in-java) – kjhughes Dec 13 '16 at 14:33
  • 1
    yes, this can be a solution.thanks – Alex2330 Dec 13 '16 at 16:03

0 Answers0