<test name='documentimportnode21' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'>
<metadata>
<title>documentimportnode21</title>
<creator>IBM</creator>
<description>
The importNode method imports a node from another document to this document.
The returned node has no parent; (parentNode is null). The source node is not
altered or removed from the original document but a new copy of the source node
is created.
Using the method importNode with deep=true, retreive the entity refs present in the
second element node whose tagName is address and import these nodes into another document.
Verify if the nodes have been imported correctly by checking the nodeNames of the
imported nodes, since they are imported into a new document which doesnot have thes defined,
the imported nodes should not have any children.
Now import the entityRef nodes into the same document and verify if the nodes have been
imported correctly by checking the nodeNames of the imported nodes, and by checking the
value of the replacement text of the imported nodes.
</description>
<contributor>Neil Delima</contributor>
<date qualifier='created'>2002-04-30</date>
<subject resource='http://www.w3.org/TR/DOM-Level-2-Core/core'/>
<subject resource='http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode'/>
</metadata>
<implementationAttribute name='namespaceAware' value='true'/>
<implementationAttribute name='expandEntityReferences' value='false'/>
<var name='doc' type='Document'/>
<var name='docTypeNull' type='DocumentType' isNull='true'/>
<var name='docImp' type='Document'/>
<var name='domImpl' type='DOMImplementation'/>
<var name='addressList' type='NodeList'/>
<var name='addressChildList' type='NodeList'/>
<var name='element' type='Element'/>
<var name='entRef2' type='EntityReference'/>
<var name='entRefImp2' type='EntityReference'/>
<var name='entRef3' type='EntityReference'/>
<var name='entRefImp3' type='EntityReference'/>
<var name='nodeName2' type='DOMString'/>
<var name='nodeName3' type='DOMString'/>
<var name='nodeNameImp2' type='DOMString'/>
<var name='nodeNameImp3' type='DOMString'/>
<var name='nodes' type='NodeList'/>
<var name='nodeImp3' type='Node'/>
<var name='nodeImp2' type='Node'/>
<var name='nodeValueImp2' type='DOMString'/>
<var name='nodeValueImp3' type='DOMString'/>
<load var='doc' href='staffNS' willBeModified='true'/>
<implementation var='domImpl' obj='doc'/>
<createDocument var='docImp' obj='domImpl' namespaceURI='"http://www.w3.org/DOM/Test"' qualifiedName='"a:b"' doctype='docTypeNull'/>
<getElementsByTagName var='addressList' obj='doc' tagname='"address"' interface='Document'/>
<item var='element' obj='addressList' index='1' interface='NodeList'/>
<childNodes var='addressChildList' obj='element'/>
<item var='entRef2' obj='addressChildList' index='0' interface='NodeList'/>
<item var='entRef3' obj='addressChildList' index='2' interface='NodeList'/>
<importNode var='entRefImp2' obj='docImp' importedNode='entRef2' deep='true'/>
<importNode var='entRefImp3' obj='docImp' importedNode='entRef3' deep='false'/>
<nodeName var='nodeName2' obj='entRef2'/>
<nodeName var='nodeName3' obj='entRef3'/>
<nodeName var='nodeNameImp2' obj='entRefImp2'/>
<nodeName var='nodeNameImp3' obj='entRefImp3'/>
<assertEquals expected='nodeName2' actual='nodeNameImp2' id='documentimportnode21_Ent2NodeName' ignoreCase='false'/>
<assertEquals expected='nodeName3' actual='nodeNameImp3' id='documentimportnode21_Ent3NodeName' ignoreCase='false'/>
<importNode var='entRefImp2' obj='doc' importedNode='entRef2' deep='true'/>
<importNode var='entRefImp3' obj='doc' importedNode='entRef3' deep='false'/>
<childNodes var='nodes' obj='entRefImp2' interface='Node'/>
<item var='nodeImp2' obj='nodes' index='0' interface='NodeList'/>
<nodeValue var='nodeValueImp2' obj='nodeImp2'/>
<childNodes var='nodes' obj='entRefImp3' interface='Node'/>
<item var='nodeImp3' obj='nodes' index='0' interface='NodeList'/>
<nodeValue var='nodeValueImp3' obj='nodeImp3'/>
<assertEquals actual='nodeValueImp2' expected='"1900 Dallas Road"' id='documentimportnode21_Ent2NodeValue' ignoreCase='false'/>
<assertEquals actual='nodeValueImp3' expected='"Texas"' id='documentimportnode21_Ent3Nodevalue' ignoreCase='false'/>
</test>
Copyright (c) 2001-2004 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See W3C License http://www.w3.org/Consortium/Legal/ for more details.