@Override public void text(final Text text) { String nodeValue = text.getTextValue(); try { appendable.append(nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
@Override public void documentType(final DocumentType documentType) { try { TagWriterUtil.writeDoctype(appendable, documentType.nodeValue, documentType.publicId, documentType.systemId); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
@Override public void element(final Element element) { try { _element(element); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
/** * Appends the text content to an <code>Appendable</code> * (<code>StringBuilder</code>, <code>CharBuffer</code>...). * This way we can reuse the <code>Appendable</code> instance * during the creation of text content and have better performances. */ public void appendTextContent(final Appendable appendable) { if (nodeValue != null) { if ((nodeType == NodeType.TEXT) || (nodeType == NodeType.CDATA)) { try { appendable.append(nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } } } if (childNodes != null) { for (int i = 0, childNodesSize = childNodes.size(); i < childNodesSize; i++) { Node childNode = childNodes.get(i); childNode.appendTextContent(appendable); } } }
@Override public void comment(final Comment comment) { String nodeValue = comment.getNodeValue(); try { TagWriterUtil.writeComment(appendable, nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
@Override public void cdata(final CData cdata) { String nodeValue = cdata.getNodeValue(); try { TagWriterUtil.writeCData(appendable, nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
/** * Inserts node at given index. */ public void insertChild(final Node node, final int index) { node.detachFromParent(); node.parentNode = this; try { initChildNodes(node); childNodes.add(index, node); } catch (IndexOutOfBoundsException ignore) { throw new LagartoDOMException("Invalid node index: " + index); } reindexChildren(); }
/** * Inserts several nodes at ones. Reindex is done onl once, * after all children are added. */ public void insertChild(final Node[] nodes, int index) { for (Node node : nodes) { node.detachFromParent(); node.parentNode = this; try { initChildNodes(node); childNodes.add(index, node); index++; } catch (IndexOutOfBoundsException ignore) { throw new LagartoDOMException("Invalid node index: " + index); } } reindexChildren(); }
@Override public void xmlDeclaration(final XmlDeclaration xmlDeclaration) { try { TagWriterUtil.writeXml(appendable, xmlDeclaration.getVersion(), xmlDeclaration.getEncoding(), xmlDeclaration.getStandalone()); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
/** * Generates inner HTML. */ public String getInnerHtml() { StringBuilder sb = new StringBuilder(); try { toInnerHtml(sb); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } return sb.toString(); }
public void text(Text text) { String nodeValue = text.getTextContent(); try { appendable.append(nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
/** * Generates HTML. */ public String getHtml() { StringBuilder sb = new StringBuilder(); try { toHtml(sb); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } return sb.toString(); }
@Override public void documentType(final DocumentType documentType) { try { TagWriterUtil.writeDoctype(appendable, documentType.nodeValue, documentType.publicId, documentType.systemId); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
@Override public void text(final Text text) { String nodeValue = text.getTextValue(); try { appendable.append(nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
@Override public void element(final Element element) { try { _element(element); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
public void cdata(CData cdata) { String nodeValue = cdata.getNodeValue(); try { TagWriterUtil.writeCData(appendable, nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
@Override public void comment(final Comment comment) { String nodeValue = comment.getNodeValue(); try { TagWriterUtil.writeComment(appendable, nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
@Override public void cdata(final CData cdata) { String nodeValue = cdata.getNodeValue(); try { TagWriterUtil.writeCData(appendable, nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
@Override public void xmlDeclaration(final XmlDeclaration xmlDeclaration) { try { TagWriterUtil.writeXml(appendable, xmlDeclaration.getVersion(), xmlDeclaration.getEncoding(), xmlDeclaration.getStandalone()); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
public void xmlDeclaration(XmlDeclaration xmlDeclaration) { try { TagWriterUtil.writeXml(appendable, xmlDeclaration.getVersion(), xmlDeclaration.getEncoding(), xmlDeclaration.getStandalone()); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }