Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Serialize selected elements to a Writer.

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Michael Kay" <mike AT saxonica.com>
  • To: "'Elliotte Harold'" <elharo AT metalab.unc.edu>, "'David Bullock'" <db AT dawnbreaks.net>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Serialize selected elements to a Writer.
  • Date: Sat, 14 Oct 2006 10:01:47 +0100


If you want to do this with Saxon, it's something like:

Configuration config = new Configuration();
SerializerFactory sfactory = config.getSerializerFactory();
Result result = new StreamResult(myWriter);
Properties props = new Properties();
props.setProperty("method", "xml");
props.setProperty("encoding", "whatever");
Receiver serializer = sfactory.getReceiver(
result, config.makePipelineConfiguration(), props);
new DocumentWrapper(xomDocument, "", config).copy(serializer,
NodeInfo.ALL_NAMESPACES, false, 0);


Just take care that the encoding used by the Writer is compatible with the
encoding set for the serializer.

Michael Kay
http://www.saxonica.com/





Archive powered by MHonArc 2.6.24.

Top of Page