Problem with XML output by a jspx file

Problem with XML output by a jspx file

Post by yzzzz » Fri, 11 Feb 2005 04:51:29


Hi,

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


1. When I name this file "test.jsp" I get the following output in my
browser:
<html>
<body>
a & 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 &. 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;), or is there something wrong in my tomcat configuration?

Thank you.