On Wed, 2004-03-31 at 01:10, Michael Glavassevich wrote: > On Tue, 30 Mar 2004, Simon Kitching wrote: > > > Hi, > > > > I see the org.apache.xml.serialize.HTMLSerializer class is deprecated in > > release 2.6.2. > > > > Can anyone tell me what the recommended replacement is? > > We recommend you use JAXP for HTML serialization [1] instead of using > HTMLSerializer. > > > [NB: Perhaps it would be nice to add this info to class description > > javadoc when the class is deprecated?]. > > Before the last release it was decided that Xerces will be moving towards > a common serialization codebase with Xalan [2]. Deprecating HTMLSerializer > and XHTMLSerializer was the first step in that direction. Over time the > HTML serializer code in Xerces has become orphaned, while on the Xalan > side there have been bug fixes and performance improvements. > > > The current situation (2.6.2) appears to be: > > HTMLSerialized: deprecated > > XHTMLSerializer: deprecated > > XMLSerializer: NOT deprecated > > TextSerializer: NOT deprecated > > BaseMarkupSerializer: NOT deprecated > > The XMLSerializer will probably be deprecated in a future release. Once > DOM Level 3 Load and Save is finalized we'll have a standard serialization > mechanism. Users should be using org.w3c.dom.ls.LSSerializer to serialize > a DOM instead of using Xerces' serialization code directly.
Thanks for your reply, Michael. So in order to serialize my dom object to HTML, I can either: (a) bundle the whole of Xalan with my app, or (b) require java1.4 (to get xslt serialization), or (c) use the DOM3 load/save API, which is not yet approved, or (d) use the deprecated HtmlSerializer? None of the above seems particularly appealing. I guess that (c) is meant to be the future solution to this issue, right? Can anyone tell me how in DOM3 LS you specify that the output is to be HTML? I can't see any flag anywhere that controls that. There's nothing on the LSSerializer class, nor on the DOMConfiguration class that can set the output format as far as I can see.. And is there an equivalent to the existing "indentation-level" setting, where the depth of pretty-printing indentation can be set? It also appears that the org.apache.xerces.dom3.DOMConfiguration must be accessed directly at the moment in order to use DOM3 LS, as follows. All the other necessary classes are present in the org.w3c.dom namespace, but not that class. I presume that when DOM3 core becomes "approved", this will be fixed but until now all DOM3 LS users must directly depend on org.apache.xerces.dom3.DOMConfiguration? Note that I'm not terribly worried by this (I was using org.apache.xml.serialize.HtmlSerializer after all :-), just would appreciate confirmation that I'm not missing something obvious. Here's my current (partial) solution: // example of serializing via DOM3 LS ByteArrayOutputStream baos = new ByteArrayOutputStream(); DOMImplementation domImpl = doc.getImplementation(); DOMImplementationLS factory = (DOMImplementationLS) domImpl; LSOutput output = factory.createLSOutput(); output.setByteStream(baos); LSSerializer serializer = factory.createLSSerializer(); DOMConfiguration config = serializer.getDomConfig(); config.setParameter("format-pretty-print", Boolean.TRUE); // set indentation depth??? // somehow set output to HTML format??? serializer.write(doc, output); Thanks for the information. Regards, Simon --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]