org.jdom2.output.Format.setTextMode()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(280)

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

Format.setTextMode介绍

[英]This sets the text output style. Options are available as static TextMode instances. The default is TextMode#PRESERVE.
[中]这将设置文本输出样式。选项作为静态TextMode实例提供。默认设置为TextMode#PRESERVE。

代码示例

代码示例来源:origin: org.jdom/jdom

  1. /**
  2. * Returns a new Format object that performs whitespace normalization, uses
  3. * the UTF-8 encoding, doesn't expand empty elements, includes the
  4. * declaration and encoding, and uses the default entity escape strategy.
  5. * Tweaks can be made to the returned Format instance without affecting
  6. * other instances.
  7. *
  8. * @return a Format with whitespace normalization
  9. */
  10. public static Format getCompactFormat() {
  11. Format f = new Format();
  12. f.setTextMode(TextMode.NORMALIZE);
  13. return f;
  14. }

代码示例来源:origin: org.jdom/jdom

  1. /**
  2. * Returns a new Format object that performs whitespace beautification with
  3. * 2-space indents, uses the UTF-8 encoding, doesn't expand empty elements,
  4. * includes the declaration and encoding, and uses the default entity
  5. * escape strategy.
  6. * Tweaks can be made to the returned Format instance without affecting
  7. * other instances.
  8. *
  9. * @return a Format with whitespace beautification
  10. */
  11. public static Format getPrettyFormat() {
  12. Format f = new Format();
  13. f.setIndent(STANDARD_INDENT);
  14. f.setTextMode(TextMode.TRIM);
  15. return f;
  16. }

代码示例来源:origin: com.github.ixa-ehu/kaflib-naf

  1. /** Returns a string containing the XML content of a KAFDocument object. */
  2. static String kafToStr(KAFDocument kaf) {
  3. XMLOutputter out = new XMLOutputter(Format.getPrettyFormat().setLineSeparator(LineSeparator.UNIX).setTextMode(Format.TextMode.TRIM_FULL_WHITE));
  4. Document jdom = KAFToDOM(kaf);
  5. return out.outputString(jdom);
  6. }

代码示例来源:origin: Vhati/Slipstream-Mod-Manager

  1. format.setTextMode( Format.TextMode.PRESERVE );
  2. format.setExpandEmptyElements( false );
  3. format.setOmitDeclaration( false );

代码示例来源:origin: pwm-project/pwm

  1. final XMLOutputter outputter = new XMLOutputter();
  2. final Format format = Format.getRawFormat();
  3. format.setTextMode( Format.TextMode.PRESERVE );
  4. format.setLineSeparator( "" );
  5. outputter.setFormat( format );

代码示例来源:origin: Vhati/Slipstream-Mod-Manager

  1. format.setTextMode( Format.TextMode.PRESERVE ); // Permit leading/trailing space.
  2. format.setExpandEmptyElements( false );
  3. format.setOmitDeclaration( false );

相关文章