public void testEscapingInAttributes() throws IOException, XmlPullParserException { String s = getAttributeEncodedString(); Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(s)); assertEquals("Check attribute value", "<foo>", dom.getChild("el").getAttribute("att")); StringWriter w = new StringWriter(); Xpp3DomWriter.write(w, dom); String newString = w.toString(); assertEquals("Compare stringified DOMs", newString, s); }
public void testEscapingInContent() throws IOException, XmlPullParserException { Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(getEncodedString())); assertEquals("Check content value", "\"text\"", dom.getChild("el").getValue()); assertEquals("Check content value", "<b>\"text\"</b>", dom.getChild("ela").getValue()); assertEquals("Check content value", "<b>\"text\"</b>", dom.getChild("elb").getValue()); StringWriter w = new StringWriter(); Xpp3DomWriter.write(w, dom); assertEquals("Compare stringified DOMs", getExpectedString(), w.toString()); }