本文整理了Java中org.apache.abdera.model.Element.getMustPreserveWhitespace()
方法的一些代码示例,展示了Element.getMustPreserveWhitespace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getMustPreserveWhitespace()
方法的具体详情如下:
包路径:org.apache.abdera.model.Element
类名称:Element
方法名:getMustPreserveWhitespace
[英]Return true if insignificant whitespace must be preserved
[中]如果必须保留不重要的空白,则返回true
代码示例来源:origin: org.apache.abdera/abdera-core
public boolean getMustPreserveWhitespace() {
return internal.getMustPreserveWhitespace();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
public boolean getMustPreserveWhitespace() {
return internal.getMustPreserveWhitespace();
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public boolean getMustPreserveWhitespace() {
OMAttribute attr = getAttribute(SPACE);
String space = (attr != null) ? attr.getAttributeValue() : null;
Base parent = this.getParentElement();
return space != null && space.equalsIgnoreCase("preserve") ? true
: (parent != null && parent instanceof Element) ? ((Element)parent).getMustPreserveWhitespace()
: (parent != null && parent instanceof Document) ? ((Document)parent).getMustPreserveWhitespace()
: true;
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-json
private static void writeElementChildren(Element element, JSONStream jstream) throws IOException {
jstream.startArray();
Object[] children = getChildren(element);
QName parentqname = element.getQName();
for (int n = 0; n < children.length; n++) {
Object child = children[n];
if (child instanceof Element) {
writeElement((Element)child, parentqname, jstream);
if (n < children.length - 1)
jstream.writeSeparator();
} else if (child instanceof TextValue) {
TextValue textvalue = (TextValue)child;
String value = textvalue.getText();
if (!element.getMustPreserveWhitespace()) {
if (!value.matches("\\s*")) {
jstream.writeQuoted(value.trim());
if (n < children.length - 1)
jstream.writeSeparator();
}
} else {
jstream.writeQuoted(value);
if (n < children.length - 1)
jstream.writeSeparator();
}
}
}
jstream.endArray();
}
内容来源于网络,如有侵权,请联系作者删除!