public XhtmlNode addTag(int index, String name) { if (!(nodeType == NodeType.Element || nodeType == NodeType.Document)) throw new Error("Wrong node type. is "+nodeType.toString()); XhtmlNode node = new XhtmlNode(NodeType.Element); node.setName(name); childNodes.add(index, node); return node; }
public XhtmlNode addTag(String name) { if (!(nodeType == NodeType.Element || nodeType == NodeType.Document)) throw new Error("Wrong node type. is "+nodeType.toString()); XhtmlNode node = new XhtmlNode(NodeType.Element); node.setName(name); childNodes.add(node); return node; }
private void appendChild(Element e, XhtmlNode node) { if (node.getNodeType() == NodeType.Comment) e.appendChild(e.getOwnerDocument().createComment(node.getContent())); else if (node.getNodeType() == NodeType.DocType) throw new Error("not done yet"); else if (node.getNodeType() == NodeType.Instruction) e.appendChild(e.getOwnerDocument().createProcessingInstruction("", node.getContent())); else if (node.getNodeType() == NodeType.Text) e.appendChild(e.getOwnerDocument().createTextNode(node.getContent())); else if (node.getNodeType() == NodeType.Element) { Element child = e.getOwnerDocument().createElementNS(XHTML_NS, node.getName()); e.appendChild(child); for (XhtmlNode c : node.getChildNodes()) { appendChild(child, c); } } else throw new Error("Unknown node type: "+node.getNodeType().toString()); }
public void compose(IXMLWriter xml, XhtmlNode node, boolean noPrettyOverride) throws IOException { if (node.getNodeType() == NodeType.Comment) xml.comment(node.getContent(), pretty && !noPrettyOverride); else if (node.getNodeType() == NodeType.Element) composeElement(xml, node, noPrettyOverride); else if (node.getNodeType() == NodeType.Text) xml.text(node.getContent()); else throw new Error("Unhandled node type: "+node.getNodeType().toString()); }
throw new Error("Unhandled type "+c.getNodeType().toString());
private void writeNode(String indent, XhtmlNode node, boolean noPrettyOverride) throws IOException { if (node.getNodeType() == NodeType.Comment) writeComment(indent, node, noPrettyOverride); else if (node.getNodeType() == NodeType.DocType) writeDocType(node); else if (node.getNodeType() == NodeType.Instruction) writeInstruction(node); else if (node.getNodeType() == NodeType.Element) writeElement(indent, node, noPrettyOverride); else if (node.getNodeType() == NodeType.Document) writeDocument(indent, node); else if (node.getNodeType() == NodeType.Text) writeText(node); else if (node.getNodeType() == null) throw new IOException("Null node type"); else throw new IOException("Unknown node type: "+node.getNodeType().toString()); }
public XhtmlNode addTag(String name) { if (!(nodeType == NodeType.Element || nodeType == NodeType.Document)) throw new Error("Wrong node type. is "+nodeType.toString()); XhtmlNode node = new XhtmlNode(NodeType.Element); node.setName(name); childNodes.add(node); return node; }
public XhtmlNode addTag(int index, String name) { if (!(nodeType == NodeType.Element || nodeType == NodeType.Document)) throw new Error("Wrong node type. is "+nodeType.toString()); XhtmlNode node = new XhtmlNode(NodeType.Element); node.setName(name); childNodes.add(index, node); return node; }
private void appendChild(Element e, XhtmlNode node) { if (node.getNodeType() == NodeType.Comment) e.appendChild(e.getOwnerDocument().createComment(node.getContent())); else if (node.getNodeType() == NodeType.DocType) throw new Error("not done yet"); else if (node.getNodeType() == NodeType.Instruction) e.appendChild(e.getOwnerDocument().createProcessingInstruction("", node.getContent())); else if (node.getNodeType() == NodeType.Text) e.appendChild(e.getOwnerDocument().createTextNode(node.getContent())); else if (node.getNodeType() == NodeType.Element) { Element child = e.getOwnerDocument().createElementNS(XHTML_NS, node.getName()); e.appendChild(child); for (XhtmlNode c : node.getChildNodes()) { appendChild(child, c); } } else throw new Error("Unknown node type: "+node.getNodeType().toString()); }
public void compose(IXMLWriter xml, XhtmlNode node, boolean noPrettyOverride) throws IOException { if (node.getNodeType() == NodeType.Comment) xml.comment(node.getContent(), pretty && !noPrettyOverride); else if (node.getNodeType() == NodeType.Element) composeElement(xml, node, noPrettyOverride); else if (node.getNodeType() == NodeType.Text) xml.text(node.getContent()); else throw new Error("Unhandled node type: "+node.getNodeType().toString()); }
throw new Error("Unhandled type "+c.getNodeType().toString());
private void writeNode(String indent, XhtmlNode node, boolean noPrettyOverride) throws IOException { if (node.getNodeType() == NodeType.Comment) writeComment(indent, node, noPrettyOverride); else if (node.getNodeType() == NodeType.DocType) writeDocType(node); else if (node.getNodeType() == NodeType.Instruction) writeInstruction(node); else if (node.getNodeType() == NodeType.Element) writeElement(indent, node, noPrettyOverride); else if (node.getNodeType() == NodeType.Document) writeDocument(indent, node); else if (node.getNodeType() == NodeType.Text) writeText(node); else if (node.getNodeType() == null) throw new IOException("Null node type"); else throw new IOException("Unknown node type: "+node.getNodeType().toString()); }