idom.Document fails to clone

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Normal
    • None
    • Affects Version/s: 7.0.2
    • Component/s: ZK Loader
    • Environment:

      Windows XP SP3, Java 1.7

    • None

      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);
          }
      }
      

            Assignee:
            Unassigned
            Reporter:
            benji
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: