Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
  2.  
  3. <!--
  4.  
  5. Copyright (c) 2001 World Wide Web Consortium,
  6. (Massachusetts Institute of Technology, Institut National de
  7. Recherche en Informatique et en Automatique, Keio University).  All
  8. Rights Reserved.  This program is distributed under the W3C's Software
  9. Intellectual Property License.  This program is distributed in the
  10. hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  11. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12. PURPOSE.  
  13.  
  14. See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  15.  
  16. -->
  17. <!DOCTYPE test SYSTEM "dom2.dtd">
  18. <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-2" name="elementsetattributenodens01">
  19.   <metadata>
  20.     <title>elementsetattributenodens01</title>
  21.     <creator>IBM</creator>
  22.     <description>
  23.       Testing Element.setAttributeNodeNS: If an attribute with that local name
  24.       and that namespace URI is already present in the element, it is replaced
  25.       by the new one.
  26.  
  27.       Create a new element and two new attribute nodes (in the same namespace
  28.       and same localNames).  
  29.       Add the two new attribute nodes to the element node using the
  30.       setAttributeNodeNS method.  Check that only one attribute is added, check
  31.       the value of this attribute.
  32.     </description>
  33.     <contributor>Neil Delima</contributor>
  34.     <date qualifier="created">2002-04-28</date>
  35.     <subject resource="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS"/>
  36.   </metadata>
  37.   <implementationAttribute name="namespaceAware" value="true"/>
  38.   <var name="doc" type="Document"/>
  39.   <var name="element" type="Element"/>
  40.   <var name="attribute1" type="Attr"/>
  41.   <var name="attribute2" type="Attr"/>
  42.   <var name="attrNode" type="Attr"/>
  43.   <var name="attrName" type="DOMString"/>
  44.   <var name="attrNS" type="DOMString"/>
  45.   <var name="attrValue" type="DOMString"/>
  46.   <var name="attributes" type="NamedNodeMap"/>
  47.   <var name="newAttribute" type="Attr"/>
  48.   <var name="length" type="int"/>
  49.   <load var="doc" href="staff" willBeModified="true"/>
  50.   <createElementNS var="element" obj="doc"
  51.                    namespaceURI='"http://www.w3.org/DOM/Test/Level2"'
  52.                    qualifiedName='"new:element"'/>
  53.   <createAttributeNS var="attribute1" obj="doc"
  54.                      namespaceURI='"http://www.w3.org/DOM/Test/att1"'
  55.                      qualifiedName='"p1:att"'/>
  56.   <createAttributeNS var="attribute2" obj="doc"
  57.                      namespaceURI='"http://www.w3.org/DOM/Test/att1"'
  58.                      qualifiedName='"p2:att"'/>
  59.  
  60.   <value obj="attribute2" value='"value2"' interface="Attr"/>
  61.  
  62.   <setAttributeNodeNS var="newAttribute" obj="element" newAttr="attribute1"/>
  63.  
  64.   <setAttributeNodeNS var="newAttribute" obj="element" newAttr="attribute2"/>
  65.   <getAttributeNodeNS var="attrNode" obj="element"
  66.                       namespaceURI='"http://www.w3.org/DOM/Test/att1"'
  67.                       localName='"att"'/>
  68.  
  69.   <nodeName var="attrName" obj="attrNode"/>
  70.   <namespaceURI var="attrNS" obj="attrNode"/>
  71.   <assertEquals actual="attrName" expected='"p2:att"' id="elementsetattributenodens01_attrName" ignoreCase="false"/>
  72.   <assertEquals actual="attrNS" expected='"http://www.w3.org/DOM/Test/att1"'
  73.                 id="elementsetattributenodens01_attrNS" ignoreCase="false"/>
  74.  
  75.   <attributes var="attributes" obj="element"/>
  76.   <length var="length" obj="attributes" interface="NamedNodeMap"/>
  77.   <assertEquals actual="length" expected="1" id="length" ignoreCase="false"/>
  78. </test>
  79.