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
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

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

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

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)

View raw message