Print a XML string to browser doesn't work in JSP

M

Matt

xmlReq is the XML string, and I want to print it out in browser, but it doesn't
print it out. But when I go to view|source, then I could see the XML.

<%
String xmlReq = generateXML();
out.println(xmlReq);
%>

any ideas? please help. thanks!!
 
B

Brusque

Matt said:
xmlReq is the XML string, and I want to print it out in browser, but it doesn't
print it out. But when I go to view|source, then I could see the XML.

<%
String xmlReq = generateXML();
out.println(xmlReq);
%>

any ideas? please help. thanks!!

Because you're not escaping the XML characters and the browser is trying to
render them/ignore them. You need to convert characters like < > & to &gt;
&lt; &amp; etc. if you want the browser to display it instead of interpret
it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top