public static void serialize(NodeInfo node, Result destination, Properties outputProperties, Configuration config)
throws XPathException {
int type = node.getNodeKind();
if (type==Type.DOCUMENT || type==Type.ELEMENT) {
DocumentSender sender = new DocumentSender(node);
Receiver receiver =
ResultWrapper.getReceiver(destination,
config,
outputProperties,
null);
NamespaceReducer reducer = new NamespaceReducer();
reducer.setUnderlyingReceiver(receiver);
reducer.setConfiguration(config);
sender.send(reducer);
} else {
throw new DynamicError("Node to be serialized must be a Document or Element node");
}
}