5 Replies Latest reply on Jun 3, 2009 3:12 AM by *Prashant Shelke*

    Converting html code to plain text in java

    sweetysk

      Hello,

             I am storing google map route direction in database which is giving direction text in html tags. But I want to store normal plain text in database. I have to remove all html tags which are coming dynamically when I am searching by giving source and destination to get map.

       

      For example

       

      Head west on Court St toward Boston Pl (148, 10)

      Turn left at Tremont St (1424, 176)

      Turn right at Marginal St (291, 41)

      Take the Mass Pike/<wbr/>I-90 ramp (226, 60)

      Merge onto I-90 W <div class="google_impnote">Toll road</div> (87907, 3246)

      Take exit 9 to merge onto I-84 W toward US-20/<wbr/>Hartford/<wbr/>New York City <div class="google_impnote">Partial toll road</div><div class="google_note">Entering Connecticut</div> (67093, 2407)

      Slight left at CT-15 S/<wbr/>Wilbur Cross Hwy (signs for Charter Oak Bridge/<wbr/>CT-15/<wbr/>I-91/<wbr/>NY City) (4178, 174)

      Take exit 87 for I-91/<wbr/>Brainard Rd toward Brainard/<wbr/>Airport Rd (210, 15)

      Keep right at the fork, follow signs for I-91 and merge onto I-91 S (58174, 2153)

      Merge onto I-95 S <div class="google_note">Entering New York</div> (103519, 4297)

      Take the I-95 exit toward I-678/<wbr/>Cross Bronx Exp (224, 10)

      Keep left at the fork to continue toward I-95 S and merge onto I-95 S (9265, 418)

      Take exit 1 to merge onto NY-9A S (11440, 594)

      Slight left at 12th Ave/<wbr/>NY-9A (91, 10)

      Turn left at W 42nd St (1374, 201)

       

       

      In the above data I have to remove all the html tags like div tag in that class we will get dynamically that we can not remove in java..

      Can anyone please help me? how can we convert html text to normal plain text

       

      Thanks in advance.