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

Discussion in 'Java' started by Matt, Oct 12, 2004.

  1. Matt

    Matt Guest

    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!!
     
    Matt, Oct 12, 2004
    #1
    1. Advertising

  2. Matt

    Brusque Guest

    "Matt" <> wrote in message
    news:...
    > 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.
     
    Brusque, Oct 12, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    4,470
  2. Replies:
    0
    Views:
    1,222
  3. keto
    Replies:
    0
    Views:
    1,022
  4. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    387
    David Cournapeau
    Dec 30, 2008
  5. Replies:
    1
    Views:
    128
    Randy Webb
    Apr 7, 2006
Loading...

Share This Page