JSP compilation error when changing XML parsing to Xerces

That's it, I'm working on a java webapp that we deploy to a Resin web application server. I am parsing XML for a new part of the application and realized that our application is using the "Resin Class" for parsing. I wanted to get away from that and use something more standard for a number of reasons, so I set these system properties in my resin config file (and added a jar of xerces to my classpath):

<system-property javax.xml.parsers.DocumentBuilderFactory="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>

<system-property javax.xml.parsers.SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>

      

And now I am getting JSP compilation errors on multiple pages (I think the resin generated in the parser was softer). The error reads:

org.xml.sax.SAXParseException: The value of attribute "title" associated with an element type "display:column" must not contain the '<' character.

      

And, the 'display: column' tag on some pages does indeed contain the markup in the 'title' attribute. Here's an example:

<display:column scope='col' class=" appealColorBG  selectAllWidth" 
    title="<span class='centerThis'><label for='selectAll'>Select All</label><br />
            <input type='checkbox' name='selectAll' 
            id='selectAll' 
            onClick='selectAllCheckboxes();'/></span> " >

      

Something ugly JSP code, I know, but it's also code that's already in production, so I hesitate to change it.

Does anyone know a way that I can install xerces so that it can compile the JSP as it is?

+2


a source to share


1 answer


This is definitely ugly JSP code.

If you are using an XML parser you have a problem. Attribute values ​​in valid XML cannot contain the '<' character as Xerces tells you.



It is doubtful that you can tell Xerces to accept this, but fixing the XML would be better than telling the XML parser to accept invalid XML anyway.

You will probably want to revert to using the Resin classes until you can serve the Xerces XML correctly, or tweak Resin to not use the XML parser as part of its JSP compilation - see comments.

+1


a source







All Articles