本文整理了Java中org.jdom.Text.getTextNormalize()
方法的一些代码示例,展示了Text.getTextNormalize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Text.getTextNormalize()
方法的具体详情如下:
包路径:org.jdom.Text
类名称:Text
方法名:getTextNormalize
[英]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.
[中]这将返回文本内容,删除所有周围的空格,并将内部空格规范化为单个空格。如果只存在空白,则返回空字符串。
代码示例来源:origin: org.sonatype.maven.archetype/archetype-common
/**
* This will handle printing of <code>{@link Text}</code> strings.
*
* @param text <code>Text</code> to write.
* @param out <code>Writer</code> to use.
*/
protected void printText(Writer out, Text text) throws IOException {
String str=(currentFormat.mode == Format.TextMode.NORMALIZE) ? text.getTextNormalize() : ((currentFormat.mode == Format.TextMode.TRIM) ? text.getText().trim() : text.getText());
out.write(escapeElementEntities(str));
}
代码示例来源:origin: org.dspace/dspace-xmlui-wing
if (!"".equals(text.getTextNormalize()))
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This will handle printing of <code>{@link Text}</code> strings.
*
* @param text <code>Text</code> to write.
* @param out <code>Writer</code> to use.
*/
protected void printText(Writer out, Text text) throws IOException {
String str = (currentFormat.mode == Format.TextMode.NORMALIZE)
? text.getTextNormalize()
: ((currentFormat.mode == Format.TextMode.TRIM) ?
text.getText().trim() : text.getText());
out.write(escapeElementEntities(str));
}
代码示例来源:origin: apache/maven-archetype
/**
* This will handle printing of <code>{@link Text}</code> strings.
*
* @param text <code>Text</code> to write.
* @param out <code>Writer</code> to use.
*/
protected void printText( Writer out, Text text )
throws IOException
{
String str =
( currentFormat.mode == Format.TextMode.NORMALIZE ) ? text.getTextNormalize()
: ( ( currentFormat.mode == Format.TextMode.TRIM ) ? text.getText().trim() : text.getText() );
out.write( escapeElementEntities( str ) );
}
代码示例来源:origin: javasoze/meaningfulweb
private static void getText(Content node, StringBuilder builder) {
if (node instanceof Element) {
Element elem = (Element)node;
List<Content> children = elem.getContent();
if (children != null && children.size() > 0) {
for (Content child : children) {
getText(child, builder);
}
}
}
else if (node instanceof Text) {
String textVal = StringUtils.trim(((Text)node).getTextNormalize() + " ");
if (StringUtils.isNotBlank(textVal)) {
String escaped = StringEscapeUtils.unescapeXml(textVal);
builder.append(escaped + " ");
}
}
else if (node instanceof Comment) {
return;
}
}
代码示例来源:origin: javasoze/meaningfulweb
String normalized = text.getTextNormalize();
if (StringUtils.isNotBlank(normalized)) {
boolean hasText = StringUtils.isNotBlank(normalized);
代码示例来源:origin: uk.org.mygrid.taverna.scufl/scufl-ui-api
private XMLNode createTreeNode(Content content) {
XMLNode node = new XMLNode(content);
if (content instanceof Parent) {
Parent parent = (Parent) content;
Iterator children = parent.getContent().iterator();
while (children.hasNext()) {
Object child = children.next();
if (child instanceof Element) {
node.add(createTreeNode((Content) child));
} else if (textSizeLimit != 0 && child instanceof Text) {
Text text = (Text) child;
if (!text.getTextNormalize().equals("")) {
node.add(createTreeNode(text));
}
}
}
}
return node;
}
}
代码示例来源:origin: net.sf.taverna.t2/renderers-impl
@SuppressWarnings("unchecked")
private XMLNode createTreeNode(Content content) {
XMLNode node = new XMLNode(content);
if (content instanceof Parent) {
Parent parent = (Parent) content;
Iterator children = parent.getContent().iterator();
while (children.hasNext()) {
Object child = children.next();
if (child instanceof Element) {
node.add(createTreeNode((Content) child));
} else if (textSizeLimit != 0 && child instanceof Text) {
Text text = (Text) child;
if (!text.getTextNormalize().equals("")) {
node.add(createTreeNode(text));
}
}
}
}
return node;
}
}
代码示例来源:origin: javasoze/meaningfulweb
addExtractedValue(key, ((Text)val).getTextNormalize());
代码示例来源:origin: javasoze/meaningfulweb
addExtractedValue(xpath, ((Text)objNode).getTextNormalize());
代码示例来源:origin: cytoscape.coreplugins/psi-mi
/**
* Extracts Interactor Name
*/
private void extractInteractorName(ProteinInteractorType cProtein, Interactor interactor)
throws MapperException {
NamesType names = cProtein.getNames();
if (names != null) {
String name = MapperUtil.extractName(cProtein, interactor.getExternalRefs());
// Remove all surrounding and internal white space.
Text jdomText = new Text(name);
name = jdomText.getTextNormalize();
interactor.setName(name);
String fullName = names.getFullName();
interactor.addAttribute(InteractorVocab.FULL_NAME, fullName);
}
}
代码示例来源:origin: cytoscape.coreplugins/psi-mi
/**
* Extracts Interactor Name
*/
private void extractInteractorName(InteractorElementType cProtein, Interactor interactor)
throws MapperException {
NamesType names = cProtein.getNames();
if (names != null) {
String name = MapperUtil.extractName(cProtein, interactor.getExternalRefs());
// Remove all surrounding and internal white space.
Text jdomText = new Text(name);
name = jdomText.getTextNormalize();
interactor.setName(name);
String fullName = names.getFullName();
interactor.addAttribute(InteractorVocab.FULL_NAME, fullName);
}
}
内容来源于网络,如有侵权,请联系作者删除!