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-2004 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="setAttributeNodeNS04">
  19. <metadata>
  20. <title>setAttributeNodeNS04</title>
  21. <creator>NIST</creator>
  22. <description>
  23.     The "setAttributeNodeNS(newAttr)" adds a new attribute.
  24.    If an attribute with that local name and that namespaceURI is already
  25.    present in the element, it is replaced by the new one.
  26.    
  27.    Retrieve the first emp:address element and add a new attribute
  28.    to the element.  Since an attribute with the same local name
  29.    and namespaceURI already exists, it is replaced by the new one and
  30.    returns the replaced "Attr" node.
  31.    This test uses the "createAttributeNS(namespaceURI,localName)
  32.    method from the Document interface to create the new attribute to add.
  33. </description>
  34. <contributor>Mary Brady</contributor>
  35. <date qualifier="created">2001-08-17</date>
  36. <subject resource="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095"/>
  37. </metadata>
  38. <!--   test requires namespace awareness   -->
  39. <implementationAttribute name="namespaceAware" value="true"/>
  40. <var name="doc" type="Document"/>
  41. <var name="elementList" type="NodeList"/>
  42. <var name="testAddr" type="Node"/>
  43. <var name="newAttr" type="Attr"/>
  44. <var name="newAddrAttr" type="Attr"/>
  45. <var name="newName" type="DOMString"/>
  46. <load var="doc" href="staffNS" willBeModified="true"/>
  47. <getElementsByTagName interface="Document" obj="doc" var="elementList" tagname='"emp:address"'/>
  48. <item interface="NodeList" obj="elementList" var="testAddr" index="0"/>
  49. <assertNotNull actual="testAddr" id="empAddrNotNull"/>
  50. <createAttributeNS obj="doc" var="newAttr" namespaceURI='"http://www.nist.gov"' qualifiedName='"xxx:domestic"'/>
  51. <setAttributeNodeNS obj="testAddr" newAttr="newAttr" var="newAddrAttr"/>
  52. <nodeName obj="newAddrAttr" var="newName"/>
  53. <assertEquals actual="newName" expected='"emp:domestic"' id="nodeName" ignoreCase="false"/>
  54. </test>
  55.