@Override public void script(final Tag tag, final CharSequence body) { if (!enabled) { return; } Element node = createElementNode(tag); parentNode.addChild(node); if (body.length() != 0) { Node text = new Text(rootNode, body.toString()); node.addChild(text); } }
@Test void testDetach() { Document document = new Document(); Element html = new Element(document, "html"); document.addChild(html); Element div1 = new Element(document, "div"); html.addChild(div1); Element div2 = new Element(document, "div"); div1.addChild(div2); div1.detachFromParent(); assertEquals(0, html.getChildNodesCount()); assertNull(div1.getParentNode()); assertTrue(document.check()); }
@Test void testCssPath() { Document document = new Document(); Element html = new Element(document, "html"); document.addChild(html); Element div1 = new Element(document, "div"); div1.setAttribute("id", "one"); html.addChild(div1); Element div2 = new Element(document, "div"); div1.addChild(div2); assertEquals("html div#one div", div2.getCssPath()); assertEquals("html div#one", div1.getCssPath()); assertTrue(document.check()); }
newPerson.addChild(new Element(xml, "name", false, false, false)); newPerson.getChild(0).addChild(new Text(xml, "Just Maria"));
public void script(Tag tag, CharSequence body) { if (!enabled) { return; } Element node = createElementNode(tag); parentNode.addChild(node); if (body.length() != 0) { Node text = new Text(rootNode, body.toString()); node.addChild(text); } }
@Override public void script(final Tag tag, final CharSequence body) { if (!enabled) { return; } Element node = createElementNode(tag); parentNode.addChild(node); if (body.length() != 0) { Node text = new Text(rootNode, body.toString()); node.addChild(text); } }
public void style(Tag tag, CharSequence body) { if (!enabled) { return; } Element node = createElementNode(tag); parentNode.addChild(node); if (body.length() != 0) { Node text = new Text(body.toString()); node.addChild(text); } }
public void script(Tag tag, CharSequence body) { if (!enabled) { return; } Element node = createElementNode(tag); parentNode.addChild(node); if (body.length() != 0) { Node text = new Text(body.toString()); node.addChild(text); } }