⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attributetable.java

📁 windows 代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * @(#)AttributeTable.java   1.11 2000/08/16
 *
 */

package org.w3c.tidy;

import java.util.Hashtable;
import java.util.Enumeration;

/**
 *
 * HTML attribute hash table
 *
 * (c) 1998-2000 (W3C) MIT, INRIA, Keio University
 * See Tidy.java for the copyright notice.
 * Derived from <a href="http://www.w3.org/People/Raggett/tidy">
 * HTML Tidy Release 4 Aug 2000</a>
 *
 * @author  Dave Raggett <dsr@w3.org>
 * @author  Andy Quick <ac.quick@sympatico.ca> (translation to Java)
 * @version 1.0, 1999/05/22
 * @version 1.0.1, 1999/05/29
 * @version 1.1, 1999/06/18 Java Bean
 * @version 1.2, 1999/07/10 Tidy Release 7 Jul 1999
 * @version 1.3, 1999/07/30 Tidy Release 26 Jul 1999
 * @version 1.4, 1999/09/04 DOM support
 * @version 1.5, 1999/10/23 Tidy Release 27 Sep 1999
 * @version 1.6, 1999/11/01 Tidy Release 22 Oct 1999
 * @version 1.7, 1999/12/06 Tidy Release 30 Nov 1999
 * @version 1.8, 2000/01/22 Tidy Release 13 Jan 2000
 * @version 1.9, 2000/06/03 Tidy Release 30 Apr 2000
 * @version 1.10, 2000/07/22 Tidy Release 8 Jul 2000
 * @version 1.11, 2000/08/16 Tidy Release 4 Aug 2000
 */

public class AttributeTable {

    public AttributeTable()
    {
    }

    public Attribute lookup( String name )
    {
        return (Attribute)attributeHashtable.get( name );
    }

    public Attribute install( Attribute attr )
    {
        return (Attribute)attributeHashtable.put( attr.name, attr );
    }

    /* public method for finding attribute definition by name */
    public Attribute findAttribute( AttVal attval )
    {
        Attribute np;

        if ( attval.attribute != null ) {
            np = lookup( attval.attribute );
            return np;
        }

        return null;
    }

    public boolean isUrl( String attrname )
    {
        Attribute np;

        np = lookup( attrname );
        return ( np != null && np.attrchk == AttrCheckImpl.getCheckUrl() );
    }

    public boolean isScript( String attrname )
    {
        Attribute np;

        np = lookup( attrname );
        return ( np != null && np.attrchk == AttrCheckImpl.getCheckScript() );
    }

    public boolean isLiteralAttribute( String attrname )
    {
        Attribute np;

        np = lookup( attrname );
        return ( np != null && np.literal );
    }

    /*
    Henry Zrepa reports that some folk are
    using embed with script attributes where
    newlines are signficant. These need to be
    declared and handled specially!
    */
    public void declareLiteralAttrib(String name)
    {
        Attribute attrib = lookup(name);

        if (attrib == null)
            attrib = install(new Attribute(name, Dict.VERS_PROPRIETARY, null));

        attrib.literal = true;
    }

    private Hashtable attributeHashtable = new Hashtable();

    private static AttributeTable defaultAttributeTable = null;

    private static Attribute[] attrs = {

    new Attribute( "abbr",             Dict.VERS_HTML40,            null ),
    new Attribute( "accept-charset",   Dict.VERS_HTML40,            null ),
    new Attribute( "accept",           Dict.VERS_ALL,               null ),
    new Attribute( "accesskey",        Dict.VERS_HTML40,            null ),
    new Attribute( "action",           Dict.VERS_ALL,               AttrCheckImpl.getCheckUrl() ),
    new Attribute( "add_date",         Dict.VERS_NETSCAPE,          null ),     /* A */
    new Attribute( "align",            Dict.VERS_ALL,               AttrCheckImpl.getCheckAlign() ),    /* set varies with element */
    new Attribute( "alink",            Dict.VERS_LOOSE,             null ),
    new Attribute( "alt",              Dict.VERS_ALL,               null ),
    new Attribute( "archive",          Dict.VERS_HTML40,            null ),     /* space or comma separated list */
    new Attribute( "axis",             Dict.VERS_HTML40,            null ),
    new Attribute( "background",       Dict.VERS_LOOSE,             AttrCheckImpl.getCheckUrl() ),
    new Attribute( "bgcolor",          Dict.VERS_LOOSE,             null ),
    new Attribute( "bgproperties",     Dict.VERS_PROPRIETARY,       null ),     /* BODY "fixed" fixes background */
    new Attribute( "border",           Dict.VERS_ALL,               AttrCheckImpl.getCheckBool() ),   /* like LENGTH + "border" */
    new Attribute( "bordercolor",      Dict.VERS_MICROSOFT,         null ),    /* used on TABLE */
    new Attribute( "bottommargin",     Dict.VERS_MICROSOFT,         null ),   /* used on BODY */
    new Attribute( "cellpadding",      Dict.VERS_FROM32,            null ),   /* % or pixel values */
    new Attribute( "cellspacing",      Dict.VERS_FROM32,            null ),
    new Attribute( "char",             Dict.VERS_HTML40,            null ),
    new Attribute( "charoff",          Dict.VERS_HTML40,            null ),
    new Attribute( "charset",          Dict.VERS_HTML40,            null ),
    new Attribute( "checked",          Dict.VERS_ALL,               AttrCheckImpl.getCheckBool() ),     /* i.e. "checked" or absent */
    new Attribute( "cite",             Dict.VERS_HTML40,            AttrCheckImpl.getCheckUrl() ),
    new Attribute( "class",            Dict.VERS_HTML40,            null ),
    new Attribute( "classid",          Dict.VERS_HTML40,            AttrCheckImpl.getCheckUrl() ),
    new Attribute( "clear",            Dict.VERS_LOOSE,             null ),    /* BR: left, right, all */
    new Attribute( "code",             Dict.VERS_LOOSE,             null ),     /* APPLET */
    new Attribute( "codebase",         Dict.VERS_HTML40,            AttrCheckImpl.getCheckUrl() ),      /* OBJECT */
    new Attribute( "codetype",         Dict.VERS_HTML40,            null ),     /* OBJECT */
    new Attribute( "color",            Dict.VERS_LOOSE,             null ),    /* BASEFONT, FONT */
    new Attribute( "cols",             Dict.VERS_IFRAMES,           null ),     /* TABLE & FRAMESET */
    new Attribute( "colspan",          Dict.VERS_FROM32,            null ),
    new Attribute( "compact",          Dict.VERS_ALL,               AttrCheckImpl.getCheckBool() ),     /* lists */
    new Attribute( "content",          Dict.VERS_ALL,               null ),     /* META */
    new Attribute( "coords",           Dict.VERS_FROM32,            null ),   /* AREA, A */    
    new Attribute( "data",             Dict.VERS_HTML40,            AttrCheckImpl.getCheckUrl() ),      /* OBJECT */
    new Attribute( "datafld",          Dict.VERS_MICROSOFT,         null ),     /* used on DIV, IMG */
    new Attribute( "dataformatas",    Dict.VERS_MICROSOFT,         null ),     /* used on DIV, IMG */
    new Attribute( "datapagesize",     Dict.VERS_MICROSOFT,         null ),   /* used on DIV, IMG */
    new Attribute( "datasrc",          Dict.VERS_MICROSOFT,         AttrCheckImpl.getCheckUrl() ),      /* used on TABLE */
    new Attribute( "datetime",         Dict.VERS_HTML40,            null ),     /* INS, DEL */
    new Attribute( "declare",          Dict.VERS_HTML40,            AttrCheckImpl.getCheckBool() ),     /* OBJECT */
    new Attribute( "defer",            Dict.VERS_HTML40,            AttrCheckImpl.getCheckBool() ),     /* SCRIPT */
    new Attribute( "dir",              Dict.VERS_HTML40,            null ),  /* ltr or rtl */
    new Attribute( "disabled",         Dict.VERS_HTML40,            AttrCheckImpl.getCheckBool() ),     /* form fields */
    new Attribute( "enctype",          Dict.VERS_ALL,               null ),     /* FORM */
    new Attribute( "face",             Dict.VERS_LOOSE,             null ),     /* BASEFONT, FONT */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -