When clone is called in org.zkoss.idom.Document it fails with error "org.zkoss.idom.DOMException: Hierarchy request error: Only one root element is allowed, when adding [Element: <zk/>]." I believe the error occurs because the root element of the cloned document is not cleared before the assignment of the cloned children.
public class DocumentTest { @Test public void testCloning() throws ParserConfigurationException, SAXException, IOException { Document doc = new SAXBuilder(true, false, true).build(new StringReader("<zk><window/></zk>")); Document clone = (Document) doc.clone(); Assert.assertNotNull(clone); } }