@Test void testEncode() { LagartoDOMBuilder lagartoDOMBuilder = new LagartoDOMBuilder(); Document document = lagartoDOMBuilder.parse("<div foo=\"q w\">a<b</div>"); Element div = (Element) document.getFirstChild(); String foo = div.getAttribute("foo"); assertEquals("q\u00A0w", foo); div.setAttribute("foo", "q\u00A0w\u00A0e"); assertEquals("<div foo=\"q w e\">a<b</div>", document.getHtml()); Text text = (Text) document.getFirstChild().getFirstChild(); assertEquals("a<b", text.getNodeValue()); assertEquals("a<b", text.getTextContent()); assertEquals("a<b", text.getTextValue()); assertTrue(document.check()); }
/** * Appends the text content to <code>Appendable</code>. */ @Override public void appendTextContent(Appendable appendable) { try { appendable.append(getTextContent()); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
public void text(Text text) { String nodeValue = text.getTextContent(); try { appendable.append(nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }