문제

All, I'm working on a java webapp that we deploy in the Resin web app server. I have been doing some XML parsing for a new part of the application, and realized that our app was using Resin classes to do the 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 the xerces jar 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'm getting JSP compilation errors on several pages (I guess Resin's built in parser was more lenient). 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 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> " >

That's some ugly JSP code, I know, but it's also code that's already in production, so I'm hesitant to change it.

Does anyone know of a way that I can set xerces so that it will allow the JSP to compile as is?

도움이 되었습니까?

해결책

That's certainly ugly JSP code.

If you're using an XML parser on it, you've got a problem. Attribute values in valid XML can not contain the '<' character, as Xerces is telling you.

It's doubtful you can tell Xerces to accept this, but fixing the XML would be a better idea than talking an XML parser into accepting incorrect XML anyway.

You probably want to drop back to using the Resin classes until you can feed Xerces proper XML, or configure Resin to not use an XML parser as part of its JSP compilation - see comments.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top