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

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

本文整理了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

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

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

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

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

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

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

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

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

final XMLOutputter outputter = new XMLOutputter();
final Format format = Format.getRawFormat();
format.setTextMode( Format.TextMode.PRESERVE );
format.setLineSeparator( "" );
outputter.setFormat( format );

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

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

相关文章