xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Wnuk" <tw...@earthlink.net>
Subject RE: importNode() Problem
Date Fri, 05 May 2000 16:17:55 GMT
Thank-you so much for responding so quickly.  I tried adding cloneNode() but
unfortunately it didn't correct the problem.

I'm at a loss and I really don't want to code another solution since you've
already done it.  

Any other ideas would be most appreciated.

Thanks
Tom

Tom Wnuk


>  -----Original Message-----
> From: 	Linda Derezinski [mailto:linda@interfacecontrol.com] 
> Sent:	Friday, May 05, 2000 8:19 AM
> To:	general@xml.apache.org; twnuk@earthlink.net
> Subject:	RE: importNode() Problem
> 
> The node passed to importnode cannot have a parent.  In your example, node
> is a member of document sXML1.
> Just missing the call to cloneNode().
> 
> 
> 	Node newNode = node.cloneNode (true);
>             doc2.importNode(newNode, true);
> 
> - Linda Derezinski
> 	 -----Original Message-----
> 	From: 	Tom Wnuk [mailto:twnuk@earthlink.net] 
> 	Sent:	Friday, May 05, 2000 11:00 AM
> 	To:	Apache XML General-Help
> 	Subject:	importNode() Problem
> 
> 	I'm trying to utilize importNode() as defined below.  I'm using
> xerces v1.0.3 and the it appears the importNode is not working.  
> 
> 	What am I doing wrong?
> 
> 	==================
> 	        String sXML1 = "<?xml version=\"1.0\" ?>" +
> 	                        "<TEST><ResponseType>XML</ResponseType>" +
> 	                        "<StyleSheet>login.xsl</StyleSheet>" +
> 	                        "</TEST>";
> 	                        
> 	        try
> 	        {
> 	            Document doc1 = XMLHelper.getDocument(sXML1);
> 			    Element eRoot = doc1.getDocumentElement();
> 
> 	            NodeList nlTmp =
> eRoot.getElementsByTagName("ResponseType");
> 	            Node node = nlTmp.item(0);
> 	            
> 	            Document doc2 = XMLHelper.getDocument();
> 			    Element eNewRoot  = doc2.createElement("TEST");
> 			    doc2.appendChild(eNewRoot);		
> 	            
> 	            doc2.importNode(node, true);
> 	            
> 	            String sDoc2 = XMLHelper.makeStringFromDOM(doc2);
> 	            
> 	            System.out.println("sDoc=\n" + sDoc2);
> 	        }
> 
> 	==================
> 
> 	Thanks 
> 	Tom
> 
> 	Tom Wnuk
> 	twnuk@earthlink.net
> 	twnuk@hotmail.com
> 	 << File: ATT00006.txt >> 

Mime
View raw message