Display XML content in a div on a webpage

Hello,

I would like, on a button click,  to display XML content within a div on my webpage.
I have the XML on the server side as a long string (I don't have an xml file).

How can I do that?

Thanks
RelegenceAsked:
Who is Participating?
 
ofkrCommented:
As you have the XML on the server side as a long string, you just need to put the string "<xmp>" at the begining of your XML string and "</xmp>" at the end of your XML string before displaying within <DIV> tag.

You will need to code a little bit for that. Hope that is your requirement.
0
 
ofkrCommented:
You can replace all of your xml's "<" with &lt; and  ">" with &gt; before deplaying your string.

Another option : You could also try putting <xmp> (Your XML String) </xmp>.
0
 
RelegenceAuthor Commented:
what is <xmp>, i can't find it in my controls list
0
 
RelegenceAuthor Commented:
Thank you!!
0
 
RelegenceAuthor Commented:
Just 1 little question - the XML is displayed as 1 long row, no indentation.
How can I fix that?

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.