Michael Glavassevich schrieb am 11.01.2011 um 08:17 (-0500): > > Michael Ludwig <mil...@gmx.de> wrote on 01/11/2011 04:40:50 AM: > > > http://www.ibm.com/developerworks/xml/library/x-tipsxtf/index.html > > > > This old article from almost ten years ago talks says you can also > > invoke the serializer directly, and it still works: > > > > import org.apache.xml.serializer.OutputPropertiesFactory; > > import org.apache.xml.serializer.Serializer; > > import org.apache.xml.serializer.SerializerFactory; > > > > Properties op = OutputPropertiesFactory.getDefaultMethodProperties > ("xml"); > > Serializer srlzr = SerializerFactory.getSerializer(op); > > srlzr.setOutputStream(new FileOutputStream("sax2srlzr.xml")); > > fireEvents(srlzr.asContentHandler()); // calls startDocument() etc > > FYI to folks that this may not be obvious to, this example uses Xalan's > serializer (serializer.jar), not the one native to Xerces-J > (org.apache.xml.serialize.* - note the slightly different and confusing > package name) which was deprecated years ago in favour of the Xalan one.
Ah yes. And to add to the confusion, the old article I'm referring to above mentions org.apache.xalan.serialize.Serializer (note the different namespace), yet another serializer namespace, which has been deprecated as of Xalan 2.7.1, and possibly earlier, and possibly along with the Xerces-J serializer. -- Michael Ludwig --------------------------------------------------------------------- To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org