All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.araguacaima.commons.utils.XMLtoString Maven / Gradle / Ivy

Go to download

Common utilities is a set of java utilities for managing typical actions when working with enums, files, exceptions, zip/jar files, classes (via Reflection), maps, numbers and so on. Most of the utilities extend functionalities offered by amazing libraries such as: * commons-beanutils (apache) * commons-lang3 (apache) * commons-io (apache) * commons-math3 (apache) * commons-collections4 (apache) * jreversepro (akkumar)

There is a newer version: 1.5.17
Show newest version
package com.araguacaima.commons.utils;

import org.w3c.dom.Document;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.StringWriter;

public class XMLtoString {

    public static String fncObtenerStringDoc(Document doc)
            throws Exception {
        TransformerFactory tFactory = TransformerFactory.newInstance();
        Transformer transformer = tFactory.newTransformer();
        DOMSource source = new DOMSource(doc);
        StringWriter sw = new StringWriter();
        StreamResult result = new StreamResult(sw);
        transformer.transform(source, result);
        return sw.toString();

    }

}







© 2015 - 2025 Weber Informatics LLC | Privacy Policy