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="DOMInputSourceTest5">
  22.   <metadata>
  23.     <title>DOMInputSourceTest5</title>
  24.     &creator;
  25.     <description>Parses a document containing an external entity and checks
  26.     that resource resolver is passed the baseURI value specified on LSInput.</description>
  27.     &contributor; &date;
  28.         <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSInput-systemId"/>
  29.         <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSInput-publicId"/>
  30.         <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSInput-baseURI"/>
  31.         <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSResourceResolver-resolveResource"/>
  32.   </metadata>
  33.  
  34.  
  35.   <var name="myentityresolver" type="LSResourceResolver">
  36.      <resolveResource>
  37.         <var name="domImplLS" type="DOMImplementationLS"/>
  38.                 <var name="input" type="LSInput"/>
  39.         <assertEquals actual="baseURI" expected='"http://www.example.com/new_base"'   ignoreCase="false" id="er_base"/>
  40.         <assertEquals actual="publicId"  expected='"-//X-Hive//native xml storage//EN"' ignoreCase="false" id="er_public"/>
  41.         <assertURIEquals actual="systemId" isAbsolute="true" name='"test5"' id="er_system"/>
  42.  
  43.         <!--  create an empty string input so we can detect
  44.                 that resource resolver was used  -->
  45.         <implementation var="domImplLS"/>
  46.         <createLSInput var="input" obj="domImplLS"/>
  47.         <stringData obj="input" value='""' interface="LSInput"/>
  48.         <return value="input"/>
  49.      </resolveResource>
  50.  
  51.   </var>
  52.  
  53.   <var name="configuration" type="DOMConfiguration"/>
  54.   <var name="resourceURI" type="DOMString"/>
  55.   <var name="nodeList" type="NodeList"/>
  56.   &vars;
  57.   &init;
  58.  
  59.   <domConfig var="configuration" obj="parser" interface="LSParser"/>
  60.  
  61.   <setParameter obj="configuration" name='"resource-resolver"' value="myentityresolver"/>
  62.   <setParameter obj="configuration" name='"entities"' value="false"/>
  63.  
  64.   <getResourceURI var="resourceURI" href="TEST4" contentType="text/xml"/>
  65.   <systemId obj="inputSource" value="resourceURI" interface="LSInput"/>
  66.   <publicId obj="inputSource" value='"-//X-Hive//native xml storage//DE"' interface="LSInput"/>
  67.   <baseURI  obj="inputSource" value='"http://www.example.com/new_base"' interface="LSInput"/>
  68.  
  69.  
  70.   <parse var="document" obj="parser" input="inputSource"/>
  71.   <!--  should parse successfully   -->
  72.   <assertNotNull actual="document" id="documentNotNull"/>
  73.  
  74.   <!--  resource resolver should have suppressed elt2 from the
  75.            external entity   -->
  76.   <getElementsByTagName var="nodeList" obj="document" tagname='"elt2"' interface="Document"/>
  77.   <assertSize size="0" collection="nodeList" id="noElt2"/>
  78.  
  79.   <!--  check that there is an elt1    -->
  80.   <getElementsByTagName var="nodeList" obj="document" tagname='"elt1"' interface="Document"/>
  81.   <assertSize size="1" collection="nodeList" id="hasElt1"/>
  82.  
  83. </test>
  84.  
  85.  
  86.  
  87.  
  88.  
  89.