<?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="canonicalform05">
<metadata>
<title>canonicalform05</title>
<creator>Curt Arnold</creator>
<description>
Add a L1 element to a L2 namespace aware document and perform namespace normalization.  Should result
in an error.
</description>
<date qualifier="created">2004-01-19</date>
<subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument"/>
<subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algorithms#normalizeDocumentAlgo"/>
<subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form"/>
</metadata>
<implementationAttribute name="namespaceAware" value="true"/>
<var name="doc" type="Document"/>
<var name="elem" type="Element"/>
<var name="domConfig" type="DOMConfiguration"/>
<var name="pList" type="NodeList"/>
<var name="newChild" type="Element"/>
<var name="retval" type="Element"/>
<var name="errorMonitor" type="DOMErrorMonitor"/>
<var name="errors" type="List"/>
<var name="error" type="DOMError"/>
<var name="errorCount" type="int" value="0"/>
<var name="severity" type="int"/>
<var name="problemNode" type="Node"/>
<var name="location" type="DOMLocator"/>
<var name="lineNumber" type="int"/>
<var name="columnNumber" type="int"/>
<var name="byteOffset" type="int"/>
<var name="utf16Offset" type="int"/>
<var name="uri" type="DOMString"/>
<var name="type" type="DOMString"/>
<var name="message" type="DOMString"/>
<var name="relatedException" type="DOMObject"/>
<var name="relatedData" type="DOMObject"/>
<var name="length" type="int"/>
<var name="canSet" type="boolean"/>
<load var="doc" href="barfoo" willBeModified="true"/>
<getElementsByTagName var="pList" obj="doc" tagname='"p"' interface="Document"/>
<item var="elem" obj="pList" index="0" interface="NodeList"/>
<createElement var="newChild" obj="doc" tagName='"br"'/>
<appendChild var="retval" obj="elem" newChild="newChild"/>
<domConfig obj="doc" var="domConfig" interface="Document"/>
<canSetParameter var="canSet" obj="domConfig" name='"canonical-form"' value="true"/>
<if><isTrue value="canSet"/>
<setParameter obj="domConfig" name='"canonical-form"' value="true"/>
<setParameter obj="domConfig" name='"error-handler"' value="errorMonitor"/>
<normalizeDocument obj="doc"/>
<allErrors var="errors" obj="errorMonitor"/>
<for-each member="error" collection="errors">
	<severity var="severity" obj="error"/>
	<if>
		<equals actual="severity" expected="2" ignoreCase="false"/>
		<!-- location should have relatedNode, everything else should be -1 or null -->
		<location var="location" obj="error"/>
		<relatedNode var="problemNode" obj="location" interface="DOMLocator"/>
		<assertSame actual="problemNode" expected="newChild" id="relatedNodeIsL1Node"/>
		<lineNumber var="lineNumber" obj="location"/>
		<assertEquals actual="lineNumber" expected="-1" ignoreCase="false" id="lineNumber"/>
		<columnNumber var="columnNumber" obj="location"/>
		<assertEquals actual="columnNumber" expected="-1" ignoreCase="false" id="columnNumber"/>
		<byteOffset var="byteOffset" obj="location"/>
		<assertEquals actual="byteOffset" expected="-1" ignoreCase="false" id="byteOffset"/>
		<utf16Offset var="utf16Offset" obj="location"/>
		<assertEquals actual="utf16Offset" expected="-1" ignoreCase="false" id="utf16Offset"/>
		<uri var="uri" obj="location" interface="DOMLocator"/>
		<assertNull actual="uri" id="uri"/>
		<!--  message and type should be non-empty  -->
		<message var="message" obj="error"/>
		<length var="length" obj="message" interface="DOMString"/>
		<assertTrue id="messageNotEmpty">
			<greater actual="length" expected="0"/>
		</assertTrue>
		<!--  can't make any assertions about type, relatedData and relatedException
		          other than access should not raise exception   -->
		<type var="type" obj="error" interface="DOMError"/>
		<relatedData var="relatedData" obj="error"/>
		<relatedException var="relatedException" obj="error"/>
		<increment var="errorCount" value="1"/>
		<else>
			<assertEquals actual="severity" expected="1" ignoreCase="false" id="anyOthersShouldBeWarnings"/>
		</else>
	</if>
</for-each>
<assertEquals actual="errorCount" expected="1" ignoreCase="false" id="oneError"/>		
</if>
</test> 
 
