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

<test name='DOMBuilderTest4' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-3 dom3.xsd'>
<metadata>
<title>DOMBuilderTest4</title>
<creator>Jeroen van Rotterdam</creator>
<description>Uses LSParser.parseWithContext to insert a document before a node.</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-LSParser-parseWithContext'/>
</metadata>
<var name='elementList' type='NodeList'/>
<var name='stringDoc' type='DOMString'/>
<var name='firstElt1' type='Element'/>
<var name='secondElt1' type='Element'/>
<var name='thirdElt' type='Element'/>
<var name='nodeName' type='DOMString'/>
<var name='returnNode' type='Node'/>
<var name='resourceURI' 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'/>
<getResourceURI var='resourceURI' href='TEST0' contentType='text/xml'/>
<parseURI var='document' obj='builder' uri='resourceURI'/>
<getElementsByTagName interface='Document' obj='document' tagname='"elt1"' var='elementList'/>
<assertSize collection='elementList' size='2' id='count_elt1'/>
<item interface='NodeList' obj='elementList' var='secondElt1' index='1'/>
<previousSibling interface='Node' obj='secondElt1' var='firstElt1'/>
<nodeName obj='firstElt1' var='nodeName'/>
<assertEquals actual='nodeName' expected='"elt1"' id='previousSibling_before_insert_before' ignoreCase='false'/>
<getResourceURI var='resourceURI' href='TEST2' contentType='text/xml'/>
<systemId obj='inputSource' value='resourceURI' interface='LSInput'/>
<try>
<parseWithContext obj='builder' input='inputSource' contextArg='secondElt1' action='ACTION_INSERT_BEFORE' var='returnNode'/>
<catch>
<DOMException code='NOT_SUPPORTED_ERR'>
<return/>
</DOMException>
</catch>
</try>
<previousSibling interface='Node' obj='secondElt1' var='firstElt1'/>
<nodeName obj='firstElt1' var='nodeName'/>
<assertEquals actual='nodeName' expected='"elt2"' id='previousSibling_after_insert_before' ignoreCase='false'/>
</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.