org.jdom2.Text类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(101)

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

Text介绍

[英]An XML character sequence. Provides a modular, parentable method of representing text. Text makes no guarantees about the underlying textual representation of character data, but does expose that data as a Java String.
[中]XML字符序列。提供了一种模块化的、可作为父对象的文本表示方法。文本不保证字符数据的底层文本表示,但确实将该数据作为Java字符串公开。

代码示例

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

@Override
public Text text(final int line, final int col, final String str) {
  Text t = new Text();
  t.value = str;
  return t;
}

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

@Override
public final String getTextStringValue(Object text) {
  // CDATA is a subclass of Text
  return ((Text)text).getText();
}

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

if ("".equals(text.getValue())) {
  it.remove();
  changed = true;
} else if (tfirst == null || 
    tfirst.getParent() != text.getParent()) {
} else {
  tfirst.append(text.getValue());

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

/**
 * 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.openfuxml/ofx-wiki

Text newText = new Text(txt.getText());
newRoot.addContent(newText);
sb.append(" txt");

代码示例来源:origin: org.mycore/mycore-wcms2

/**
 * Returns the content of an element as string. The element itself
 * is ignored.
 * 
 * @param e the element to get the content from
 * @return the content as string
 */
protected String getContent(Element e) throws IOException {
  XMLOutputter out = new XMLOutputter();
  StringWriter writer = new StringWriter();
  for (Content child : e.getContent()) {
    if (child instanceof Element) {
      out.output((Element) child, writer);
    } else if (child instanceof Text) {
      Text t = (Text) child;
      String trimmedText = t.getTextTrim();
      if (!"".equals(trimmedText)) {
        Text newText = new Text(trimmedText);
        out.output(newText, writer);
      }
    }
  }
  return writer.toString();
}

代码示例来源:origin: Renanse/Ardor3D

switch (bufferType) {
    case Float: {
      final String normalizedText = Text.normalizeString(text);
      if (normalizedText.length() == 0) {
        return new Text("");
      return new Text("");
      final String normalizedText = Text.normalizeString(text);
      if (normalizedText.length() == 0) {
        return new Text("");
      return new Text("");
      final String normalizedText = Text.normalizeString(text);
      if (normalizedText.length() == 0) {
        return new Text("");
      return new Text("");
      final String normalizedText = Text.normalizeString(text);
      if (normalizedText.length() == 0) {
        return new Text("");
      return new Text("");
return new Text(Text.normalizeString(text));

代码示例来源:origin: crosswire/jsword

stack.addFirst(new Text(text));
return;
((Text) top).append(text);
return;
  Content last = current.getContent(size - 1);
  if (last instanceof Text) {
    ((Text) last).append(text);
    return;
current.addContent(new Text(text));

代码示例来源:origin: org.apache.maven.plugins/maven-shade-plugin

if ( lastText != null && lastText.getTextTrim().length() == 0 )
  lastText = (Text) lastText.clone();
  Text finalText = (Text) lastText.clone();
  finalText.setText( finalText.getText().substring( 0, finalText.getText().length() - "    ".length() ) );
  parent.addContent( contentIndex, finalText );

代码示例来源:origin: usethesource/rascal

private IString getString(boolean trim, Text text) throws Skip {
    if (trim) {
      java.lang.String s = text.getTextTrim();
      if ("".equals(s)) {
        throw new Skip();
      }
      return vf.string(s);
    }
    return vf.string(text.getText());
  }
}

代码示例来源:origin: org.mycore/mycore-xeditor

public MCRJDOMContent transform(MCRContent source) throws IOException {
    try {
      Element root = source.asXML().getRootElement().clone();
      for (Text text : root.getDescendants(Filters.text())) {
        text.setText(MCRXMLFunctions.normalizeUnicode(text.getText()));
      }
      return new MCRJDOMContent(root);
    } catch (JDOMException | SAXException ex) {
      throw new IOException(ex);
    }
  }
}

代码示例来源:origin: org.jetbrains.intellij.plugins/intellij-plugin-structure

private static List<String> extractReferencedClasses(@NotNull Element rootElement) {
 List<String> referencedClasses = new ArrayList<String>();
 Iterator<Content> descendants = rootElement.getDescendants();
 while (descendants.hasNext()) {
  Content next = descendants.next();
  if (next instanceof Element) {
   Element element = (Element) next;
   if (isInterestingName(element.getName())) {
    referencedClasses.addAll(extractClasses(element.getTextNormalize()));
   }
   for (Attribute attribute : element.getAttributes()) {
    if (isInterestingName(attribute.getName())) {
     referencedClasses.addAll(extractClasses(attribute.getValue().trim()));
    }
   }
  } else if (next instanceof Text) {
   Parent parent = next.getParent();
   if (parent instanceof Element) {
    if (isInterestingName(((Element) parent).getName())) {
     referencedClasses.addAll(extractClasses(((Text) next).getTextTrim()));
    }
   }
  }
 }
 return referencedClasses;
}

代码示例来源:origin: org.apache.jspwiki/jspwiki-main

sb.append( ((Text)el).getValue() );

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

/**
 * 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.jdom/jdom

/**
 * This constructor creates a new <code>Text</code> node, with the
 * supplied string value as it's character content.
 *
 * @param str the node's character content.
 * @throws IllegalDataException if <code>str</code> contains an
 *         illegal character such as a vertical tab (as determined
 *         by {@link org.jdom2.Verifier#checkCharacterData})
 */
public Text(String str) {
  this(CType.Text);
  setText(str);
}

代码示例来源:origin: org.openfuxml/ofx-wiki

Text newText = new Text(txt.getText());
newRoot.addContent(newText);

代码示例来源:origin: org.apache.maven.plugins/maven-shade-plugin

if ( txt.getTextTrim().length() == 0 )

代码示例来源:origin: org.apache.marmotta/ldclient-provider-xml

str_value = ((Element) value).getValue();
} else if(value instanceof Text) {
  str_value = ((Text) value).getValue();
} else if(value instanceof Attribute) {
  str_value = ((Attribute) value).getValue();

代码示例来源:origin: apache/marmotta

description.setText(Text.normalizeString(pom.getDescription()));
pack.addContent(description);

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

@Override
public Text text(final int line, final int col, final String text) {
  return new Text(text);
}

相关文章

微信公众号

最新文章

更多