transform(source, result);
}
public void transform(Node sourceNode, Writer resultWriter) throws XMLPlatformException {
try {
XMLDocument xmlDocument;
if (sourceNode.getNodeType() == Node.DOCUMENT_NODE) {
xmlDocument = (XMLDocument)sourceNode;
} else {
xmlDocument = (XMLDocument)sourceNode.getOwnerDocument();
}
if (isFragment()) {
xmlDocument.setEncoding(null);
xmlDocument.setVersion(null);
} else {
xmlDocument.setEncoding(getEncoding());
xmlDocument.setVersion(getVersion());
}
XMLNode xmlNode = (XMLNode)sourceNode;
PrintWriter printWriter = new PrintWriter(resultWriter);
XDKPrintDriver xdkPrintDriver = new XDKPrintDriver(printWriter);