IBM Support

Xalan and Xerces and their role in Sterling MCF 8.0

Question & Answer


Question

Xalan and Xerces and their role in Sterling MCF 8.0

Answer

 What are Xalan-Java and Xerces2-Java?

These are 3rd party software which are used by the Sterling MCF product -

Xalan-Java is an XSLT processor for transforming XML documents into HTML, text, or other XML document types.
Xerces2-Java is a library for parsing, validating and manipulating XML documents.
 
The necessary jar files (xercesImpl.jar, serializer.jar, xalan.jar and xmlParserAPIs.jar or xml-apis.jar) are shipped along with the Sterling MCF product.
 
 
 How do you determine what version of these 3rd party software is being used?
 
You can run the following command which queries and outputs the version of Xalan and Xerces being used. It also outputs which jar files are being used and from where they are picked up.
 
java org.apache.xalan.xslt.EnvironmentCheck [-out outFile]
 
A sample output would look as follows:
 
#---- BEGIN writeEnvironmentReport($Revision: 1.29 $): Useful stuff found: ----
version.DOM.draftlevel=2.0fd
java.class.path=lib/endorsed/xalan.jar
version.JAXP=1.1 or higher
java.ext.dirs=/apps/Sterling/82/Foundation/jdk/jre/lib/ext
#---- BEGIN Listing XML-related jars in: foundclasses.sun.boot.class.path ----
xercesImpl.jar-apparent.version=xercesImpl.jar from Xerces-J-bin.2.7.1
xercesImpl.jar-path=/apps/Sterling/82/Foundation/jdk/jre/lib/endorsed/xercesImpl.jar
xalan.jar-path=/apps/Sterling/82/Foundation/jdk/jre/lib/endorsed/xalan.jar
serializer.jar-apparent.version=serializer.jar present-unknown-version
serializer.jar-path=/apps/Sterling/82/Foundation/jdk/jre/lib/endorsed/serializer.jar
xml.jar-apparent.version=xml.jar present-unknown-version
xml.jar-path=/apps/Sterling/82/Foundation/jdk/jre/lib/xml.jar
#----- END Listing XML-related jars in: foundclasses.sun.boot.class.path -----
version.xerces2=Xerces-J 2.7.1
version.xerces1=not-present
version.xalan2_2=Xalan Java 2.7.0
version.xalan1=not-present
version.ant=not-present
java.version=1.5.0
version.DOM=2.0
version.crimson=not-present
sun.boot.class.path=/apps/Sterling/82/Foundation/jdk/jre/lib/endorsed/xmlParserAPIs.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/endorsed/xercesImpl.jar:
/apps/Sterling/82/Foundation/jdk/jre/lib/endorsed/xalan.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/endorsed/serializer.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/vm.jar:
/apps/Sterling/82/Foundation/jdk/jre/lib/core.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/charsets.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/graphics.jar:
/apps/Sterling/82/Foundation/jdk/jre/lib/security.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/ibmpkcs.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/ibmorb.jar:
/apps/Sterling/82/Foundation/jdk/jre/lib/ibmcfw.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/ibmorbapi.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/ibmjcefw.jar:
/apps/Sterling/82/Foundation/jdk/jre/lib/ibmjgssprovider.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/ibmjsseprovider2.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/ibmjaaslm.jar:
/apps/Sterling/82/Foundation/jdk/jre/lib/ibmcertpathprovider.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/server.jar:/apps/Sterling/82/Foundation/jdk/jre/lib/xml.jar
#---- BEGIN Listing XML-related jars in: foundclasses.java.class.path ----
xalan.jar-path=/apps/Sterling/82/Foundation/jdk/jre/lib/endorsed/xalan.jar
#----- END Listing XML-related jars in: foundclasses.java.class.path -----
version.SAX=2.0
version.xalan2x=Xalan Java 2.7.0
#----- END writeEnvironmentReport: Useful properties found: -----
# YAHOO! Your environment seems to be OK.
 
What are the properties files xalan.properties and xerces.properties?
 
xalan.properties: This comes into picture when an XSLT processor uses an XML parser to parse an XML document for transformation. You can specify which parser should be used and which service is to be searched for in what class in this property file.
 
xerces.properties: This file is considered when a Xerces parser is created, either directly using a native class or via a standard API like JAXP. Xerces provides a dynamic means of dynamically selecting a "configuration" for that parser. Configurations are the basic mechanism Xerces uses to decide exactly how it will treat an XML. You can specify what XML Parser Configuration to be used in this property file.
 
How is the search for Xalan/Xerces class/service provider conducted?
 
Xalan (search for the XML parser by XSLT processor) -
 
The following steps are used to determine the provider of this service. Each means is attempted in sequence, until one yields the service provider to be used:
       
  • first, XSLT4J will examine the system properties for the following keys:
      - org.apache.xalan.xsltc.dom.XSLTCDTMManager
       
  • next, it will try to find a file called xalan.properties in the lib subdirectory of your JRE installation and look for the keys above
  •    
  • next, it will examine all the jars on your classpath to try and find one with the appropriate entries in its META-INF/services directory
  •    
  • if all else fails, the default service provider, org.apache.xalan.xsltc.dom.XSLTCDTDMManager, is used.

Xerces (search for XML Parser Configuration)-

  The following steps are used:

       
  •    
    first, Xerces will examine the system property org.apache.xerces.xni.parser.XMLParserConfiguration;
       
  •    
  •    
    next, it will try and find a file called xerces.properties in the lib subdirectory of your JRE installation;
       
  •    
  •    
    next, it will examine all the jars on your classpath to try and find one with the appropriate entry in its META-INF/services directory.
       
  •    
  •    
    if all else fails, it will use a hardcoded default.
       
How do we use these in the Sterling MCF product?
 
The Out Of the Box (OOB) Distributed Order Management (DOM) implementation [YFCDocument, YFCElement etc] just wraps the native Xerces APIs/methods.
For example, the document parse () method just uses the base Xerces call.
 
public static Document parse (InputSource inSource) throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder builder= dbf.newDocumentBuilder();
builder.parse(inSource)
}
 
Xerces provides configuration overrides [it may be override to DocumentBuilderFactory implementation OR override to XMLParserConfiguration] using which the wrapping implementation can change the default implementation/behavior of the parser.
The application can override the behavior/configurations at different level through multiple means.
The top most override will always be through a System property [-D]
Sterling application doesn't provide/ship any override OOB.
Xerces traverse through all possible override combinations before concluding the default implementation.
 
The same is the case with Xalan.
 
What is the configuration being used in the Sterling MCF product?
 
The Sterling MCF product uses the XML parser/configuration from Apache. With its 5.0/1.5 series Java has started shipping its own XML parser/configuration. To skip the use of the default parsers from Java and ensure that the Apache configuration/parser is being used, one can modify the arguments to Java by adding the xercesImpl.jar, xalan.jar, serializer.jar and xml-apis.jar/xmlParserAPIs.jar to the bootclasspath
 
e.g. In MCF 8.0, you can achieve this as follows:
java –Xbootclasspath/p:<INSTALL_DIR>/jdk/jre/lib/endorsed/xalan.jar:<INSTALL_DIR>/jdk/jre/lib/endorsed/xercesImpl.jar: <INSTALL_DIR>/jdk/jre/lib/endorsed/serializer.jar: <INSTALL_DIR>/jdk/jre/lib/endorsed/xmlParserAPIs.jar

[{"Product":{"code":"SS6PEW","label":"IBM Sterling Order Management"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number

FAQ2834

Document Information

Modified date:
16 June 2018

UID

swg21519370