Java XML Node Save writeXMLwithXALAN(final Writer writer, final Node node, final String xmlEncoding)

Here you can find the source of writeXMLwithXALAN(final Writer writer, final Node node, final String xmlEncoding)

Description

write XM Lwith XALAN

License

Open Source License

Declaration

private static void writeXMLwithXALAN(final Writer writer, final Node node, final String xmlEncoding) 

Method Source Code

//package com.java2s;
/* Copyright (C) 2011 [Gobierno de Espana]
 * This file is part of "Cliente @Firma".
 * "Cliente @Firma" is free software; you can redistribute it and/or modify it under the terms of:
 *   - the GNU General Public License as published by the Free Software Foundation;
 *     either version 2 of the License, or (at your option) any later version.
 *   - or The European Software License; either version 1.1 or (at your option) any later version.
 * Date: 11/01/11/* w w w  .j  a  va  2s . c  o m*/
 * You may contact the copyright holder at: soporte.afirma5@mpt.es
 */

import java.io.Writer;

import org.w3c.dom.Node;

import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSSerializer;

public class Main {
    private static void writeXMLwithXALAN(final Writer writer, final Node node, final String xmlEncoding) {
        final LSSerializer serializer = ((DOMImplementationLS) node.getOwnerDocument().getImplementation())
                .createLSSerializer();
        serializer.getDomConfig().setParameter("namespaces", Boolean.FALSE); //$NON-NLS-1$
        final com.sun.org.apache.xerces.internal.dom.DOMOutputImpl output = new com.sun.org.apache.xerces.internal.dom.DOMOutputImpl();
        output.setCharacterStream(writer);
        if (xmlEncoding != null) {
            output.setEncoding(xmlEncoding);
        }
        serializer.write(node, output);
    }
}

Related

  1. writeToString(Node node)
  2. writeToString(Node node)
  3. writeXml(final Node node)
  4. writeXMLwalkTree(Node node, int indent, PrintWriter out)
  5. writeXMLwithXALAN(final Writer writer, final Node node, final String xmlEncoding)
  6. xmlSelectNodes0(List list, Node node, String path[], int n)
  7. xmltostring(String indent, Node node)