Subversion Repositories Kolibri OS

Rev

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

  1. <?xml version="1.0" standalone="no"?>
  2. <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
  3. <!--
  4.  Copyright (c) 2003 X-Hive Corporation
  5.  
  6.  All Rights Reserved. This work is distributed under the W3C(r)
  7.  Software License [1] in the hope that it will be useful, but WITHOUT
  8.  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9.  FITNESS FOR A PARTICULAR PURPOSE.
  10.  
  11.  [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
  12. -->
  13.  
  14.  
  15. <!DOCTYPE test SYSTEM "dom3.dtd" [
  16.   <!ENTITY % entities SYSTEM "dom3tests.ent">
  17.   %entities;
  18. ]>
  19.  
  20.  
  21. <test xmlns="&level3;" name="DOMWriterTest2">
  22.   <metadata>
  23.     <title>DOMWriterTest2</title>
  24.     &creator;
  25.     <description>Serializes a document without a XML declaration for both for 'xml-declaration' configuration values.</description>
  26.     &contributor; &date;
  27.         <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-canSetParameter"/>
  28.         <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSSerializer-config"/>
  29.   </metadata>
  30.  
  31.   <var name="configuration"   type="DOMConfiguration"/>
  32.   <var name="XML_DECLARATION" type="DOMString" value='"xml-declaration"'/>
  33.   <var name="stringDoc"       type="DOMString" value='"&lt;hello&gt;me again&lt;/hello&gt;"'/>
  34.   <var name="writeResult"     type="DOMString"/>
  35.   <var name="xmlDecl"          type="DOMString"/>
  36.  
  37.   &vars;
  38.   &init;
  39.  
  40.   <!-- parse the string -->
  41.   <stringData obj="inputSource" value="stringDoc"/>
  42.   <parse  var="document" obj="parser" input="inputSource"/>
  43.  
  44.   <!-- include xml declaration on serialization -->
  45.   <domConfig var="configuration" obj="writer" interface="LSSerializer"/>
  46.  
  47.   <setParameter obj="configuration" name="XML_DECLARATION" value="false"/>
  48.   <writeToString var="writeResult" obj="writer" nodeArg="document"/>
  49.   <assertEquals actual="writeResult" expected="stringDoc" id="without_xml_declaration" ignoreCase="false"/>
  50.  
  51.   <setParameter obj="configuration" name="XML_DECLARATION" value="true"/>
  52.   <writeToString var="writeResult" obj="writer" nodeArg="document"/>
  53.   <substring var="xmlDecl" obj="writeResult" beginIndex="0" endIndex="6"/>
  54.   <assertEquals actual="xmlDecl" expected='"&lt;?xml "' id="with_xml_declaration" ignoreCase="false"/>
  55.  
  56. </test>
  57.  
  58.  
  59.  
  60.  
  61.  
  62.