You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Elena Litani <el...@ca.ibm.com> on 2004/02/04 23:29:48 UTC

Moving towards common serialization code...




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


Re: Moving towards common serialization code...

Posted by Berin Lautenbach <be...@wingsofhermes.org>.
Joseph,

As an aside - we have been having some issues in xml-security around 
serialisation prior to encrypting a sub-set of a document.

Having a single serialiser in xml-commons would be useful for us as well.

(Xposting to security-dev for information.)

Cheers,
	Berin

Joseph Kesselman wrote:

> 
> 
> 
> I definitely like the idea of sharing our serializers, and moving them to
> xml-commons so they're generally available to Apache-based XML
> applications, but I'd like to pause for a sanity-check.
> 
> 1) There have been some known issues in the Xalan "default identity
> transformation" code -- see the long-standing Bugzilla entry at
>       http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5779
> That really should be fixed and verified before I would be comfortable with
> recommending that Xerces cut over.
> 
> 2) If we're suggesting using the Xalan serializers to write out the
> contents of a DOM, we should review Xalan's namespace fixups to make sure
> they're compatable with the recommendations being made by DOM Level 3.
> 
> ______________________________________
> Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
> "The world changed profoundly and unpredictably the day Tim Berners Lee
> got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
> 
> 
> 


Re: Moving towards common serialization code...

Posted by Berin Lautenbach <be...@wingsofhermes.org>.
Joseph,

As an aside - we have been having some issues in xml-security around 
serialisation prior to encrypting a sub-set of a document.

Having a single serialiser in xml-commons would be useful for us as well.

(Xposting to security-dev for information.)

Cheers,
	Berin

Joseph Kesselman wrote:

> 
> 
> 
> I definitely like the idea of sharing our serializers, and moving them to
> xml-commons so they're generally available to Apache-based XML
> applications, but I'd like to pause for a sanity-check.
> 
> 1) There have been some known issues in the Xalan "default identity
> transformation" code -- see the long-standing Bugzilla entry at
>       http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5779
> That really should be fixed and verified before I would be comfortable with
> recommending that Xerces cut over.
> 
> 2) If we're suggesting using the Xalan serializers to write out the
> contents of a DOM, we should review Xalan's namespace fixups to make sure
> they're compatable with the recommendations being made by DOM Level 3.
> 
> ______________________________________
> Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
> "The world changed profoundly and unpredictably the day Tim Berners Lee
> got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
> 
> 
> 


Re: Moving towards common serialization code...

Posted by Joseph Kesselman <ke...@us.ibm.com>.



I definitely like the idea of sharing our serializers, and moving them to
xml-commons so they're generally available to Apache-based XML
applications, but I'd like to pause for a sanity-check.

1) There have been some known issues in the Xalan "default identity
transformation" code -- see the long-standing Bugzilla entry at
      http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5779
That really should be fixed and verified before I would be comfortable with
recommending that Xerces cut over.

2) If we're suggesting using the Xalan serializers to write out the
contents of a DOM, we should review Xalan's namespace fixups to make sure
they're compatable with the recommendations being made by DOM Level 3.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


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


Re: Moving towards common serialization code...

Posted by Joseph Kesselman <ke...@us.ibm.com>.



I definitely like the idea of sharing our serializers, and moving them to
xml-commons so they're generally available to Apache-based XML
applications, but I'd like to pause for a sanity-check.

1) There have been some known issues in the Xalan "default identity
transformation" code -- see the long-standing Bugzilla entry at
      http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5779
That really should be fixed and verified before I would be comfortable with
recommending that Xerces cut over.

2) If we're suggesting using the Xalan serializers to write out the
contents of a DOM, we should review Xalan's namespace fixups to make sure
they're compatable with the recommendations being made by DOM Level 3.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


Re: Moving towards common serialization code...

Posted by Neeraj Bajaj <Ne...@Sun.COM>.
Hello Elena,

Sorry for the late response on this. I support the overall idea of 
moving towards comon serialization code. I have few questions though. 
Where the code would reside and in what package ? You have expressed the 
desire of putting common code in xml-commons but you have said that 
Xalan serializer would become the main code base. Is the plan to put 
that code in xml-commons ?

Please read more inline..

Elena Litani wrote:

> We've compared the HTML and XHTML serializers and found that Xalan's
> serializers have better performance and conformance to the HTML
> specification. 

That's good :-)

>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.

I would like to more here, since XMLSerializer has DOM L3 LS 
functionality. Would this class also move to Xalan ? Who would maintain 
this class ? Xalan/Xerces committers ?


> 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.

Well, To serialize above mentioned document types, users can still use 
JAXP 1.2 until JAXP 1.3 comes out :-) Though JAXP 1.3 is not final yet, 
but JAXP 1.3 apis will be perfectly backward compatible with JAXP 1.2


Thanks,
Neeraj



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