Java 8 CharacterData - 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 CharacterData 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;
    } 
 
6
CodeRank
Experience pair programming with AI  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);
 
	} 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:deleteData, getNodeValue
  } 
 
  public static void deleteData(CharacterData node, int index)
    throws DOMException 
  { 
    int len = node.getNodeValue().length();
 
    node.deleteData(index, len - index);
  } 
} 
5
CodeRank
Experience pair programming with AI  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 );
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:substringData
        return section.getData();
    } 
 
    @Override 
    public String substringData(int offset, int count) throws DOMException {
        return section.substringData(offset,count);
    } 
 
    @Override 
    public void replaceData(int offset, int count, String arg)
            throws DOMException {
        section.replaceData(offset,count,arg);
    } 
 
    @Override 
    public void insertData(int offset, String arg) throws DOMException {
        section.insertData(offset,arg);
    } 
 
    @Override 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getData
        text.deleteData(offset,count);
    } 
 
    @Override 
    public String getData() throws DOMException {
        return text.getData();
    } 
 
    @Override 
    public String substringData(int offset, int count) throws DOMException {
        return text.substringData(offset,count);
    } 
 
    @Override 
    public void replaceData(int offset, int count, String arg)
            throws DOMException {
        text.replaceData(offset,count,arg);
    } 
 
    @Override 
5
CodeRank
Experience pair programming with AI  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 );
    } 
 
    public void updateStylesheet() 
    { 
        stylesheetElement.setTextContent( buildStylesheet( stylesheet ) );
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getData
 
    private class FibonacciNodeTester extends AbstractNodeTester { 
        private int nextVal = 1, lastVal = 1, priorVal = 0;
 
        public void testText(Text text) throws NodeTestException {
            int val = Integer.parseInt(text.getData());
            if (nextVal != val) {
                throw new NodeTestException("Incorrect value", text);
            } 
            nextVal = val + lastVal;
            priorVal = lastVal;
            lastVal = val;
        } 
 
        public void testElement(Element element) throws NodeTestException {
            String name = element.getLocalName();
            if ("fibonacci".equals(name) || "val".equals(name)) {
                return; 
            } 
            throw new NodeTestException("Unexpected element", element);
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getData
     * @param node 
     * @param mTreeNode 
     * @throws SAXException 
     */ 
    private void initCDATASectionNode(CDATASection node, DefaultMutableTreeNode mTreeNode) throws SAXException {
        String data = node.getData();
        if (data != null && data.length() > 0) {
            String value = "<!-[CDATA" + node.getData() + "]]>"; // $NON-NLS-1$ $NON-NLS-2$
            XMLDefaultMutableTreeNode commentNode = new XMLDefaultMutableTreeNode(value, node);
            mTreeNode.add(commentNode);
        } 
    } 
 
    /** 
     * init the TextNode 
     * 
     * @param node 
     * @param mTreeNode 
     * @throws SAXException 
     */ 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:appendData
  public void characters(char[] ch, int start, int length) {
    Node current = eltStack.peek();
    if (current.getChildNodes().getLength() == 1
        && current.getChildNodes().item(0).getNodeType() == Node.TEXT_NODE) {
      Text text = (Text) current.getChildNodes().item(0);
      text.appendData(new String(ch, start, length));
    } else { 
      Text text = document.createTextNode(new String(ch, start, length));
      eltStack.peek().appendChild(text);
    } 
  } 
 
  @Override 
  public void endElement(String uri, String localName, String qName) {
    Node elt = eltStack.pop();
    assert elt.getLocalName().equals(localName);
  } 
 
  @Override 
  public void error(SAXParseException exception) {
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Java 8 CharacterData Questions & Answers:

See Code Examples for Java 8 CharacterData Methods: