Readability.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:openimaj 作者:
protected static String nodeToString(Node n, boolean pretty) {
    try {
        final DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
        final DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
        final LSSerializer writer = impl.createLSSerializer();

        writer.getDomConfig().setParameter("xml-declaration", false);
        if (pretty) {
            writer.getDomConfig().setParameter("format-pretty-print", true);
        }

        return writer.writeToString(n);
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号