@Override public void text(final Text text) { String nodeValue = text.getTextValue(); try { appendable.append(nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }
@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()); }
@Override public void text(final Text text) { String nodeValue = text.getTextValue(); try { appendable.append(nodeValue); } catch (IOException ioex) { throw new LagartoDOMException(ioex); } }