## Test http://www.w3.org/2001/DOM-Test-Suite/level3/ls/DOMWriterFilterTest2

<test name='DOMWriterFilterTest2' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-3 dom3.xsd'>
<metadata>
<title>DOMWriterFilterTest2</title>
<creator>Jeroen van Rotterdam</creator>
<description>Uses a filter to strip text during serialization parsers to check expections.</description>
<contributor>X-Hive Corporation</contributor>
<date qualifier='created'>2002-03-23</date>
<subject resource='http://www.w3.org/TR/2003/CR-DOM-Level-3-LS-20031107/load-save#LS-LSSerializer-LSSerializerFilter'/>
<subject resource='http://www.w3.org/TR/2003/CR-DOM-Level-3-LS-20031107/load-save#LS-LSSerializerFilter-acceptNode'/>
<subject resource='http://www.w3.org/TR/2003/CR-DOM-Level-3-LS-20031107/load-save#LS-LSSerializerFilter-whatToShow'/>
<subject resource='http://www.w3.org/Bugs/Public/show_bug.cgi?id=643'/>
</metadata>
<var name='myfilter' type='LSSerializerFilter'>
<var name='name' type='DOMString'/>
<acceptNode>
<return value='2'/>
</acceptNode>
<whatToShow>
<get>
<return value='4'/>
</get>
</whatToShow>
</var>
<var name='stringDoc' type='DOMString' value='"<elt1 attr1='attr1'>first elt1</elt1>"'/>
<var name='writeResult' type='DOMString'/>
<var name='length' type='int'/>
<var name='elementList' type='NodeList'/>
<var name='elt1' type='Element'/>
<var name='childs' type='boolean'/>
<var name='attrNode' type='Attr'/>
<var name='attr1' type='DOMString'/>
<var name='implementation' type='DOMImplementation'/>
<var name='lsImplementation' type='DOMImplementationLS'/>
<var name='inputSource' type='LSInput'/>
<var name='document' type='Document'/>
<var name='writer' type='LSSerializer'/>
<var name='builder' type='LSParser'/>
<!-- constants -->
<var name='MODE_SYNCHRONOUS' type='short' value='1'/>
<var name='MODE_ASYNCHRONOUS' type='short' value='2'/>
<var name='DTD_SCHEMATYPE' type='DOMString' value='"http://www.w3.org/TR/REC-xml"'/>
<var name='SCHEMA_SCHEMATYPE' type='DOMString' value='"http://www.w3.org/2001/XMLSchema"'/>
<var name='NULL_SCHEMATYPE' type='DOMString' isNull='true'/>
<!-- action types DOMParser.parseWithContext -->
<var name='ACTION_REPLACE_CHILDREN' type='short' value='2'/>
<var name='ACTION_APPEND_AS_CHILDREN' type='short' value='1'/>
<var name='ACTION_INSERT_AFTER' type='short' value='4'/>
<var name='ACTION_INSERT_BEFORE' type='short' value='3'/>
<var name='ACTION_REPLACE' type='short' value='5'/>
<!-- testfiles -->
<var name='TEST0' type='DOMString' value='"test0"'/>
<var name='TEST1' type='DOMString' value='"test1"'/>
<var name='TEST2' type='DOMString' value='"test2"'/>
<var name='TEST3' type='DOMString' value='"test3"'/>
<var name='TEST4' type='DOMString' value='"test4"'/>
<var name='TEST5' type='DOMString' value='"test5"'/>
<var name='TEST6' type='DOMString' value='"test6"'/>
<var name='TEST7' type='DOMString' value='"test7"'/>
<var name='TESTPDF' type='DOMString' value='"testpdf"'/>
<implementation var='implementation'/>
<assign var='lsImplementation' value='implementation'/>
<createLSParser var='builder' obj='lsImplementation' mode='MODE_SYNCHRONOUS' schemaType='NULL_SCHEMATYPE'/>
<createLSSerializer var='writer' obj='lsImplementation'/>
<createLSInput var='inputSource' obj='lsImplementation'/>
<!-- parse the string -->
<stringData obj='inputSource' value='stringDoc'/>
<parse var='document' obj='builder' 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='builder' input='inputSource'/>
<!-- tests no child of elt1-->
<getElementsByTagName interface='Document' obj='document' tagname='"elt1"' var='elementList'/>
<item interface='NodeList' obj='elementList' index='0' var='elt1'/>
<!-- attr not effected since children of attribute nodes not passed to filter -->
<getAttributeNode var='attrNode' obj='elt1' name='"attr1"'/>
<assertNotNull actual='attrNode' id='attrExists'/>
<nodeValue var='attr1' obj='attrNode'/>
<assertEquals actual='attr1' expected='"attr1"' ignoreCase='false' id='attrUnchanged'/>
<!-- elt1 should be empty -->
<hasChildNodes obj='elt1' var='childs'/>
<assertFalse actual='childs' id='nodeHasChilds_elt1'/>
</test>

Copyright (c) 2001-2004 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed 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.

See W3C License http://www.w3.org/Consortium/Legal/ for more details.