xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elena Litani <elit...@ca.ibm.com>
Subject Moving towards common serialization code...
Date Wed, 04 Feb 2004 22:29:48 GMT




Hi all,

As you might know, currently both Xalan and Xerces include their own
version of serialization code. In Xerces the code is located in
org.apache.xml.serialize package [1] and in Xalan it is in
org.apache.xml.serializer package [2].

Historically, the serialization code was first contributed to the Xerces
project. Later given Xalan specific needs, the Xalan team decided to take
this code into their repository and develop it further. So the code has
diverged and the development continued in both code bases.

As you can imagine, this situation is unfortunate. It is a waste to have
two projects continuing separate development on the same functionality.
Ideally, all common components should live in the xml-commons repository.

A week ago Michael Glavassevich, Henry Zongaro, Brian Minchau, Lisa Martin
and I looked at the differences in the Xerces/Xalan serializer code base.
We found that Xalan's serializers have basically the same capability as the
Xerces ones. In addition, during last year there has been a significant
effort to improve performance and fix bugs in the Xalan code base.
Therefore, it seems that Xalan's serializers should become *the main code
base* for development and Xerces' serializer should be deprecated (for at
least a year) and later if possible removed.

We've compared the HTML and XHTML serializers and found that Xalan's
serializers have better performance and conformance to the HTML
specification. Therefore, as a first step, we would like to deprecate the
HTML and XHTML serializers in Xerces. To migrate, users should start using
the JAXP Transformation API, for example:

// Create an "identity" transformer - copies input to output
Transformer t = TransformerFactory.newInstance().newTransformer();

// for "XHTML" serialization, use the output method "xml"
// and set publicId as shown
 t.setOutputProperty(OutputKeys.METHOD, "xml");
 t.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,
 "-//W3C//DTD XHTML 1.0 Transitional//EN");
 t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,
                    "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd");

// For "HTML" serialization, use
t.setOutputProperty(OutputKeys.METHOD, "html");

// Serialize DOM tree
 t.transform(new DOMSource(doc), new StreamResult(System.out));

Currently, we are investigating what it would take for us to deprecate
Xerces' XMLSerializer, since our serializer provides a DOM Level 3
implementation and Xalan's serializer does not have this functionality.

In general, as JAXP 1.3 comes out users should not be using Xerces or Xalan
serialization code directly. Instead, the JAXP Transformer API should be
used to serialize HTML, XHTML, and the SAX and DOM Level 3 API should be
used to serialize DOM.

Any thoughts?

[1]
http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xml/serialize/
[2]
http://cvs.apache.org/viewcvs.cgi/xml-xalan/java/src/org/apache/xml/serializer/

Thank you,
--
Elena Litani/ IBM Toronto



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Mime
View raw message