• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

xml on browser with its tags

i have table in db which stores the data in xml format
shown below for particular user id..

<tag1>
      <tag2>data1</tag2>
      <tag3>data2</tag3>            
</tag1>

and i am trying to display whole xml segment including its tag
for each user id on browser with "JSP". but browser only displays data
not the whole xml segment for each individual user id..
so output should be like this

<tag1>
      <tag2>data1</tag2>
      <tag3>data2</tag3>            
</tag1>

can we do that without using xslt???
0
ghatlodia
Asked:
ghatlodia
  • 2
1 Solution
 
TimYatesCommented:
you need to replace the "<" with "&lt;" and the ">" with "&gt;"

Then the browser will render it ok :-)

try:

<%= xml.replaceAll( "<", "&lt;" ).replaceAll( ">", "&gt;" ) %>

that may work (but it probably need some escape chars in it ;-) )
0
 
TimYatesCommented:
just tested it...works fine :-)
0
 
ghatlodiaAuthor Commented:
thanks  TimYates   now it is working fine..
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now