XML and the Java 1.4 SDK

NOTE: This page applies only to Toolkit releases up to and including V1.6, since the Java support is no longer included in the Toolkit (it is now included in SDK 1.4 and later.)

The Java 1.4 SDK comes with an XML Parser and XSLT Processor imbedded in the binary distribution. Once you migrate to the Java 1.4 SDK you will pick up the XML Parser and XSLT Processor imbedded in the SDK unless you take some explicit actions.

The XML Parser and XSLT Processor that are imbedded in the Java 1.4 SDK are considered endorsed standards. There is an endorsed standards override mechanism that can be used if it is necessary to use a different level of an endorsed standards API than the one imbedded in the SDK.

Example of Endorsed Standards Override

If you were running with the Java SDK 1.3 and were using the Toolkit V1.5 you could enter the following which would tell you the level of the Parser you are using:

  java org.apache.xerces.impl.Version

which would return:

  XML4J 4.1.3

However if you did this using the Java 1.4 SDK you will see that you are now using a different level of the Parser even though your CLASSPATH still points to the Toolkit V1.5 JAR files.

In order to keep using the Toolkit V1.5 Parser you must add a "java.endorsed.dirs" parameter to the java command. This must point to the directory where the Toolkit V1.5 Parser is installed. So the command to determine the level of the Parser must now look like this:

  java -Djava.endorsed.dir=/usr/lpp/ixm/IBM/xml4j-4_1 org.apache.xerces.impl.Version

This will now return the following:

  XML4J 4.1.3


Basically once you go to Java SDK 1.4 there is no point in having a JAR file on your CLASSPATH that contains endorsed standard APIs. So even if you have the "xercesImpl.jar" and "xmlParserAPIs.jar" (Toolkit V1.5) or "xml-apis.jar" (Toolkit V1.6) files on your CLASSPATH environment variable they will be ignored. The only JAR file that still needs to be on the CLASSPATH is the "xercesSamples.jar" if you want to run the Toolkit samples.

If you are using the Toolkit XSLT Processor you also need to use the endorsed directory override mechanism to pick up the Toolkit version instead of the imbedded Java SDK 1.4 version.

Parsing an XML 1.1 Document on Java SDK 1.4

In order to parse an XML 1.1 document on Java SDK 1.4 using Toolkit V1.6 you may need to override the default setting of the "xni.parser.XMLParserConfiguration" system property. There is a xerces.properties file that ships in some versions of the Java SDK 1.4 which sets this to "org.apache.xerces.parsers.IntegratedParserConfiguration". This configuration does not support parsing an XML 1.1 document. In order to parse an XML 1.1 document you need to use the "org.apache.xerces.parsers.XML11Configuration" configuration.

So if you wanted to try parsing an XML 1.1 document using the sax.Counter sample you would first have to add the "xercesSamples.jar" file to your CLASSPATH. Then you would issue the following command:

   java -Djava.endorsed.dirs=/usr/lpp/ixm/IBM/xml4j-4_2
         {options} {full path to XML file}


This will pick up the Toolkit V1.6 Parser via the endorsed standards override mechanism and will also override the default parser configuration with one that supports XML 1.1 documents.

Contact IBM

Browse z/OS