>The Evils of JAXP

>Recommendation: If you are using XML in eclipse, DO NOT use JAXP….unless you specifically set the the system property to control which XSLT, XML, and XPATH processors that you use.

The reason for this is that you can receive some weird errors that will leave you scratching your head. Items like StackOverflows from URI Resolvers as shown in Bug 226937. The problem I believe in this particular case is that the com.sun.org.apache.xalan ends up trying to access a ZIP file to resolve where the variables and functions reside, however, it doesn’t understand this and we get a Stack Overflow exception being tossed.

The problem with JAXP from a plugin stand point is that it grabs what ever is the system default processor to be used unless you override the system. It also grabs whatever the default Resolver is for either XSLT, XML, or XPath. So this can cause different behavior from system to system depending on what parsers are installed and what URI Resolvers are setup and when. JAXP may provide a common API but unfortunately the behavior and results you can get can vary. Avoid it if possible when doing plugin development, if you must use it, be specific about the parser you want JAXP to use.

This entry was posted in eclipse, xml, xsl. Bookmark the permalink.

One Response to >The Evils of JAXP

  1. Ed Merks says:

    >These kind of things have all too often been the bane of my existence. Difference in behavior from JDK to JDK version and from vendor to vendor are so incredibly annoying. It’s supposed to be a standard for goodness sake! You’d think deciding on the property for controlling the indentation level of the transformer, for example, would have been decided properly ages ago…It’s indeed write once, test everywhere, and then rewrite it again and again…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s