@Override public void characters(char[] ch, int start, int length) { String data = new String(ch, start, length); Node parent = getParent(); Node lastChild = parent.getLastChild(); if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) { ((Text) lastChild).appendData(data); } else { Text text = this.document.createTextNode(data); parent.appendChild(text); } }
@Override public void characters(char[] ch, int start, int length) { String data = new String(ch, start, length); Node parent = getParent(); Node lastChild = parent.getLastChild(); if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) { ((Text) lastChild).appendData(data); } else { Text text = this.document.createTextNode(data); parent.appendChild(text); } }
protected Text characters(String s) { Node parent = nodeStack.peek(); Node lastChild = parent.getLastChild(); Text text; if (isConsolidate && lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) { text = (Text) lastChild; text.appendData(s); } else { text = document.createTextNode(s); parent.appendChild(text); } return text; }
public void characters(char[] ch, int start, int length) { final Node last = (Node)_nodeStk.peek(); // No text nodes can be children of root (DOM006 exception) if (last != _document) { final String text = new String(ch, start, length); if( _lastSibling != null && _lastSibling.getNodeType() == Node.TEXT_NODE ){ ((Text)_lastSibling).appendData(text); } else if (last == _root && _nextSibling != null) { _lastSibling = last.insertBefore(_document.createTextNode(text), _nextSibling); } else { _lastSibling = last.appendChild(_document.createTextNode(text)); } } }
/** * @param token the XML pull parser token type, such as XmlPullParser.CDSECT * or XmlPullParser.ENTITY_REF. */ private void appendText(DocumentImpl document, Node parent, int token, String text) { // Ignore empty runs. if (text.isEmpty()) { return; } // Merge with any previous text node if possible. if (coalescing || token != XmlPullParser.CDSECT) { Node lastChild = parent.getLastChild(); if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) { Text textNode = (Text) lastChild; textNode.appendData(text); return; } } // Okay, we really do need a new text node parent.appendChild(token == XmlPullParser.CDSECT ? new CDATASectionImpl(document, text) : new TextImpl(document, text)); }
childNode = m_currentNode != null ? m_currentNode.getLastChild(): null; if( childNode != null && childNode.getNodeType() == Node.TEXT_NODE ){ ((Text)childNode).appendData(s);
childNode = m_currentNode != null ? m_currentNode.getLastChild(): null; if( childNode != null && childNode.getNodeType() == Node.TEXT_NODE ){ ((Text)childNode).appendData(s);
protected Text characters(String s) { Node parent = nodeStack.peek(); Node lastChild = parent.getLastChild(); Text text; if (isConsolidate && lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) { text = (Text) lastChild; text.appendData(s); } else { text = document.createTextNode(s); parent.appendChild(text); } return text; }
public void characters(char ch[], int start, int length) throws SAXException { String data = new String(ch, start, length); Node parent = getParent(); Node lastChild = parent.getLastChild(); if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) { ((Text) lastChild).appendData(data); } else { Text text = document.createTextNode(data); parent.appendChild(text); } }
public void characters( char[] ch, int start, int length) { String s = new String( ch, start, length); if ( current instanceof Text) { (( Text) current).appendData( s); } else { Text text = doc.createTextNode( s); current.appendChild( text); current = text; } }
public void write(String value) { if (parentNode.getNodeType() == Node.TEXT_NODE) ((Text) parentNode).appendData(value); else if(parentNode.getNodeType() == Node.ATTRIBUTE_NODE) parentNode.setNodeValue(value); else parentNode.appendChild(doc.createTextNode(value)); }
private void appendOrCreateTextData(String textData) { Node lastChild = _currentNode.getLastChild(); if (lastChild instanceof Text) { ((Text) lastChild).appendData(textData); } else { _currentNode.appendChild( _document.createTextNode(textData)); } }
public void characters(final char[] chars, final int offset, final int length) { String data = new String(chars, offset, length); Node parent = (_parents.size() > 0) ? (Node) _parents.peek() : _document; Node last = parent.getLastChild(); if ((last != null) && (last.getNodeType() == Node.TEXT_NODE)) { ((Text)last).appendData(data); } else { Text text = parent.getOwnerDocument().createTextNode(data); parent.appendChild(text); } }
private void appendOrCreateTextData(String textData) { Node lastChild = _currentNode.getLastChild(); if (lastChild instanceof Text) { ((Text) lastChild).appendData(textData); } else { _currentNode.appendChild( _document.createTextNode(textData)); } }
@Override public void characters(final char[] chars, final int offset, final int length) { String data = new String(chars, offset, length); Node parent = !_parents.isEmpty() ? _parents.peek() : _node; Node last = parent.getLastChild(); if ((last != null) && (last.getNodeType() == Node.TEXT_NODE)) { ((Text) last).appendData(data); } else { Text text = parent.getOwnerDocument().createTextNode(data); parent.appendChild(text); } }
/** * @param arg0 * @throws org.w3c.dom.DOMException * @see org.w3c.dom.CharacterData#appendData(java.lang.String) */ public void appendData(String arg0) { getParent().appendData(arg0); }
private void appendOrCreateTextData(String textData) { Node lastChild = _currentNode.getLastChild(); if (lastChild instanceof Text) { ((Text) lastChild).appendData(textData); } else { _currentNode.appendChild( _document.createTextNode(textData)); } }
public void characters(char ch[], int start, int length) throws SAXException { String data = new String(ch, start, length); Node parent = getParent(); Node lastChild = parent.getLastChild(); if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) { ((Text) lastChild).appendData(data); } else { Text text = document.createTextNode(data); parent.appendChild(text); } }
public void characters(char[] ch, int start, int length) throws SAXException { Node node = currentNode.getLastChild(); String s = new String(ch, start, length); if (node != null && node.getNodeType() == Node.TEXT_NODE) { ((Text) node).appendData(s); } else { Text text = getDocument().createTextNode(s); currentNode.appendChild(text); } }
public void characters(char[] ch, int start, int length) throws SAXException { Node node = currentNode.getLastChild(); String s = new String(ch, start, length); if (node != null && node.getNodeType() == Node.TEXT_NODE) { ((Text) node).appendData(s); } else { Text text = getDocument().createTextNode(s); currentNode.appendChild(text); } }