<?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="DOMWriterTest1">
  <metadata>
    <title>DOMWriterTest1</title>
    &creator;
    <description>Writes an element node to a byte stream.</description>
    &contributor; &date;
        <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSOutput-byteStream"/>
    <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSSerializer-write"/>
  </metadata>
  <var name="stringDoc"    type="DOMString"/>
  <var name="writeResult"  type="boolean"/>
  <var name="elementList"  type="NodeList"/>
  <var name="firstElt3"    type="Node"/>
  <var name="output" type="LSOutput"/>
  <var name="outputStream" type="LSOutputStream"/>
  <var name="inputStream"  type="LSInputStream"  isNull="true"/>
  <var name="resourceURI"  type="DOMString"/>

  &vars;

  &init;
  <!-- write out only subtree with elt3-->
  <getResourceURI var="resourceURI" href="TEST2"/>
  <parseURI  var="document" obj="parser" uri="resourceURI"/>
  <getElementsByTagName interface="Document" obj="document" tagname="&quot;elt3&quot;" var="elementList"/>
  <item interface="NodeList" obj="elementList" var="firstElt3" index="0"/>
  <createLSOutput var="output" obj="lsImplementation"/>
  <byteStream obj="output" value="outputStream" interface="LSOutput"/>

  <write var="writeResult" obj="writer" destination="output" nodeArg="firstElt3"/>
  <assign var="inputStream" value="outputStream"/>
  <byteStream obj="inputSource" value="inputStream" interface="LSInput"/>
  <parse  var="document" obj="parser" input="inputSource"/>

  <!-- no elt2 may be found -->
  <getElementsByTagName interface="Document" obj="document" tagname="&quot;elt2&quot;" var="elementList"/>
  <assertSize collection="elementList" size="0" id="elt2Count_1"/>


</test>





