<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>

<!--

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.

-->

<!DOCTYPE test SYSTEM "dom3.dtd">
<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="nodereplacechild30">
<metadata>
<title>nodereplacechild30</title>
<creator>IBM</creator>
<description>



	Using replaceChild on an Element node attempt to replace a new Element child node with 
	new child nodes and vice versa and in each case verify the name of the replaced node.
</description>
<contributor>Neil Delima</contributor>
<date qualifier="created">2002-06-10</date>
<subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307"/>
</metadata>
<var name="doc" type="Document"/>
<var name="parent" type="Element"/>
<var name="oldChild" type="Element"/>
<var name="newElement" type="Element"/>
<var name="newText" type="Text"/>
<var name="newComment" type="Comment"/>
<var name="newPI" type="ProcessingInstruction"/>
<var name="newCdata" type="CDATASection"/>
<var name="newERef" type="EntityReference"/>
<var name="replaced" type="Node"/>
<var name="nodeName" type="DOMString"/>
<var name="appendedChild" type="Node"/>
<load var="doc" href="hc_staff" willBeModified="true"/>
<createElementNS var="parent" obj="doc" namespaceURI='"http://www.w3.org/1999/xhtml"' qualifiedName='"xhtml:html"'/>
<createElementNS var="oldChild" obj="doc" namespaceURI='"http://www.w3.org/1999/xhtml"' qualifiedName='"xhtml:head"'/>
<createElementNS var="newElement" obj="doc" namespaceURI='"http://www.w3.org/1999/xhtml"' qualifiedName='"xhtml:body"'/>
<appendChild obj="parent" var="appendedChild" newChild="oldChild"/>
<appendChild obj="parent" var="appendedChild" newChild="newElement"/>
<createTextNode var="newText" obj="doc" data='"Text"' />
<appendChild obj="parent" var="appendedChild" newChild="newText"/>
<createComment var="newComment" obj="doc" data='"Comment"' />
<appendChild obj="parent" var="appendedChild" newChild="newComment"/>
<createProcessingInstruction var="newPI" obj="doc" target='"target"' data='"data"' />
<appendChild obj="parent" var="appendedChild" newChild="newPI"/>
<createCDATASection var="newCdata" obj="doc" data='"Cdata"' />
<appendChild obj="parent" var="appendedChild" newChild="newCdata"/>
<createEntityReference var="newERef" obj="doc" name='"delta"' />
<appendChild obj="parent" var="appendedChild" newChild="newERef"/>
<replaceChild var="replaced" obj="parent" oldChild="oldChild" newChild="newElement"/>
<nodeName var="nodeName" obj="replaced" />
<assertEquals actual="nodeName" expected='"xhtml:head"' id="nodereplacechild30_1" ignoreCase="false"/>
<replaceChild var="replaced" obj="parent" oldChild="newElement" newChild="oldChild"/>
<nodeName var="nodeName" obj="replaced" />
<assertEquals actual="nodeName" expected='"xhtml:body"' id="nodereplacechild30_2" ignoreCase="false"/>
<replaceChild var="replaced" obj="parent" oldChild="oldChild" newChild="newText"/>
<nodeName var="nodeName" obj="replaced" />
<assertEquals actual="nodeName" expected='"xhtml:head"' id="nodereplacechild30_3" ignoreCase="false"/>
<replaceChild var="replaced" obj="parent" oldChild="newText" newChild="oldChild"/>
<nodeName var="nodeName" obj="replaced" />
<assertEquals actual="nodeName" expected='"#text"' id="nodereplacechild30_4" ignoreCase="false"/>
<replaceChild var="replaced" obj="parent" oldChild="oldChild" newChild="newComment"/>
<nodeName var="nodeName" obj="replaced" />
<assertEquals actual="nodeName" expected='"xhtml:head"' id="nodereplacechild30_5" ignoreCase="false"/>
<replaceChild var="replaced" obj="parent" oldChild="newComment" newChild="oldChild"/>
<nodeName var="nodeName" obj="replaced" />
<assertEquals actual="nodeName" expected='"#comment"' id="nodereplacechild30_6" ignoreCase="false"/>
<replaceChild var="replaced" obj="parent" oldChild="newPI" newChild="oldChild"/>
<nodeName var="nodeName" obj="replaced" />
<assertEquals actual="nodeName" expected='"target"' id="nodereplacechild30_7" ignoreCase="false"/>
<replaceChild var="replaced" obj="parent" oldChild="newCdata" newChild="oldChild"/>
<nodeName var="nodeName" obj="replaced" />
<assertEquals actual="nodeName" expected='"#cdata-section"' id="nodereplacechild30_8" ignoreCase="false"/>
<replaceChild var="replaced" obj="parent" oldChild="newERef" newChild="oldChild"/>
<nodeName var="nodeName" obj="replaced" />
<assertEquals actual="nodeName" expected='"delta"' id="nodereplacechild30_9" ignoreCase="false"/>
</test>
