- From: Austin Rosenfeld <arosenfeld@agentware.net>
- Date: Wed, 29 Nov 2000 09:15:59 -0500
- To: "'html-tidy@w3.org'" <html-tidy@w3.org>
I am trying to use the JTidy libraries to modify a DOM tree, and
am not having much success. I need to take attributes out of a node, but
the
methods in org.w3c.tidy.DOMAttrImpl to do this are all stubbed out (and
return null).
I noticed there is an extensive release history for this file, but there
appears to be
very little implementation. I checked some older versions of the archive
(I am
using version 1.11, 2000/08/16 Tidy Release 4 Aug 2000), and this
functinality appears never to have existed. Is there any
other known way to modify (or better yet remove) attributes?
Here's the code I have been using:
//some desired transformations:
//<A VLINK="xxx"> --> <A>
//<HR NOSHADE> --> <HR>
NamedNodeMap attributes = node.getAttributes();
Node toRemove = null;
toRemove = attributes.getNamedItem( mAttribute.toUpperCase() );
if ( toRemove != null )
{
toRemove.setNodeValue( "" ); //works, but I get
//'element=""', where I want absolutely nothing
attributes.removeNamedItem( mAttribute.toUpperCase() );
//has no effect at all, regardless of what case I
change mAttribute to
}
Thanks for any advice you might have.
Austin Rosenfeld
Received on Wednesday, 29 November 2000 09:16:13 UTC