#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    26
    Rep Power
    0

    response.setContentType("text/xml")


    Hi,

    I am trying to ouput some xml onto my Browser (IE 6) and my code reads like this:

    response.setContentType("xml");
    PrintWriter out = response.getWriter();

    out.print("<?xml version='1.0' encoding='ISO-8859-1'?>");
    out.print("<greeting language=\"en_US\">");
    out.print(" Hello, World!!!!!!!");
    out.print("</greeting>");


    Pretty simple u cud say.. but what happens is the servlet somehow parses the xml and prints only the values between the tags greeting!!

    However if i do a view source on the browser the xml tags are visible fine!!

    Any ideas why the xml tags dont appear on the browser??

    thnx,
    sgaucho
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Try "text/xml" or "application/xml" instead of just "xml" for your mime type. The problem isn't with the servlet, the problem is the browser interpreting your content as html or xhtml and trying to display the contents without the markup.
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    26
    Rep Power
    0
    hi,

    i originially tried with text/xml but wouldnt work either...

    furtehr whats strange is that i closed the browser window and opened it again and voila the xml showed up allright but the same problem occured a few mins later!!

    an more suggestion???

    thnx,
    sands

IMN logo majestic logo threadwatch logo seochat tools logo