IBM User Guide for Java V7 on Windows > Developing Java applications



Using XML

The IBM SDK contains the XML4J and XL XP-J parsers, the XL TXE-J 1.0 XSLT compiler, and the XSLT4J XSLT interpreter. These tools allow you to parse, validate, transform, and serialize XML documents independently from any given XML processing implementation.

Use factory finders to locate implementations of the abstract factory classes, as described in Selecting an XML processor. By using factory finders, you can select a different XML library without changing your Java™ code.


Available XML libraries

The IBM SDK for Java contains the following XML libraries:

XML4J 4.5

XML4J is a validating parser providing support for the following standards:

  • XML 1.0 (4th edition)
  • Namespaces in XML 1.0 (2nd edition)
  • XML 1.1 (2nd edition)
  • Namespaces in XML 1.1 (2nd edition)
  • W3C XML Schema 1.0 (2nd Edition)
  • XInclude 1.0 (2nd Edition)
  • OASIS XML Catalogs 1.0
  • SAX 2.0.2
  • DOM Level 3 Core, Load and Save
  • DOM Level 2 Core, Events, Traversal and Range
  • JAXP 1.4

XML4J 4.5 is based on Apache Xerces-J 2.9.0. See http://xerces.apache.org/xerces2-j/ for more information.

XL XP-J 1.1

XL XP-J 1.1 is a high-performance non-validating parser that provides support for StAX 1.0 (JSR 173). StAX is a bidirectional API for pull-parsing and streaming serialization of XML 1.0 and XML 1.1 documents. See the XL XP-J reference information section for more details about what is supported by XL XP-J 1.1.

XL TXE-J 1.0

For Version 5.0, the IBM SDK for Java included the XSLT4J compiler and interpreter. The XSLT4J interpreter was used by default.

For Version 6 and later, the IBM SDK for Java includes XL TXE-J. XL TXE-J includes the XSLT4J 2.7.8 interpreter and a new XSLT compiler. The new compiler is used by default. The XSLT4J compiler is no longer included with the IBM SDK for Java. See Migrating to the XL-TXE-J for information about migrating to XL TXE-J.

XL TXE-J provides support for the following standards:

  • XSLT 1.0
  • XPath 1.0
  • JAXP 1.4


Selecting an XML processor

XML processor selection is performed using service providers. When using a factory finder, Java looks in the following places, in this order, to see which service provider to use:

  1. The system property with the same name as the service provider.
  2. The service provider specified in a properties file.

    • For XMLEventFactory, XMLInputFactory, and XMLOutputFactory only. The value of the service provider in the file C:\Program Files\IBM\Java70\jre\lib\stax.properties.
    • For other factories. The value of the service provider in the file C:\Program Files\IBM\Java70\jre\lib\jaxp.properties.

  3. The contents of the META-INF\services\<service.provider> file.
  4. The default service provider.

The following service providers control the XML processing libraries used by Java:

javax.xml.parsers.SAXParserFactory
Selects the SAX parser. By default, org.apache.xerces.jaxp.SAXParserFactoryImpl from the XML4J library is used.
javax.xml.parsers.DocumentBuilderFactory
Selects the document builder. By default, org.apache.xerces.jaxp.DocumentBuilderFactoryImpl from the XML4J library is used.
javax.xml.datatype.DatatypeFactory
Selects the datatype factory. By default, org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl from the XML4J library is used.
javax.xml.stream.XMLEventFactory
Selects the StAX event factory. By default, com.ibm.xml.xlxp.api.stax.XMLEventFactoryImpl from the XL XP-J library is used.
javax.xml.stream.XMLInputFactory
Selects the StAX parser. By default, com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl from the XL XP-J library is used.
javax.xml.stream.XMLOutputFactory
Selects the StAX serializer. By default, com.ibm.xml.xlxp.api.stax.XMLOutputFactoryImpl from the XL XP-J library is used.
javax.xml.transform.TransformerFactory
Selects the XSLT processor. Possible values are:

com.ibm.xtq.xslt.jaxp.compiler.TransformerFactoryImpl
Use the XL TXE-J compiler. This value is the default.
org.apache.xalan.processor.TransformerFactoryImpl
Use the XSLT4J interpreter.
javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema
Selects the schema factory for the W3C XML Schema language. By default, org.apache.xerces.jaxp.validation.XMLSchemaFactory from the XML4J library is used.
javax.xml.xpath.XPathFactory
Selects the XPath processor. By default, org.apache.xpath.jaxp.XPathFactoryImpl from the XSLT4J library is used.


Parent: Developing Java applications








Error 404 - Not Found

Error 404 - Not Found

The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.