/** * Splits this CDATA node into parts that do not contain a "]]>" sequence. * Any newly created nodes will be inserted before this node. */ public void split() { if (!needsSplitting()) { return; } Node parent = getParentNode(); String[] parts = getData().split("\\]\\]>"); parent.insertBefore(new CDATASectionImpl(document, parts[0] + "]]"), this); for (int p = 1; p < parts.length - 1; p++) { parent.insertBefore(new CDATASectionImpl(document, ">" + parts[p] + "]]"), this); } setData(">" + parts[parts.length - 1]); }
CDATASectionImpl cdata = (CDATASectionImpl) node; if (cdataSections) { if (cdata.needsSplitting()) { if (splitCdataSections) { cdata.split(); report(DOMError.SEVERITY_WARNING, "cdata-sections-splitted"); } else { break; node = cdata.replaceWithText();
public CDATASectionImpl createCDATASection(String data) { return new CDATASectionImpl(this, data); }
/** * Replaces this node with a semantically equivalent text node. This node * will be removed from the DOM tree and the new node inserted in its place. * * @return the replacement node. */ public TextImpl replaceWithText() { TextImpl replacement = new TextImpl(document, getData()); parent.insertBefore(replacement, this); parent.removeChild(this); return replacement; } }
/** * @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)); }
/** * Replaces this node with a semantically equivalent text node. This node * will be removed from the DOM tree and the new node inserted in its place. * * @return the replacement node. */ public TextImpl replaceWithText() { TextImpl replacement = new TextImpl(document, getData()); parent.insertBefore(replacement, this); parent.removeChild(this); return replacement; } }
/** * Splits this CDATA node into parts that do not contain a "]]>" sequence. * Any newly created nodes will be inserted before this node. */ public void split() { if (!needsSplitting()) { return; } Node parent = getParentNode(); String[] parts = getData().split("\\]\\]>"); parent.insertBefore(new CDATASectionImpl(document, parts[0] + "]]"), this); for (int p = 1; p < parts.length - 1; p++) { parent.insertBefore(new CDATASectionImpl(document, ">" + parts[p] + "]]"), this); } setData(">" + parts[parts.length - 1]); }
CDATASectionImpl cdata = (CDATASectionImpl) node; if (cdataSections) { if (cdata.needsSplitting()) { if (splitCdataSections) { cdata.split(); report(DOMError.SEVERITY_WARNING, "cdata-sections-splitted"); } else { break; node = cdata.replaceWithText();
public CDATASectionImpl createCDATASection(String data) { return new CDATASectionImpl(this, data); }
/** * Replaces this node with a semantically equivalent text node. This node * will be removed from the DOM tree and the new node inserted in its place. * * @return the replacement node. */ public TextImpl replaceWithText() { TextImpl replacement = new TextImpl(document, getData()); parent.insertBefore(replacement, this); parent.removeChild(this); return replacement; } }
/** * Splits this CDATA node into parts that do not contain a "]]>" sequence. * Any newly created nodes will be inserted before this node. */ public void split() { if (!needsSplitting()) { return; } Node parent = getParentNode(); String[] parts = getData().split("\\]\\]>"); parent.insertBefore(new CDATASectionImpl(document, parts[0] + "]]"), this); for (int p = 1; p < parts.length - 1; p++) { parent.insertBefore(new CDATASectionImpl(document, ">" + parts[p] + "]]"), this); } setData(">" + parts[parts.length - 1]); }
CDATASectionImpl cdata = (CDATASectionImpl) node; if (cdataSections) { if (cdata.needsSplitting()) { if (splitCdataSections) { cdata.split(); report(DOMError.SEVERITY_WARNING, "cdata-sections-splitted"); } else { break; node = cdata.replaceWithText();
public CDATASectionImpl createCDATASection(String data) { return new CDATASectionImpl(this, data); }
/** * Replaces this node with a semantically equivalent text node. This node * will be removed from the DOM tree and the new node inserted in its place. * * @return the replacement node. */ public TextImpl replaceWithText() { TextImpl replacement = new TextImpl(document, getData()); parent.insertBefore(replacement, this); parent.removeChild(this); return replacement; } }
/** * Splits this CDATA node into parts that do not contain a "]]>" sequence. * Any newly created nodes will be inserted before this node. */ public void split() { if (!needsSplitting()) { return; } Node parent = getParentNode(); String[] parts = getData().split("\\]\\]>"); parent.insertBefore(new CDATASectionImpl(document, parts[0] + "]]"), this); for (int p = 1; p < parts.length - 1; p++) { parent.insertBefore(new CDATASectionImpl(document, ">" + parts[p] + "]]"), this); } setData(">" + parts[parts.length - 1]); }
CDATASectionImpl cdata = (CDATASectionImpl) node; if (cdataSections) { if (cdata.needsSplitting()) { if (splitCdataSections) { cdata.split(); report(DOMError.SEVERITY_WARNING, "cdata-sections-splitted"); } else { break; node = cdata.replaceWithText();
public CDATASectionImpl createCDATASection(String data) { return new CDATASectionImpl(this, data); }
/** * Replaces this node with a semantically equivalent text node. This node * will be removed from the DOM tree and the new node inserted in its place. * * @return the replacement node. */ public TextImpl replaceWithText() { TextImpl replacement = new TextImpl(document, getData()); parent.insertBefore(replacement, this); parent.removeChild(this); return replacement; } }
/** * Splits this CDATA node into parts that do not contain a "]]>" sequence. * Any newly created nodes will be inserted before this node. */ public void split() { if (!needsSplitting()) { return; } Node parent = getParentNode(); String[] parts = getData().split("\\]\\]>"); parent.insertBefore(new CDATASectionImpl(document, parts[0] + "]]"), this); for (int p = 1; p < parts.length - 1; p++) { parent.insertBefore(new CDATASectionImpl(document, ">" + parts[p] + "]]"), this); } setData(">" + parts[parts.length - 1]); }
CDATASectionImpl cdata = (CDATASectionImpl) node; if (cdataSections) { if (cdata.needsSplitting()) { if (splitCdataSections) { cdata.split(); report(DOMError.SEVERITY_WARNING, "cdata-sections-splitted"); } else { break; node = cdata.replaceWithText();