XML parser for Java code

 

+

Search Tips   |   Advanced Search

 

What is the difference between XML4J and Xerces?

IBM has tested this version of XML4J in addition to the testing done by the xml.apache.org project. The names of the main JAR files have changed from xml4j.jar to xmlParserAPIs.jar and xercesImpl.jar, and from xml4jSamples.jar to xercesSamples.jar.

This version of XML4J contains one major API change and a few relatively minor API changes from the last major release. It's major features are many bugfixes and performance improvements, as well as the addition of a few features.

XML4J 4.2.x ships with the official W3C DOM HTML Recommendation API . The major change to the API was the removal of setSelected from the HTMLOptionElement interface. To workaround this change from XML4J 4.1.x, use setAttribute and removeAttribute from the interface to modify the selected attribute.

 

Which part of the API is public, and which is subject to change?

To answer this question, understand the terms used for application program interface (API) status:

Public The typical client developer codes for this API. Any severe problem in this API is addressed. Also, the majority of this API is defined as "public" and has reached World Wide Web Consortium (W3C) Recommendation status or a similar status in the XML Core Working Group. Not much change in these interfaces is expected. A W3C Recommendation indicates that a specification is stable, contributes to Web interoperability, and has been reviewed by all W3C members, who are in favor of supporting its adoption by the industry.
Experimental These interfaces and classes reflect the latest W3C specifications and SAX specifications from the XML Core Working Group. Because these specifications are not finalized, the interfaces are subject to change. As an experimental specification is adopted at the highest level, such as at the W3C Recommendation level, the specification is upgraded to the Public category.
Internal These classes are considered internal to Xerces, even though they might be public and have public methods. Developers with complex and specific needs, such as building an XML parser can use these classes. However, the architecture is subject to change.

The following table summarizes API status by interface content:

API Status API contents (packages, interfaces, classes and methods) Comments
Public DOM Level 1 interfaces (found in org.w3c.dom, org.w3c.dom.html) and DOM Level 2 (DOM2) interfaces (found in org.w3c.dom and subpackages)

The DOM2 interfaces are implemented in the same interfaces as DOM1 as new methods.

SAX Level 1 interfaces and SAX2 interfaces

DOM L1, DOM L2, SAX1, and SAX2 Interfaces are stable.
Experimental DOM3 and DOM3 Abstract Schemas and Load and Save (found in org.apache.xerces.dom3 and subpackages). DOM L3 is in working draft status. XML4J provides a subset of DOM L3 support.
Internal All other packages are internal. The internal Xerces architecture can change.

As an Apache Open Source project, the Xerces community is interested in your questions and feedback regarding the entire API, not just the part that is designated as public.

If you have specific questions, patches, or feedback regarding the Xerces API or code, visit the Apache Web site, and sign up for the mailing list. Send more basic questions or questions specific to XML4J to the AlphaWorks discussion forum.

 

Which APIs do I use for new development?

Use the

org.apache.xerces.parsers.* classes for new development. The four compatibility parser classes are replaced by the following classes

org.apache.xerces.parsers.SAXParser 
org.apache.xerces.parsers.DOMParser

Validation control has become a feature of the parser, and no longer requires separate classes.

The future direction for the parser instantiation classes is a parser instantiation API that results from the W3C DOM Level 3 effort, which is just getting underway.

To make sure that your code is as stable as possible, use the interfaces that are specified in the Public section of the preceding table (for example DOM1 and SAX1). Updates are made to the table to reflect the new interfaces and the classes that are given Public status (for example, DOM2 and SAX2).

 

Is IBM making any additional support guarantees with XML4J?

IBM is not making any additional support guarantees for XML4J. In particular, IBM is not certifying that XML4J is Y2K compliant. XML4J makes no internal date calculations.

 

Migrate applications to use the XML4J 4.2.2 parser and the XSLT4J 2.5.4 transformer

The JAXP specification defines a pluggability mechanism for a SAX or a DOM parser using the javax.xml.parsers APIs. Transformers are pluggable using the javax.xml.transform APIs.

The IBM SDK 1.4.1 bundles in V6 include an XML4J 4.2.2 parser and an XSLT4J 2.5.4 transformer. Use a different implementation of JAXP in an application. Package the parser and transformer in the application.

You can change an application to remove its dependency on the API in a previous version of the parser or the transformer from an earlier version of WebSphere Application Server. Package the JAR files in the application.

In both cases, set the class loader delegation mode to PARENT_LAST on the application or Web module.

Recommendation: Have your applications use the JAXP API instead of using the parser or transformer implementation API directly.

You must recompile a V4.0.x XML application or a V5.x XML application to migrate it to the V6 level.