Java XML Node Serialize serializeDom(Node domElement)

Here you can find the source of serializeDom(Node domElement)

Description

serialize Dom

License

Apache License

Declaration

public static String serializeDom(Node domElement) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static String serializeDom(Node domElement) {
        Document document = domElement.getOwnerDocument();
        DOMImplementationLS domImplLS = (DOMImplementationLS) document.getImplementation();
        LSSerializer serializer = domImplLS.createLSSerializer();
        // by default its true, so set it to omit printing xml-declaration
        serializer.getDomConfig().setParameter("xml-declaration", false);
        return serializer.writeToString(domElement);
    }//from www . j ava2 s.c o m
}

Related

  1. serialize(Node n, StreamResult sr)
  2. serialize(Node node)
  3. serialize(Node node)
  4. serialize(Node node, File outdir, String fileName)
  5. serialize(NodeList nodeList)
  6. serializeDom(Node node, StringBuffer writeString)
  7. serializeElement(Element element)
  8. serializeElement(Element element, boolean omitXmlDeclaration, boolean indent, String method)
  9. serializeNode(Node node)