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.  
  18. <!DOCTYPE test SYSTEM "dom3.dtd">
  19. <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="handleerror01">
  20. <metadata>
  21. <title>handleerror01</title>
  22. <creator>Curt Arnold</creator>
  23. <description>
  24. Add two CDATASection containing "]]&gt;" and call Node.normalize
  25. with an error handler that stops processing.  Only one of the
  26. CDATASections should be split.
  27. </description>
  28. <date qualifier="created">2004-02-25</date>
  29. <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize"/>
  30. <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-split-cdata-sections"/>
  31. <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ERRORS-DOMErrorHandler-handleError"/>
  32. </metadata>
  33. <implementationAttribute name="namespaceAware" value="true"/>
  34. <var name="doc" type="Document"/>
  35. <var name="elem" type="Element"/>
  36. <var name="domConfig" type="DOMConfiguration"/>
  37. <var name="elemList" type="NodeList"/>
  38. <var name="newChild" type="CDATASection"/>
  39. <var name="oldChild" type="Node"/>
  40. <var name="child" type="Node"/>
  41. <var name="childValue" type="DOMString"/>
  42. <var name="childType" type="int"/>
  43. <var name="retval" type="Node"/>
  44. <var name="errors" type="List"/>
  45.  
  46. <var name="errorHandler" type="DOMErrorHandler">
  47.    <handleError>
  48.          <!--  returning false should stop processing  -->
  49.           <return value="false"/>
  50.    </handleError>
  51. </var>
  52. <load var="doc" href="barfoo" willBeModified="true"/>
  53. <getElementsByTagName var="elemList" obj="doc" tagname='"p"' interface="Document"/>
  54. <item var="elem" obj="elemList" index="0" interface="NodeList"/>
  55. <!-- have two invalid CDATASections as the content for the p element  -->
  56. <firstChild var="oldChild" obj="elem" interface="Node"/>
  57. <createCDATASection var="newChild" obj="doc" data='"this is not ]]&gt; good"'/>
  58. <replaceChild var="retval" obj="elem" newChild="newChild" oldChild="oldChild"/>
  59. <createCDATASection var="newChild" obj="doc" data='"this is not ]]&gt; bad"'/>
  60. <appendChild var="retval" obj="elem" newChild="newChild"/>
  61. <domConfig obj="doc" var="domConfig" interface="Document"/>
  62. <setParameter obj="domConfig" name='"split-cdata-sections"' value="true"/>
  63. <setParameter obj="domConfig" name='"error-handler"' value="errorHandler"/>
  64. <!--  normalization should have been stopped after
  65.         so one of the cdata sections should be intact   -->
  66. <normalizeDocument obj="doc"/>
  67. <getElementsByTagName var="elemList" obj="doc" tagname='"p"' interface="Document"/>
  68. <item var="elem" obj="elemList" index="0" interface="NodeList"/>
  69. <lastChild var="child" obj="elem" interface="Node"/>
  70. <nodeValue var="childValue" obj="child"/>
  71. <if>
  72.    <!--  if last child matches original test  -->
  73.         <equals actual="childValue" expected='"this is not ]]&gt; bad"' ignoreCase="false"/>
  74.    <!--  check that it is a CDATASection      -->
  75.         <nodeType var="childType" obj="child"/>
  76.         <assertEquals actual="childType" expected="4" ignoreCase="false" id="lastChildCDATA"/>
  77.    <!--  check that first child is not intact  -->
  78.         <firstChild var="child" obj="elem" interface="Node"/>
  79.         <nodeValue var="childValue" obj="child"/>
  80.         <assertNotEquals actual="childValue" expected='"this is not ]]&gt; good"'
  81.                ignoreCase="false" id="firstChildNotIntact"/>
  82.         <else>
  83.             <!-- last child was split, check that first child is intact  -->
  84.                 <firstChild var="child" obj="elem" interface="Node"/>
  85.                 <nodeValue var="childValue" obj="child"/>
  86.                 <assertEquals actual="childValue" expected='"this is not ]]&gt; good"'
  87.                ignoreCase="false" id="firstChildIntact"/>
  88.         </else>
  89. </if>
  90. </test>
  91.  
  92.