com.ebmwebsourcing.easycommons.xml.XMLPrettyPrinter.getTransformer()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中com.ebmwebsourcing.easycommons.xml.XMLPrettyPrinter.getTransformer()方法的一些代码示例,展示了XMLPrettyPrinter.getTransformer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLPrettyPrinter.getTransformer()方法的具体详情如下:
包路径:com.ebmwebsourcing.easycommons.xml.XMLPrettyPrinter
类名称:XMLPrettyPrinter
方法名:getTransformer

XMLPrettyPrinter.getTransformer介绍

[英]Get a transformer from a stylesheet source
[中]从样式表源获取转换器

代码示例

代码示例来源:origin: com.ebmwebsourcing.easycommons/easycommons-util

/**
 * Prettify the node into the output stream.
 */
public static void prettify(Node node, OutputStream out,String encoding) throws Exception {
  Source source = new DOMSource(node);
  Source stylesheetSource = getStyleSheetSource();
  Transformer transformer = getTransformer(stylesheetSource);
   transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
   transformer.transform(source, new StreamResult(out));
}

代码示例来源:origin: com.ebmwebsourcing.easycommons/easycommons-util

/**
 * Prettify the node into the output stream.
 */
public static void prettify(Node node, OutputStream out) throws Exception {
  Source source = new DOMSource(node);
  Source stylesheetSource = getStyleSheetSource();
  Transformer transformer = getTransformer(stylesheetSource);
  transformer.transform(source, new StreamResult(out));
}

代码示例来源:origin: com.ebmwebsourcing.easycommons/easycommons-util

/**
 * Prettify the xml input stream into the output stream.
 */
public static void prettify(InputStream in, OutputStream out) throws Exception {
  StreamSource source = new StreamSource(in);
  Source stylesheetSource = getStyleSheetSource();
  Transformer transformer = getTransformer(stylesheetSource);
  transformer.transform(source, new StreamResult(out));
}

代码示例来源:origin: org.ow2.easycommons/easycommons-util

public static void prettify(final Source source, final OutputStream out, final String encoding)
    throws TransformerException {
  final Source stylesheetSource = getStyleSheetSource();
  final Transformer transformer = getTransformer(stylesheetSource);
  if (encoding != null) {
    transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
  }
  transformer.transform(source, new StreamResult(out));
}

相关文章