Java 8 Text - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Text class.

This code example shows how to use the following methods: setData, getNodeValue
        // Merge with any previous text node if possible. 
        if (coalescing) {
            Node lastChild = parent.getLastChild();
            if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
                Text textNode = (Text) lastChild;
                textNode.setData(textNode.getNodeValue() + text);
                return; 
            } 
        } 
        // Okay, we really do need a new text node 
        parent.appendChild(token == XmlPullParser.CDSECT
                ? new CDATASectionImpl(document, text)
                : new TextImpl(document, text));
    } 
 
    @Override 
    public void setEntityResolver(EntityResolver resolver) {
        entityResolver = resolver;
    } 
 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: cloneNode
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getParentNode, getTextContent
  } 
 
  public void visitText(Text t) {
    String escaped;
    if (escapeHtmlEntities) {
      escaped = UiBinderWriter.escapeText(t.getTextContent(),
        preserveWhiteSpace(t));
    } else { 
      escaped = t.getTextContent();
      if (!preserveWhiteSpace(t)) {
        escaped = escaped.replaceAll("\\s+", " ");
      } 
      escaped = UiBinderWriter.escapeTextForJavaStringLiteral(escaped);
    } 
 
    buffer.append(escaped);
  } 
 
  private boolean preserveWhiteSpace(Text t) {
    Element parent = Node.ELEMENT_NODE == t.getParentNode().getNodeType()

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: splitText
	public String getClassName() {
		return "Text"; 
	} 
 
	public Scriptable jsFunction_splitText(int offset) throws DOMException {
		return exportNode(textNode.splitText(offset));
	} 
 
} 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getWholeText
				Element domElement = (Element) domNode;
				return prefix + domElement.getNodeName();
			} 
			if (domNode instanceof Text) {
				Text domText = (Text) domNode;
				return prefix + domText.getWholeText();
			} else { 
				OcamlPlugin.logWarning("DOM element type not handled: " 
						+ element.getClass().getSimpleName());
			} 
			// else if (domNode instanceof Element) { 
			// Element domElement = (Element) domNode; 
			// return prefix + domElement.getNodeName(); 
			// } 
		} 
 
		return super.getText(element);
	} 
} 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getNodeValue
      write(node, tabs);
    } 
  } 
 
  private void writeText(Text text) throws IOException {
    String nodeValue = text.getNodeValue();
    write(nodeValue.trim());
  } 
 
  private void writeCdata(CDATASection cData) throws IOException {
    String cDataText = "<![CDATA[" + cData.getNodeValue() + "]]>";
    write(cDataText);
  } 
 
  private void write(Node node, int tabs) throws IOException {
    if (node instanceof Element)
      write((Element) node, tabs);
    else if (node instanceof CDATASection)
      writeCdata((CDATASection) node);
    else if (node instanceof Text)
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getData, getParentNode
		xpath.append(attr.getName());
	} 
 
	private void computeBasicXPath(Text text, StringBuilder xpath,
			NamespaceInfos namespaceInfos) {
		computeBasicXPath(text.getParentNode(), xpath, namespaceInfos);
		xpath.append("[text()=");
		addXPathConditionValue(text.getData(), xpath);
		xpath.append("]");
		xpath.append("/text()");
	} 
 
	private void addXPathConditionValue(String value, StringBuilder xpath) {
		char c = getEnclosingXPathCondition(value);
		xpath.append(c);
		xpath.append(value);
		xpath.append(c);
 
	} 
 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getNextSibling, getNodeValue
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getParentNode, getTextContent
      buffer.append(replacement);
    } 
  } 
 
  public void visitText(Text t) {
    String escaped = UiBinderWriter.escapeText(t.getTextContent(),
        preserveWhiteSpace(t));
    buffer.append(escaped);
  } 
 
  private boolean preserveWhiteSpace(Text t) {
    Element parent = Node.ELEMENT_NODE == t.getParentNode().getNodeType()
        ? (Element) t.getParentNode() : null;
 
    boolean preserveWhitespace = parent != null
        && "pre".equals(parent.getTagName());
    // TODO(rjrjr) What about script blocks? 
    return preserveWhitespace;
  } 
} 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setData
 
        if ( this.title == null )
        { 
            this.title = document.createElement( "title" );
            this.titleText = document.createTextNode( titleText );
            this.title.appendChild( this.titleText );
            this.head.appendChild( title );
        } 
 
        this.titleText.setData( titleText );
    } 
} 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Java 8 Text Questions & Answers:

See Code Examples for Java 8 Text Methods: