/** * <code>return new Text(string);</code> * @param string * @return */ public Text makeText(String string) { return new Text(string); }
/** * <code>return new Text(string);</code> * @param string * @return */ public Text makeText(String string) { return new Text(string); }
/** * <code>return new Text(string);</code> * @param string * @return */ public Text makeText(String string) { return new Text(string); }
public Element prependText(String text) { xomElement.insertChild(new nu.xom.Text(text), 0); return this; }
static Node text( final SAText text) { return new Text(text.getText()); }
@Override public Node asNode() { return new Text(asString()); } }
public Element prependText(String text) { xomElement.insertChild(new nu.xom.Text(text), 0); return this; }
public Element appendText(String text) { xomElement.appendChild(new nu.xom.Text(text)); return this; }
public Element appendText(String text) { xomElement.appendChild(new nu.xom.Text(text)); return this; }
public Nodes makeText(String text) { flush(); try { serializer.write(new Text(text)); } catch (IOException e) { throw new RuntimeException(e); } return NONE; }
public Nodes makeText(String text) { flush(); try { serializer.write(new Text(text)); } catch (IOException e) { throw new RuntimeException(e); } return NONE; }
/** FIXME text - needs to trap/check values. * * @param text String content * @return Nodes */ public Nodes makeText(String text) { Nodes nodes = new Nodes(); nodes.append(new Text(text)); return nodes; } /** no-op.
/** * Serialize the given element to XML. * * @param s * The element * @return An XML element */ public static Text text( final SText s) { NullCheck.notNull(s, "Text"); return new Text(s.getText()); }
/** * Found more than one adjacent Text node; merge them. Appends forwards * and removes backwards to minimize memory copies of list elems. */ private void merge(ParentNode node, int i, int j) { int k = i; StringBuffer buf = new StringBuffer(node.getChild(k++).getValue()); while (k <= j) buf.append(node.getChild(k++).getValue()); k = j; while (k >= i) node.removeChild(k--); // replace run with compact merged Text node unless empty String norm = normalizeWhitespace(buf.toString()); if (norm.length() > 0) { node.insertChild(new Text(norm), i); } }
/** * Found more than one adjacent Text node; merge them. Appends forwards * and removes backwards to minimize memory copies of list elems. */ private void merge(ParentNode node, int i, int j) { int k = i; StringBuffer buf = new StringBuffer(node.getChild(k++).getValue()); while (k <= j) buf.append(node.getChild(k++).getValue()); k = j; while (k >= i) node.removeChild(k--); // replace run with compact merged Text node unless empty String norm = normalizeWhitespace(buf.toString()); if (norm.length() > 0) { node.insertChild(new Text(norm), i); } }
private void appendTypeInfoAnnotation(Element complexTypeEl, String typeInfo) { Element annotEl = new Element("xs:annotation", NS_SCHEMA); complexTypeEl.appendChild(annotEl); Element appInfoEl = new Element("xs:appinfo", NS_SCHEMA); annotEl.appendChild(appInfoEl); Text appInfoContent = new Text("type_info"); appInfoEl.appendChild(appInfoContent); Element docEl = new Element("xs:documentation", NS_SCHEMA); annotEl.appendChild(docEl); Text docElContent = new Text(typeInfo); docEl.appendChild(docElContent); }
/** * sets String content. very FRAGILE. not checked against the schema, so use with care. It * is almost always better to use the accessors generated from the schema * * @param value * the XML text content */ public void setStringContent(String value) { Text newText = new Text(value); if (this.getChildCount() == 0) { this.appendChild(newText); } else { Node child = this.getChild(0); if (child instanceof Text) { this.replaceChild(child, newText); } } }
/** process all arg/@substitute in element. * * @param element to edit */ public static void substituteTextContent(CMLElement element) { Nodes textContentArgs = element.query(".//"+CMLArg.NS+"[@substitute[.='.']]", CMLConstants.CML_XPATH); for (int i = 0; i < textContentArgs.size(); i++) { CMLArg textContentArg = (CMLArg) textContentArgs.get(i); String value = textContentArg.getValue(); if (value.startsWith(START_CHARS) && value.endsWith(END_CHARS)) { // unsubstituted arg } else { Element parent = (Element) textContentArg.getParent(); parent.appendChild(new Text(value)); } textContentArg.detach(); } }