org.jdom.Text.normalizeString()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(115)

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

Text.normalizeString介绍

[英]This returns a new string with all surrounding whitespace removed and internal whitespace normalized to a single space. If only whitespace exists, the empty string is returned.

Per XML 1.0 Production 3 whitespace includes: #x20, #x9, #xD, #xA
[中]这将返回一个新字符串,删除所有周围的空格,并将内部空格规范化为单个空格。如果只存在空白,则返回空字符串。
根据XML 1.0产品,3个空格包括:#x20、#x9、#xD、#xA

代码示例

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

/**
 * This returns the textual content with all surrounding whitespace
 * removed and internal whitespace normalized to a single space.  If
 * only whitespace exists, the empty string is returned.
 *
 * @return normalized text content or empty string
 */
public String getTextNormalize() {
  return normalizeString(getText());
}

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

/**
 * Returns the textual content of this element with all surrounding
 * whitespace removed and internal whitespace normalized to a single space.
 * If no textual value exists for the element, or if only whitespace exists,
 * the empty string is returned.
 *
 * @return                     normalized text content for this element, or
 *                             empty string if none
 */
public String getTextNormalize() {
  return Text.normalizeString(getText());
}

代码示例来源:origin: org.sonatype.maven.archetype/archetype-common

/**
 * This will handle printing a string. Escapes the element entities, trims interior whitespace,
 * etc. if necessary.
 */
private void printString(Writer out, String str) throws IOException {
  if (currentFormat.mode == Format.TextMode.NORMALIZE) {
    str=Text.normalizeString(str);
  }
  else if (currentFormat.mode == Format.TextMode.TRIM) {
    str=str.trim();
  }
  out.write(escapeElementEntities(str));
}

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

/**
 * This will handle printing a string.  Escapes the element entities,
 * trims interior whitespace, etc. if necessary.
 */
private void printString(Writer out, String str) throws IOException {
  if (currentFormat.mode == Format.TextMode.NORMALIZE) {
    str = Text.normalizeString(str);
  }
  else if (currentFormat.mode == Format.TextMode.TRIM) {
    str = str.trim();
  }
  out.write(escapeElementEntities(str));
}

代码示例来源:origin: apache/maven-archetype

/**
 * This will handle printing a string.  Escapes the element entities,
 * trims interior whitespace, etc. if necessary.
 */
private void printString( Writer out, String str )
  throws IOException
{
  if ( currentFormat.mode == Format.TextMode.NORMALIZE )
  {
    str = Text.normalizeString( str );
  }
  else if ( currentFormat.mode == Format.TextMode.TRIM )
  {
    str = str.trim();
  }
  out.write( escapeElementEntities( str ) );
}

代码示例来源:origin: org.kathrynhuxtable.maven.plugins/htmlfilter-site-maven-plugin

/**
 * This will handle printing a string. Escapes the element entities, trims
 * interior whitespace, etc. if necessary.
 */
private void printString(Writer out, String str) throws IOException {
  if (currentFormat.getTextMode() == Format.TextMode.NORMALIZE) {
    str = Text.normalizeString(str);
  } else if (currentFormat.getTextMode() == Format.TextMode.TRIM) {
    str = str.trim();
  }
  out.write(escapeElementEntities(str));
}

相关文章