<?xml version="1.0" standalone="no"?>
<?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
<!--
 Copyright (c) 2003 X-Hive Corporation

 All Rights Reserved. This work is distributed under the W3C(r)
 Software License [1] in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS FOR A PARTICULAR PURPOSE.

 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-->


<!DOCTYPE test SYSTEM "dom3.dtd" [
  <!ENTITY % entities SYSTEM "dom3tests.ent">
  %entities;
]>


<test xmlns="&level3;" name="DOMWriterFilterTest1">
  <metadata>
    <title>DOMWriterFilterTest1</title>
    &creator;
    <description>Uses a serializer filter to eliminate attributes, parses the output and checks if the attribute is not there.</description>
    &contributor; &date;
    <subject resource="&spec;#LS-Interfaces-LSSerializerFilter"/>
        <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSSerializer-LSSerializerFilter"/>
        <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSSerializerFilter-acceptNode"/>
        <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSSerializerFilter-whatToShow"/>
  </metadata>


  <var name="myfilter" type="LSSerializerFilter">
     &filterVars;
     <acceptNode>
        <return value="&FILTER_REJECT;"/>
     </acceptNode>

     <whatToShow>
       <get>
        <return value="&SHOW_ATTRIBUTE;"/>
       </get>
     </whatToShow>

  </var>




  <var name="configuration"   type="DOMConfiguration"/>
  <var name="stringDoc"       type="DOMString" value="&quot;&lt;elt1 attr1='attr1'&gt;first elt1&lt;/elt1&gt;&quot;"/>
  <var name="writeResult"     type="DOMString"/>
  <var name="length"          type="int"/>
  <var name="elementList"     type="NodeList"/>
  <var name="elt1"            type="Element"/>
  <var name="attrNode"           type="Attr"/>

  &vars;
  &init;

  <!-- parse the string -->
  <stringData obj="inputSource" value="stringDoc"/>
  <parse  var="document" obj="parser" input="inputSource"/>

  <!-- apply the filter -->
  <filter obj="writer" value="myfilter" interface="LSSerializer"/>

  <!-- serialize result -->
  <writeToString var="writeResult" obj="writer" nodeArg="document"/>

  <!-- parse result -->
  <stringData obj="inputSource" value="writeResult" interface="LSInput"/>
  <parse  var="document" obj="parser" input="inputSource"/>

  <!-- tests elt1 should be in the result-->
  <getElementsByTagName interface="Document" obj="document" tagname="&quot;elt1&quot;" var="elementList"/>
  <assertSize collection="elementList" size="1" id="count_elt2"/>

  <!-- attr1 of elt1 should have been suppressed  -->
  <item interface="NodeList" obj="elementList" index="0" var="elt1"/>
  <getAttributeNode obj="elt1" var="attrNode" name="&quot;attr1&quot;"/>
  <assertNull actual="attrNode" id="attrib1"/>


</test>




