<?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 "dom2.dtd">
<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-2" name="nodenormalize01">
<metadata>
<title>nodenormalize01</title>
<creator>IBM</creator>
<description>
	The method "normalize" puts all Text nodes in the full depth of the sub-tree underneath 
	this Node, including attribute nodes, into a "normal" form where only structure 
	(e.g., elements, comments, processing instructions, CDATA sections, and entity references) 
	separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. 
	
	Create a dom tree consisting of elements, comments, processing instructions, CDATA sections, 
	and entity references nodes seperated by text nodes.  Check the length of the node list of each
	before and after normalize has been called.  
</description>
<contributor>Neil Delima</contributor>
<date qualifier="created">2002-04-24</date>
<subject resource="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize"/>
</metadata>
<var name="doc" type="Document"/>
<var name="newDoc" type="Document"/>
<var name="domImpl" type="DOMImplementation"/>
<var name="docType" type="DocumentType"/>
<var name="docTypeNull" type="DocumentType" isNull="true"/>
<var name="documentElement" type="Element"/>
<var name="element1" type="Element"/>
<var name="element2" type="Element"/>
<var name="element3" type="Element"/>
<var name="element4" type="Element"/>
<var name="element5" type="Element"/>
<var name="element6" type="Element"/>
<var name="element7" type="Element"/>
<var name="text1" type="Text"/>
<var name="text2" type="Text"/>
<var name="text3" type="Text"/>
<var name="pi" type="ProcessingInstruction"/>
<var name="cData" type="CDATASection"/>
<var name="comment" type="Comment"/>
<var name="entRef" type="EntityReference"/>
<var name="elementList" type="NodeList"/>
<var name="appendedChild" type="Node"/>
<load var="doc" href="staffNS" willBeModified="true"/>
<implementation var="domImpl" obj="doc"/>
<createDocument var="newDoc" obj="domImpl" namespaceURI='"http://www.w3.org/DOM/Test"' qualifiedName='"dom:root"' doctype="docTypeNull"/>
<createElement var="element1" obj="newDoc" tagName='"element1"'/>
<createElement var="element2" obj="newDoc" tagName='"element2"'/>
<createElement var="element3" obj="newDoc" tagName='"element3"'/>
<createElement var="element4" obj="newDoc" tagName='"element4"'/>
<createElement var="element5" obj="newDoc" tagName='"element5"'/>
<createElement var="element6" obj="newDoc" tagName='"element6"'/>
<createElement var="element7" obj="newDoc" tagName='"element7"'/>
<createTextNode var="text1" obj="newDoc" data='"text1"'/>
<createTextNode var="text2" obj="newDoc" data='"text2"'/>
<createTextNode var="text3" obj="newDoc" data='"text3"'/>
<createCDATASection var="cData" obj="newDoc" data='"Cdata"'/>
<createComment var="comment" obj="newDoc" data='"comment"'/>
<createProcessingInstruction var="pi" obj="newDoc" target='"PITarget"' data='"PIData"'/>
<createEntityReference var="entRef" obj="newDoc" name='"EntRef"'/>
<assertNotNull actual="entRef" id="createdEntRefNotNull"/>
<documentElement var="documentElement" obj="newDoc"/>
<appendChild var="appendedChild" obj="documentElement" newChild="element1"/>

<appendChild var="appendedChild" obj="element2" newChild="text1"/>
<appendChild var="appendedChild" obj="element2" newChild="text2"/>
<appendChild var="appendedChild" obj="element2" newChild="text3"/>
<appendChild var="appendedChild" obj="element1" newChild="element2"/>

<cloneNode var="text1" obj="text1" deep="false"/>
<cloneNode var="text2" obj="text2" deep="false"/>
<appendChild var="appendedChild" obj="element3" newChild="entRef"/>
<appendChild var="appendedChild" obj="element3" newChild="text1"/>
<appendChild var="appendedChild" obj="element3" newChild="text2"/>
<appendChild var="appendedChild" obj="element1" newChild="element3"/>

<cloneNode var="text1" obj="text1" deep="false"/>
<cloneNode var="text2" obj="text2" deep="false"/>
<appendChild var="appendedChild" obj="element4" newChild="cData"/>
<appendChild var="appendedChild" obj="element4" newChild="text1"/>
<appendChild var="appendedChild" obj="element4" newChild="text2"/>
<appendChild var="appendedChild" obj="element1" newChild="element4"/>

<cloneNode var="text2" obj="text2" deep="false"/>
<cloneNode var="text3" obj="text3" deep="false"/>
<appendChild var="appendedChild" obj="element5" newChild="comment"/>
<appendChild var="appendedChild" obj="element5" newChild="text2"/>
<appendChild var="appendedChild" obj="element5" newChild="text3"/>
<appendChild var="appendedChild" obj="element1" newChild="element5"/>
				
<cloneNode var="text2" obj="text2" deep="false"/>
<cloneNode var="text3" obj="text3" deep="false"/>
<appendChild var="appendedChild" obj="element6" newChild="pi"/>
<appendChild var="appendedChild" obj="element6" newChild="text2"/>
<appendChild var="appendedChild" obj="element6" newChild="text3"/>
<appendChild var="appendedChild" obj="element1" newChild="element6"/>

<cloneNode var="entRef" obj="entRef" deep="false"/>
<cloneNode var="text1" obj="text1" deep="false"/>
<cloneNode var="text2" obj="text2" deep="false"/>
<cloneNode var="text3" obj="text3" deep="false"/>
<appendChild var="appendedChild" obj="element7" newChild="entRef"/>
<appendChild var="appendedChild" obj="element7" newChild="text1"/>
<appendChild var="appendedChild" obj="element7" newChild="text2"/>
<appendChild var="appendedChild" obj="element7" newChild="text3"/>
<appendChild var="appendedChild" obj="element1" newChild="element7"/>

<childNodes var="elementList" obj="element1"/>
<assertSize  size="6" collection="elementList" id="nodeNormalize01_1Bef"/>
<childNodes var="elementList" obj="element2"/>
<assertSize  size="3" collection="elementList" id="nodeNormalize01_2Bef"/>
<childNodes var="elementList" obj="element3"/>
<assertSize  size="3" collection="elementList" id="nodeNormalize01_3Bef"/>
<childNodes var="elementList" obj="element4"/>
<assertSize  size="3" collection="elementList" id="nodeNormalize01_4Bef"/>
<childNodes var="elementList" obj="element5"/>
<assertSize  size="3" collection="elementList" id="nodeNormalize01_5Bef"/>
<childNodes var="elementList" obj="element6"/>
<assertSize  size="3" collection="elementList" id="nodeNormalize01_6Bef"/>
<childNodes var="elementList" obj="element7"/>
<assertSize  size="4" collection="elementList" id="nodeNormalize01_7Bef"/>
<normalize obj="newDoc"/>
<childNodes var="elementList" obj="element1"/>
<assertSize  size="6" collection="elementList" id="nodeNormalize01_1Aft"/>
<childNodes var="elementList" obj="element2"/>
<assertSize  size="1" collection="elementList" id="nodeNormalize01_2Aft"/>
<childNodes var="elementList" obj="element3"/>
<assertSize  size="2" collection="elementList" id="nodeNormalize01_3Aft"/>
<childNodes var="elementList" obj="element4"/>
<assertSize  size="2" collection="elementList" id="nodeNormalize01_4Aft"/>
<childNodes var="elementList" obj="element5"/>
<assertSize  size="2" collection="elementList" id="nodeNormalize01_5Aft"/>
<childNodes var="elementList" obj="element6"/>
<assertSize  size="2" collection="elementList" id="nodeNormalize01_6Aft"/>
<childNodes var="elementList" obj="element7"/>
<assertSize  size="2" collection="elementList" id="nodeNormalize01_7Aft"/>
</test>

