Under Java 6, if we simply don't bother with this code at all, it seems to parse XML just fine. So, in a way, I already have a solution. But I would like to know exactly what's changed in the Java distributions and why.
A quick Google didn't reveal the answers I'd hoped for. Can anyone point me to appropriate documentation about what XML SAX parser(s) are in what JDK?
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
I don't have a direct answer to your question (which SAX parser is included in which JDK version), but: You shouldn't write programs that depend on undocumented implementation details (such as the particular XML parser used under the covers by Java). The API documentation for JDK 1.4 doesn't specify that Crimson is included in the JDK. In fact, the XML API is set up in such a way that other XML parsers can easily be plugged into it and which one is the default or which one is included isn't specified and shouldn't be of concern.
It's been a while since I have worked with XML on Java 1.4. Are you really sure that you have to set this system property (org.xml.sax.driver)? What happens if you just don't set that system property? I'd expect that it should work also on Java 1.4 without setting that property. [ April 24, 2007: Message edited by: Jesper Young ]
I didn't write this code, so I don't know whether there was a good reason for fixing the SAX parser choice. The application is a very advanced user of XML, so it is quite possible that we did need to do that, at some time anyway.
I can say that it appears to work in Java 6 without any code to specify any particular SAX parser.
What I am likely to do is to conditionalise the system property setting code so that it only runs if Java version is 1.4 (Mac OS X still on 1.4 in our app). We'll then have to re-do lots of testing, to make sure everything is OK with the SAX parser that's in Java 6.
Looking at just the Java version might not be enough. What if someone is running your program with IBM JVM version 1.4? It might use something else than Crimson.
Joined: Oct 30, 2001
We distribute the JRE with our application, so it runs on what we choose. Except on Mac OS X, where it runs on what Apple give you. Either way, there is little/no chance of suddenly encountering an unexpected Java version.
Anyway, for the future running Java 6, I intend not to specify a specific version. For compatibility with the past Java 1.4, I intend to continue specifying what we always specified.
We could do a test by trying to load the specified class at the time of setting the system property. [ April 24, 2007: Message edited by: Peter Chase ]
Originally posted by Peter Chase: We distribute the JRE with our application, so it runs on what we choose. Except on Mac OS X, where it runs on what Apple give you. Either way, there is little/no chance of suddenly encountering an unexpected Java version.
Well I could just as well have written "Apple's Java" instead of "IBM Java" - Apple's implementation isn't the same as Sun's, so there's no guarantee that Crimson will be present in Apple's Java.
Joined: Oct 30, 2001
The guarantee is that we tested it on the versions of Mac OS X that we support.