[Httpunit-develop] Re: include script nodes in a DOM
Brought to you by:
russgold
From: laila p. <lai...@gm...> - 2005-04-21 08:09:29
|
I have used this solutions In ScriptFilter.java I have modified the method startElement as below public void startElement( QName element, XMLAttributes attrs, Augmentations augs ) throws XNIException { if (!isSupportedScript( element, attrs )) { super.startElement( element, attrs, augs ); } else { _activeScriptBlock =3D new StringBuffer(); _scriptLanguage =3D getScriptLanguage( attrs ); String srcAttribute =3D attrs.getValue( "src" ); if (srcAttribute !=3D null) _activeScriptBlock.append( _domParser.getIncludedScript( srcAttribute ) ); =09=09=09//=3D=3D=3D> add this line =09=09=09super.startElement( element, attrs, augs ); =09=09=09//=3D=3D=3D< } } and in ParsedHTML.java I have modified the method loadElements as below private void loadElements() { if (!_updateElements) return; NodeUtils.NodeAction action =3D new NodeUtils.NodeAction() { public boolean processElement( NodeUtils.PreOrderTraversal pot, Element element ) { =09=09=09=09//=3D=3D=3D=3D> add this code =09=09=09=09if(HttpUnitOptions.isScriptingEnabled() && element.getNodeName().toLowerCase().equals("script")) { =09=09=09=09=09return false; =09=09=09=09} =09=09=09=09//=3D=3D=3D=3D< [....] =20 =20 The tests execution is correct. What do you think? =20 Thanks Laila =20 On 4/20/05, laila paganelli <lai...@gm...> wrote: > In class ScriptFilter#startElement if found a script element it > doesn't insert the script node. > Why? > It is possible insert the node into DOM? > I need to execute script and to get the entire DOM of a WebResponse. >=20 > Thanks > Laila > |