public static String nodeToString(Node node)
    {
        StringWriter sw = new StringWriter();
        if (node instanceof Attr)
        {
            Attr attr = (Attr) node;
            return attr.getValue();
        }
        try
        {
            Transformer t = TransformerFactory.newInstance().newTransformer();
            t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
            t.setOutputProperty(OutputKeys.INDENT, "no");
            t.transform(new DOMSource(node), new StreamResult(sw));
        }
        catch (TransformerException te)
        {
            LOG.warning("Transformer Exception: " + te.getMessage());
        }
        return sw.toString();
    }
public static String nodeToString ( Node node ) { StringWriter sw = new StringWriter ( ) ; if ( node instanceof Attr ) { Attr attr = ( Attr ) node ; return attr . getValue ( ) ; } try { Transformer t = TransformerFactory . newInstance ( ) . newTransformer ( ) ; t . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , "yes" ) ; t . setOutputProperty ( OutputKeys . INDENT , "no" ) ; t . transform ( new DOMSource ( node ) , new StreamResult ( sw ) ) ; } catch ( TransformerException te ) { LOG . warning ( "Transformer Exception: " + te . getMessage ( ) ) ; } return sw . toString ( ) ; }
Converts the given {@link Node} to a {@link String}.