xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Wnuk" <tw...@earthlink.net>
Subject importNode() Problem
Date Fri, 05 May 2000 15:00:07 GMT
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


Mime
View raw message