Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
552
Xalan: The org.apache.xalan.xslt.EnvironmentCheck Class
This is
a utility class to report simple information about the environment. This class
helps to get environment setup of your system.
Note:
This class is pretty simplistic: results are not necessarily definitive nor
will it find all problems related to environment setup. Also, you should avoid
calling this in deployed production code, both because it is quite slow and
because it forces classes to get loaded.
Note:
This class explicitly has very limited compile-time dependencies to enable easy
compilation and usage even when Xalan, DOM/SAX/JAXP, etc. are not present.
Note:
for an improved version of this utility, please see the xml-commons' project which
utility which does the same kind of thing but in a much simpler manner.
To use
this class ensure that xalan.jar is in your class path.
Method Overviews
Usage:
You
can use this utility class from command line as below:
If you want your environment details to be written
in your file the you can add the argument. Otherwise your environment details
will be printed in command line. The output would be:
#---- BEGIN writeEnvironmentReport($Revision: 1.14
$): Useful stuff found: ----
If you
want to check your environment details in your program then you can use methods
provided by this class
Example of getEnvironmentHash():
getEnvironmentHash() returns
Hashtable with various system and CLASSPATH, etc. properties are put into the
hash as keys with a brief description of the current state of that item as the
value.
public void checkEnviorment(){
EnvironmentCheck environmentCheck = new EnvironmentCheck();
System.out.println("Key value
:"+environmentHash.get(object));
}
}
Usage from XSLT Sylesheet:
You can also use this class in your stylesheet with namespace xmlns:xalan="http://xml.apache.org/xalan. You should ensure that your stylesheet processor is able to load this namespace.