File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes logging version number at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "logging version number at runtime" Watch "logging version number at runtime" New topic

logging version number at runtime

mohana konakanchi
Ranch Hand

Joined: May 16, 2001
Posts: 67
We have developement, staging, production environments which uses
apache xerces on each box. We had error while tranforming XML to HTML in staging and working fine in others (not able to trace the error message due to high volume data). Same code is deployed in all boxes.

Is there as way to know the version number of Xerces used on runtime? so that we can make sure different boxes running same version of Xerces.
mohana konakanchi
Ranch Hand

Joined: May 16, 2001
Posts: 67
I got this code from web.

You can use the org.apache.xerces.impl.Version class in Xerces. For
instance, this is the code that XOM's Builder class uses to check the

try {
String versionString = Version.getVersion();
versionString = versionString.substring(9, 12);
xercesVersion = Double.valueOf(versionString).doubleValue();
catch (Exception ex) {
// The version string format changed so presumably it's
// 2.6 or later
catch (Error err) {
// Xerces not installed, so none of this matters
I agree. Here's the link:
subject: logging version number at runtime
It's not a secret anymore!