本文整理了Java中org.jdom2.Text.<init>()
方法的一些代码示例,展示了Text.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Text.<init>()
方法的具体详情如下:
包路径:org.jdom2.Text
类名称:Text
方法名:<init>
[英]This is the protected, no-args constructor standard in all JDOM classes. It allows subclassers to get a raw instance with no initialization.
[中]这是所有JDOM类中受保护的无参数构造函数标准。它允许子类程序在不初始化的情况下获取原始实例。
代码示例来源: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 Text text(final int line, final int col, final String text) {
return new Text(text);
}
代码示例来源:origin: org.jdom/jdom
/**
* This adds text content to this element. It does not replace the
* existing content as does <code>setText()</code>.
*
* @param str <code>String</code> to add
* @return this element modified
* @throws IllegalDataException if <code>str</code> contains an
* illegal character such as a vertical tab (as determined
* by {@link org.jdom2.Verifier#checkCharacterData})
*/
public Element addContent(final String str) {
return addContent(new Text(str));
}
代码示例来源:origin: org.jdom/jdom
/**
* Sets the content of the element to be the text given. All existing text
* content and non-text context is removed. If this element should have both
* textual content and nested elements, use <code>{@link #setContent}</code>
* instead. Setting a null text value is equivalent to setting an empty
* string value.
*
* @param text new text content for the element
* @return the target element
* @throws IllegalDataException if the assigned text contains an illegal
* character such as a vertical tab (as
* determined by {@link
* org.jdom2.Verifier#checkCharacterData})
*/
public Element setText(final String text) {
content.clear();
if (text != null) {
addContent(new Text(text));
}
return this;
}
代码示例来源:origin: org.jdom/jdom
@Override
public void process(final XMLStreamWriter out, final Format format,
final Text text) throws XMLStreamException {
final List<Text> list = Collections.singletonList(text);
final FormatStack fstack = new FormatStack(format);
final Walker walker = buildWalker(fstack, list, false);
if (walker.hasNext()) {
final Content c = walker.next();
if (c == null) {
printText(out, fstack, new Text(walker.text()));
} else if (c.getCType() == CType.Text) {
printText(out, fstack, (Text)c);
}
}
out.flush();
}
代码示例来源:origin: org.jdom/jdom
@Override
public void process(final XMLEventConsumer out, final Format format,
final XMLEventFactory eventfactory, final Text text) throws XMLStreamException {
final List<Text> list = Collections.singletonList(text);
final FormatStack fstack = new FormatStack(format);
final Walker walker = buildWalker(fstack, list, false);
if (walker.hasNext()) {
final Content c = walker.next();
if (c == null) {
printText(out, fstack, eventfactory, new Text(walker.text()));
} else if (c.getCType() == CType.Text) {
printText(out, fstack, eventfactory, (Text)c);
}
}
}
代码示例来源:origin: org.jdom/jdom
@Override
public org.w3c.dom.Text process(org.w3c.dom.Document basedoc,
Format format, Text text) {
final List<Text> list = Collections.singletonList(text);
final FormatStack fstack = new FormatStack(format);
final Walker walker = buildWalker(fstack, list, false);
if (walker.hasNext()) {
final Content c = walker.next();
if (c == null) {
return printText(fstack, basedoc, new Text(walker.text()));
}
if (c.getCType() == CType.Text) {
return printText(fstack, basedoc, (Text)c);
}
}
// return an empty string if nothing happened.
return null;
}
代码示例来源:origin: org.jdom/jdom
n = printCDATA(fstack, basedoc, new CDATA(text));
} else {
n = printText(fstack, basedoc, new Text(text));
代码示例来源:origin: crosswire/jsword
/**
* Text
*
* @param text the text for this element
* @return a text element
*/
public Text createText(String text) {
return new Text(text);
}
}
代码示例来源:origin: org.jdom/jdom
printText(out, fstack, new Text(indent));
printText(out, fstack, new Text(indent));
代码示例来源:origin: org.jdom/jdom
printText(out, fstack, new Text(indent));
printText(out, fstack, new Text(indent));
代码示例来源:origin: org.jdom/jdom
printText(out, fstack, eventfactory, new Text(indent));
printText(out, fstack, eventfactory, new Text(indent));
代码示例来源:origin: org.jdom/jdom
printCDATA(out, fstack, new CDATA(walker.text()));
} else {
printText(out, fstack, new Text(walker.text()));
代码示例来源:origin: org.jdom/jdom
printCDATA(out, fstack, eventfactory, new CDATA(walker.text()));
} else {
printText(out, fstack, eventfactory, new Text(walker.text()));
代码示例来源:origin: io.wcm/io.wcm.handler.richtext
private List<Content> processPlainText(String text) {
if (StringUtils.isBlank(text)) {
return ImmutableList.of();
}
List<Content> content = new ArrayList<>();
String[] lines = StringUtils.splitByWholeSeparatorPreserveAllTokens(text, "\n");
for (int i = 0; i < lines.length; i++) {
if (i > 0) {
content.add(new Element("br"));
}
content.add(new Text(lines[i]));
}
return ImmutableList.copyOf(content);
}
代码示例来源:origin: org.jdom/jdom
printCDATA(out, fstack, new CDATA(text));
} else {
printText(out, fstack, new Text(text));
代码示例来源:origin: org.mycore/mycore-xeditor
public ProcessingInstruction getProcessingInstruction() {
if (pi == null) {
String data = RAW_OUTPUTTER.outputString(new Text(text));
this.pi = new ProcessingInstruction(type, data);
}
return pi;
}
代码示例来源:origin: Unidata/thredds
public static Element getVersionElement() {
Element lib = new Element("lib");
Element name = new Element("name");
Element ver = new Element("version");
name.addContent(new Text("java-opendap"));
lib.addContent(name);
ver.addContent(new Text(version));
lib.addContent(ver);
return (lib);
}
代码示例来源:origin: io.wcm/io.wcm.handler.commons
/**
* {@inheritDoc} Overrides standard setText method to add special xHTML conformant CDATA block
* as workaround for browsers that does not interpret XHTML-encoded script blocks correctly.
*/
@Override
public Element setText(String script) {
if (StringUtils.isEmpty(script)) {
super.setText(script);
}
else {
this.addContent(new Text("\n//"));
// encapsulate script block in CDATA block
this.addContent(new CDATA("\n"
+ script
+ "\n//"));
this.addContent("\n");
}
return this;
}
代码示例来源:origin: pwm-project/pwm
private static Element challengeToXml(
final StoredChallengeItem loopChallenge,
final StoredResponseItem answer,
final String elementName
)
{
final Element responseElement = new Element( elementName );
responseElement.addContent( new Element( XML_NODE_CHALLENGE ).addContent( new Text( loopChallenge.getQuestionText() ) ) );
final Element answerElement = answerToXml( loopChallenge.getAnswer() );
responseElement.addContent( answerElement );
responseElement.setAttribute( XML_ATTRIBUTE_REQUIRED, Boolean.toString( loopChallenge.getResponseLevel() == ResponseLevel.REQUIRED ) );
return responseElement;
}
内容来源于网络,如有侵权,请联系作者删除!