xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan Sundin" <...@sundin.com>
Subject importNode
Date Thu, 27 Jan 2000 15:55:51 GMT
Hi,
I’m trying to use importNode() to copy one Document to another. My tries are
unfortunately unsuccessful. The attached code only generates an exception as
below.

Ideas, anybody?

Jan Sundin

_____________________

import java.io.*;
import org.w3c.dom.*;

public class test {

  public test() {

  }

  public static void main(String arg[]) {

    Document mainDoc = new org.apache.xerces.dom.DocumentImpl();
    Element page = mainDoc.createElement("PAGE");
    mainDoc.appendChild(page);


    Document subDoc = new org.apache.xerces.dom.DocumentImpl();
    Element cont = subDoc.createElement("CONTENT");
    subDoc.appendChild(cont);

    ((org.apache.xerces.dom.DocumentImpl)
ainDoc).importNode( subDoc,true);
  }
}
_____________________

org.apache.xerces.dom.DOMExceptionImpl: HIERARCHY_REQUEST_ERR
        at java.lang.Throwable.<init>(Compiled Code)
        at java.lang.Exception.<init>(Compiled Code)
        at java.lang.RuntimeException.<init>(Compiled Code)
        at org.w3c.dom.DOMException.<init>(Compiled Code)
        at org.apache.xerces.domx.DOMException.<init>(Compiled Code)
        at org.apache.xerces.dom.DOMExceptionImpl.<init>(Compiled Code)
        at org.apache.xerces.dom.DocumentImpl.importNode(Compiled Code)
        at test.main(Compiled Code)


Mime
View raw message