Problem with XML output by a jspx file

Discussion in 'Java' started by yzzzzz, Feb 9, 2005.

  1. yzzzzz

    yzzzzz Guest

    Hi,

    I'm using Tomcat 5.5 under Linux.
    Here is a sample JSP file:
    <html>
    <body>
    a &amp; b
    </body>
    </html>


    1. When I name this file "test.jsp" I get the following output in my
    browser:
    <html>
    <body>
    a &amp; b
    </body>
    </html>
    That's fine.

    2. When I name this file "test.jspx" I get the following output in my
    browser:
    <?xml version="1.0" encoding="UTF-8"?>
    <html><body>
    a & b
    </body></html>
    This is invalid. The ampersand should be escaped as &amp;. Here the
    output is not well-formed XML, which causes multiple problems. (Note: I
    really don't mind the parser ignoring white-space or adding an XML
    processing instruction at the top.)

    Is this some kind of bug, is there a work-around (apart from writing
    &amp;amp;), or is there something wrong in my tomcat configuration?

    Thank you.
     
    yzzzzz, Feb 9, 2005
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.