At 08:07 AM 8/6/2001 -0400, Bardman, Jody wrote:
>...
>Here is the code I used but importNode() doesn't seem to copy anything. 
>What am I doing wrong? 
>if (nodeList.getLength() == 1) 
>{ 
>     docOut.importNode(nodeList.item(0),true); 
>} 
>...
>At this point szXML only contains: 
><?xml version="1.0" encoding="UTF-8"?> 

Well, you didn't put it anywhere specific. Read
  http://www-106.ibm.com/developerworks/xml/library/x-tipmvdom.html
importNode produces a new Node "in" the output document, but then you've
got to put it somewhere; the crucial piece in their example is the end of

>             Element firstRoot = doc1.getDocumentElement();
>             // Get Node to move
>             Element secondRoot = doc2.getDocumentElement();
>             NodeList kids = secondRoot.getElementsByTagName("game");
>             Element oneToMove = (Element)kids.item(0);
>             // Add to first document
>             Node newOneToMove = doc1.importNode(oneToMove, true);
>             firstRoot.appendChild(newOneToMove);

Tom Myers

Reply via email to