W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2000

Possible fix for duplicate attribute problem in jtidy

From: THORMODSEN,ARNE D (HP-Corvallis,ex1) <arne_thormodsen@hp.com>
Date: Tue, 3 Oct 2000 14:34:54 -0400 (EDT)
Message-ID: <A744074A6250D311BCE90090278A3C4901FD62F1@CVEX05>
To: "'html-tidy@w3.org'" <html-tidy@w3.org>
For what it is worth, I'm experimenting with the following method (in the Clean
class of jtidy).  So far it seems to work, eliminating all but the first
instance of the duplicated attribute.  I'm invoking the method in Tidy.parse().

BTW, I am *not* a member of this list right now, so please send any comments on
to me directly.  I'd join, but I'm in too %$^$*# many groups right now and am
feeling overwhelmed by mail.


    /* This is a test to see how this stuff works... */

    private static void findAndRemoveDuplicateAttributes(Node n){

        while (n!=null){
            if (n.type == Node.StartTag){
                //Remove duplicate attributes, saving the first
                AttVal a=n.attributes;
                while (a!=null){
                    AttVal aCompare = a.next;
                    while (aCompare!=null){
                        if (Lexer.wstrcasecmp(a.attribute, aCompare.attribute)
== 0){
                        //Found a duplicate, remove it
                        System.out.println("Found duplicate attribute:
"+a.attribute+", in Element: "+n.element);

    public static void removeDuplicateAttributes(Node n){
        while (n != null)
            System.out.println("Experimental cleanup - removing duplicate
            n = n.next;
Received on Tuesday, 3 October 2000 14:40:50 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:48 UTC