### Question:
Xml implements Tree { @Override public String toString() { final StringWriter writer = new StringWriter(); try { tf.newTransformer().transform(new DOMSource(root), new StreamResult(writer)); } catch (TransformerException e) { throw new XmlException(e); } return writer.getBuffer().toString(); } Xml(CharSequence payload);  Xml(Path path);  Xml(InputStream stream);  Xml(InputSource inputSource); private  Xml(Node root); @Override Iterable<Tree> nodes(String xpath); @Override String get(String xpath); @Override boolean set(String xpath, String value); @Override String toString();  }### Answer:
@Test public void testAsString() throws IOException, SAXException { final String payload = "<ns:a xmlns:ns=\"http: "<b>text</b>" + "</ns:a>"; final Xml xml = new Xml(payload); assertXMLEqual(payload, xml.toString()); }