Java XML Element to String elementToString(Element el)

Here you can find the source of elementToString(Element el)

Description

element To String

License

Open Source License

Declaration

public static String elementToString(Element el) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

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

public class Main {
    public static String elementToString(Element el) {
        if (el == null)
            return "";
        Document document = el.getOwnerDocument();
        DOMImplementationLS domImplLS = (DOMImplementationLS) document
                .getImplementation();//from www.  ja va 2s . co  m
        LSSerializer serializer = domImplLS.createLSSerializer();
        return serializer.writeToString(el);
    }
}

Related

  1. elementToStream(Element element, OutputStream out)
  2. elementToStream(Element element, OutputStream out)
  3. elementToString(Element e)
  4. elementToString(Element element)
  5. elementToString(Element element)
  6. elementToString(Element element)
  7. elementToString(Element elt, String prefix)