View Javadoc

1   /*
2    *  Java HTML Tidy - JTidy
3    *  HTML parser and pretty printer
4    *
5    *  Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
6    *  Institute of Technology, Institut National de Recherche en
7    *  Informatique et en Automatique, Keio University). All Rights
8    *  Reserved.
9    *
10   *  Contributing Author(s):
11   *
12   *     Dave Raggett <dsr@w3.org>
13   *     Andy Quick <ac.quick@sympatico.ca> (translation to Java)
14   *     Gary L Peskin <garyp@firstech.com> (Java development)
15   *     Sami Lempinen <sami@lempinen.net> (release management)
16   *     Fabrizio Giustina <fgiust at users.sourceforge.net>
17   *
18   *  The contributing author(s) would like to thank all those who
19   *  helped with testing, bug fixes, and patience.  This wouldn't
20   *  have been possible without all of you.
21   *
22   *  COPYRIGHT NOTICE:
23   * 
24   *  This software and documentation is provided "as is," and
25   *  the copyright holders and contributing author(s) make no
26   *  representations or warranties, express or implied, including
27   *  but not limited to, warranties of merchantability or fitness
28   *  for any particular purpose or that the use of the software or
29   *  documentation will not infringe any third party patents,
30   *  copyrights, trademarks or other rights. 
31   *
32   *  The copyright holders and contributing author(s) will not be
33   *  liable for any direct, indirect, special or consequential damages
34   *  arising out of any use of the software or documentation, even if
35   *  advised of the possibility of such damage.
36   *
37   *  Permission is hereby granted to use, copy, modify, and distribute
38   *  this source code, or portions hereof, documentation and executables,
39   *  for any purpose, without fee, subject to the following restrictions:
40   *
41   *  1. The origin of this source code must not be misrepresented.
42   *  2. Altered versions must be plainly marked as such and must
43   *     not be misrepresented as being the original source.
44   *  3. This Copyright notice may not be removed or altered from any
45   *     source or altered source distribution.
46   * 
47   *  The copyright holders and contributing author(s) specifically
48   *  permit, without fee, and encourage the use of this source code
49   *  as a component for supporting the Hypertext Markup Language in
50   *  commercial products. If you use this source code in a product,
51   *  acknowledgment is not required but would be appreciated.
52   *
53   */
54  package org.w3c.tidy;
55  
56  import java.util.Hashtable;
57  import java.util.Map;
58  
59  
60  /**
61   * HTML attribute hash table.
62   * @author Dave Raggett <a href="mailto:dsr@w3.org">dsr@w3.org </a>
63   * @author Andy Quick <a href="mailto:ac.quick@sympatico.ca">ac.quick@sympatico.ca </a> (translation to Java)
64   * @author Fabrizio Giustina
65   * @version $Revision: 779 $ ($Author: fgiust $)
66   */
67  public class AttributeTable
68  {
69  
70      /**
71       * href attribute.
72       */
73      protected static Attribute attrHref;
74  
75      /**
76       * src attribute.
77       */
78      protected static Attribute attrSrc;
79  
80      /**
81       * id attribute.
82       */
83      protected static Attribute attrId;
84  
85      /**
86       * name attribute.
87       */
88      protected static Attribute attrName;
89  
90      /**
91       * summary attribute.
92       */
93      protected static Attribute attrSummary;
94  
95      /**
96       * alt attribute.
97       */
98      protected static Attribute attrAlt;
99  
100     /**
101      * logdesc attribute.
102      */
103     protected static Attribute attrLongdesc;
104 
105     /**
106      * usemap attribute.
107      */
108     protected static Attribute attrUsemap;
109 
110     /**
111      * ismap attribute.
112      */
113     protected static Attribute attrIsmap;
114 
115     /**
116      * language attribute.
117      */
118     protected static Attribute attrLanguage;
119 
120     /**
121      * type attribute.
122      */
123     protected static Attribute attrType;
124 
125     /**
126      * title attribute.
127      */
128     protected static Attribute attrTitle;
129 
130     /**
131      * xmlns attribute.
132      */
133     protected static Attribute attrXmlns;
134 
135     /**
136      * value attribute.
137      */
138     protected static Attribute attrValue;
139 
140     /**
141      * content attribute.
142      */
143     protected static Attribute attrContent;
144 
145     /**
146      * datafld attribute.
147      */
148     protected static Attribute attrDatafld;
149 
150     /**
151      * width attribute.
152      */
153     protected static Attribute attrWidth;
154 
155     /**
156      * height attribute.
157      */
158     protected static Attribute attrHeight;
159 
160     /**
161      * attribute table instance.
162      */
163     private static AttributeTable defaultAttributeTable;
164 
165     /**
166      * all the known attributes.
167      */
168     private static final Attribute[] ATTRS = {
169         new Attribute("abbr", Dict.VERS_HTML40, AttrCheckImpl.TEXT),
170         new Attribute("accept-charset", Dict.VERS_HTML40, AttrCheckImpl.CHARSET),
171         new Attribute("accept", Dict.VERS_ALL, AttrCheckImpl.TYPE),
172         new Attribute("accesskey", Dict.VERS_HTML40, AttrCheckImpl.CHARACTER),
173         new Attribute("action", Dict.VERS_ALL, AttrCheckImpl.URL),
174         new Attribute("add_date", Dict.VERS_NETSCAPE, AttrCheckImpl.TEXT), // A
175         new Attribute("align", Dict.VERS_ALL, AttrCheckImpl.ALIGN), // set varies with element
176         new Attribute("alink", Dict.VERS_LOOSE, AttrCheckImpl.COLOR),
177         new Attribute("alt", Dict.VERS_ALL, AttrCheckImpl.TEXT),
178         new Attribute("archive", Dict.VERS_HTML40, AttrCheckImpl.URLS), // space or comma separated list
179         new Attribute("axis", Dict.VERS_HTML40, AttrCheckImpl.TEXT),
180         new Attribute("background", Dict.VERS_LOOSE, AttrCheckImpl.URL),
181         new Attribute("bgcolor", Dict.VERS_LOOSE, AttrCheckImpl.COLOR),
182         new Attribute("bgproperties", Dict.VERS_PROPRIETARY, AttrCheckImpl.TEXT), // BODY "fixed" fixes background
183         new Attribute("border", Dict.VERS_ALL, AttrCheckImpl.BOOL), // like LENGTH + "border"
184         new Attribute("bordercolor", Dict.VERS_MICROSOFT, AttrCheckImpl.COLOR), // used on TABLE
185         new Attribute("bottommargin", Dict.VERS_MICROSOFT, AttrCheckImpl.NUMBER), // used on BODY
186         new Attribute("cellpadding", Dict.VERS_FROM32, AttrCheckImpl.LENGTH), // % or pixel values
187         new Attribute("cellspacing", Dict.VERS_FROM32, AttrCheckImpl.LENGTH),
188         new Attribute("char", Dict.VERS_HTML40, AttrCheckImpl.CHARACTER),
189         new Attribute("charoff", Dict.VERS_HTML40, AttrCheckImpl.LENGTH),
190         new Attribute("charset", Dict.VERS_HTML40, AttrCheckImpl.CHARSET),
191         new Attribute("checked", Dict.VERS_ALL, AttrCheckImpl.BOOL), // i.e. "checked" or absent
192         new Attribute("cite", Dict.VERS_HTML40, AttrCheckImpl.URL),
193         new Attribute("class", Dict.VERS_HTML40, AttrCheckImpl.TEXT),
194         new Attribute("classid", Dict.VERS_HTML40, AttrCheckImpl.URL),
195         new Attribute("clear", Dict.VERS_LOOSE, AttrCheckImpl.CLEAR), // BR: left, right, all
196         new Attribute("code", Dict.VERS_LOOSE, AttrCheckImpl.TEXT), // APPLET
197         new Attribute("codebase", Dict.VERS_HTML40, AttrCheckImpl.URL), // OBJECT
198         new Attribute("codetype", Dict.VERS_HTML40, AttrCheckImpl.TYPE), // OBJECT
199         new Attribute("color", Dict.VERS_LOOSE, AttrCheckImpl.COLOR), // BASEFONT, FONT
200         new Attribute("cols", Dict.VERS_IFRAME, AttrCheckImpl.COLS), // TABLE & FRAMESET
201         new Attribute("colspan", Dict.VERS_FROM32, AttrCheckImpl.NUMBER),
202         new Attribute("compact", Dict.VERS_ALL, AttrCheckImpl.BOOL), // lists
203         new Attribute("content", Dict.VERS_ALL, AttrCheckImpl.TEXT), // META
204         new Attribute("coords", Dict.VERS_FROM32, AttrCheckImpl.COORDS), // AREA, A
205         new Attribute("data", Dict.VERS_HTML40, AttrCheckImpl.URL), // OBJECT
206         new Attribute("datafld", Dict.VERS_MICROSOFT, AttrCheckImpl.TEXT), // used on DIV, IMG
207         new Attribute("dataformatas", Dict.VERS_MICROSOFT, AttrCheckImpl.TEXT), // used on DIV, IMG
208         new Attribute("datapagesize", Dict.VERS_MICROSOFT, AttrCheckImpl.NUMBER), // used on DIV, IMG
209         new Attribute("datasrc", Dict.VERS_MICROSOFT, AttrCheckImpl.URL), // used on TABLE
210         new Attribute("datetime", Dict.VERS_HTML40, AttrCheckImpl.DATE), // INS, DEL
211         new Attribute("declare", Dict.VERS_HTML40, AttrCheckImpl.BOOL), // OBJECT
212         new Attribute("defer", Dict.VERS_HTML40, AttrCheckImpl.BOOL), // SCRIPT
213         new Attribute("dir", Dict.VERS_HTML40, AttrCheckImpl.TEXTDIR), // ltr or rtl
214         new Attribute("disabled", Dict.VERS_HTML40, AttrCheckImpl.BOOL), // form fields
215         new Attribute("enctype", Dict.VERS_ALL, AttrCheckImpl.TYPE), // FORM
216         new Attribute("face", Dict.VERS_LOOSE, AttrCheckImpl.TEXT), // BASEFONT, FONT
217         new Attribute("for", Dict.VERS_HTML40, AttrCheckImpl.IDREF), // LABEL
218         new Attribute("frame", Dict.VERS_HTML40, AttrCheckImpl.TFRAME), // TABLE
219         new Attribute("frameborder", (short) (Dict.VERS_FRAMESET | Dict.VERS_IFRAME), AttrCheckImpl.FBORDER), // 0 or 1
220         new Attribute("framespacing", Dict.VERS_PROPRIETARY, AttrCheckImpl.NUMBER), // pixel value
221         new Attribute("gridx", Dict.VERS_PROPRIETARY, AttrCheckImpl.NUMBER), // TABLE Adobe golive
222         new Attribute("gridy", Dict.VERS_PROPRIETARY, AttrCheckImpl.NUMBER), // TABLE Adobe golive
223         new Attribute("headers", Dict.VERS_HTML40, AttrCheckImpl.IDREF), // table cells
224         new Attribute("height", Dict.VERS_ALL, AttrCheckImpl.LENGTH), // pixels only for TH/TD
225         new Attribute("href", Dict.VERS_ALL, AttrCheckImpl.URL), // A, AREA, LINK and BASE
226         new Attribute("hreflang", Dict.VERS_HTML40, AttrCheckImpl.LANG), // A, LINK
227         new Attribute("hspace", Dict.VERS_ALL, AttrCheckImpl.NUMBER), // APPLET, IMG, OBJECT
228         new Attribute("http-equiv", Dict.VERS_ALL, AttrCheckImpl.TEXT), // META
229         new Attribute("id", Dict.VERS_HTML40, AttrCheckImpl.ID),
230         new Attribute("ismap", Dict.VERS_ALL, AttrCheckImpl.BOOL), // IMG
231         new Attribute("label", Dict.VERS_HTML40, AttrCheckImpl.TEXT), // OPT, OPTGROUP
232         new Attribute("lang", Dict.VERS_HTML40, AttrCheckImpl.LANG),
233         new Attribute("language", Dict.VERS_LOOSE, AttrCheckImpl.TEXT), // SCRIPT
234         new Attribute("last_modified", Dict.VERS_NETSCAPE, AttrCheckImpl.TEXT), // A
235         new Attribute("last_visit", Dict.VERS_NETSCAPE, AttrCheckImpl.TEXT), // A
236         new Attribute("leftmargin", Dict.VERS_MICROSOFT, AttrCheckImpl.NUMBER), // used on BODY
237         new Attribute("link", Dict.VERS_LOOSE, AttrCheckImpl.COLOR), // BODY
238         new Attribute("longdesc", Dict.VERS_HTML40, AttrCheckImpl.URL), // IMG
239         new Attribute("lowsrc", Dict.VERS_PROPRIETARY, AttrCheckImpl.URL), // IMG
240         new Attribute("marginheight", Dict.VERS_IFRAME, AttrCheckImpl.NUMBER), // FRAME, IFRAME, BODY
241         new Attribute("marginwidth", Dict.VERS_IFRAME, AttrCheckImpl.NUMBER), // ditto
242         new Attribute("maxlength", Dict.VERS_ALL, AttrCheckImpl.NUMBER), // INPUT
243         new Attribute("media", Dict.VERS_HTML40, AttrCheckImpl.MEDIA), // STYLE, LINK
244         new Attribute("method", Dict.VERS_ALL, AttrCheckImpl.FSUBMIT), // FORM: get or post
245         new Attribute("multiple", Dict.VERS_ALL, AttrCheckImpl.BOOL), // SELECT
246         new Attribute("name", Dict.VERS_ALL, AttrCheckImpl.NAME),
247         new Attribute("nohref", Dict.VERS_FROM32, AttrCheckImpl.BOOL), // AREA
248         new Attribute("noresize", Dict.VERS_FRAMESET, AttrCheckImpl.BOOL), // FRAME
249         new Attribute("noshade", Dict.VERS_LOOSE, AttrCheckImpl.BOOL), // HR
250         new Attribute("nowrap", Dict.VERS_LOOSE, AttrCheckImpl.BOOL), // table cells
251         new Attribute("object", Dict.VERS_HTML40_LOOSE, AttrCheckImpl.TEXT), // APPLET
252         new Attribute("onblur", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
253         new Attribute("onchange", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
254         new Attribute("onclick", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
255         new Attribute("ondblclick", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
256         new Attribute("onkeydown", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
257         new Attribute("onkeypress", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
258         new Attribute("onkeyup", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
259         new Attribute("onload", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
260         new Attribute("onmousedown", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
261         new Attribute("onmousemove", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
262         new Attribute("onmouseout", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
263         new Attribute("onmouseover", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
264         new Attribute("onmouseup", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
265         new Attribute("onsubmit", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
266         new Attribute("onreset", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
267         new Attribute("onselect", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
268         new Attribute("onunload", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
269         new Attribute("onfocus", Dict.VERS_EVENTS, AttrCheckImpl.SCRIPT), // event
270         new Attribute("onafterupdate", Dict.VERS_MICROSOFT, AttrCheckImpl.SCRIPT), // form fields
271         new Attribute("onbeforeupdate", Dict.VERS_MICROSOFT, AttrCheckImpl.SCRIPT), // form fields
272         new Attribute("onerrorupdate", Dict.VERS_MICROSOFT, AttrCheckImpl.SCRIPT), // form fields
273         new Attribute("onrowenter", Dict.VERS_MICROSOFT, AttrCheckImpl.SCRIPT), // form fields
274         new Attribute("onrowexit", Dict.VERS_MICROSOFT, AttrCheckImpl.SCRIPT), // form fields
275         new Attribute("onbeforeunload", Dict.VERS_MICROSOFT, AttrCheckImpl.SCRIPT), // form fields
276         new Attribute("ondatasetchanged", Dict.VERS_MICROSOFT, AttrCheckImpl.SCRIPT), // object, applet
277         new Attribute("ondataavailable", Dict.VERS_MICROSOFT, AttrCheckImpl.SCRIPT), // object, applet
278         new Attribute("ondatasetcomplete", Dict.VERS_MICROSOFT, AttrCheckImpl.SCRIPT), // object, applet
279         new Attribute("profile", Dict.VERS_HTML40, AttrCheckImpl.URL), // HEAD
280         new Attribute("prompt", Dict.VERS_LOOSE, AttrCheckImpl.TEXT), // ISINDEX
281         new Attribute("readonly", Dict.VERS_HTML40, AttrCheckImpl.BOOL), // form fields
282         new Attribute("rel", Dict.VERS_ALL, AttrCheckImpl.LINKTYPES), // A, LINK
283         new Attribute("rev", Dict.VERS_ALL, AttrCheckImpl.LINKTYPES), // A, LINK
284         new Attribute("rightmargin", Dict.VERS_MICROSOFT, AttrCheckImpl.NUMBER), // used on BODY
285         new Attribute("rows", Dict.VERS_ALL, AttrCheckImpl.NUMBER), // TEXTAREA
286         new Attribute("rowspan", Dict.VERS_ALL, AttrCheckImpl.NUMBER), // table cells
287         new Attribute("rules", Dict.VERS_HTML40, AttrCheckImpl.TRULES), // TABLE
288         new Attribute("scheme", Dict.VERS_HTML40, AttrCheckImpl.TEXT), // META
289         new Attribute("scope", Dict.VERS_HTML40, AttrCheckImpl.SCOPE), // table cells
290         new Attribute("scrolling", Dict.VERS_IFRAME, AttrCheckImpl.SCROLL), // yes, no or auto
291         new Attribute("selected", Dict.VERS_ALL, AttrCheckImpl.BOOL), // OPTION
292         new Attribute("shape", Dict.VERS_FROM32, AttrCheckImpl.SHAPE), // AREA, A
293         new Attribute("showgrid", Dict.VERS_PROPRIETARY, AttrCheckImpl.BOOL), // TABLE Adobe golive
294         new Attribute("showgridx", Dict.VERS_PROPRIETARY, AttrCheckImpl.BOOL), // TABLE Adobe golive
295         new Attribute("showgridy", Dict.VERS_PROPRIETARY, AttrCheckImpl.BOOL), // TABLE Adobe golive
296         new Attribute("size", Dict.VERS_LOOSE, AttrCheckImpl.NUMBER), // HR, FONT, BASEFONT, SELECT
297         new Attribute("span", Dict.VERS_HTML40, AttrCheckImpl.NUMBER), // COL, COLGROUP
298         new Attribute("src", Dict.VERS_ALL, AttrCheckImpl.URL), // IMG, FRAME, IFRAME
299         new Attribute("standby", Dict.VERS_HTML40, AttrCheckImpl.TEXT), // OBJECT
300         new Attribute("start", Dict.VERS_ALL, AttrCheckImpl.NUMBER), // OL
301         new Attribute("style", Dict.VERS_HTML40, AttrCheckImpl.TEXT),
302         new Attribute("summary", Dict.VERS_HTML40, AttrCheckImpl.TEXT), // TABLE
303         new Attribute("tabindex", Dict.VERS_HTML40, AttrCheckImpl.NUMBER), // fields, OBJECT and A
304         new Attribute("target", Dict.VERS_HTML40, AttrCheckImpl.TARGET), // names a frame/window
305         new Attribute("text", Dict.VERS_LOOSE, AttrCheckImpl.COLOR), // BODY
306         new Attribute("title", Dict.VERS_HTML40, AttrCheckImpl.TEXT), // text tool tip
307         new Attribute("topmargin", Dict.VERS_MICROSOFT, AttrCheckImpl.NUMBER), // used on BODY
308         new Attribute("type", Dict.VERS_FROM32, AttrCheckImpl.TYPE), // also used by SPACER
309         new Attribute("usemap", Dict.VERS_ALL, AttrCheckImpl.BOOL), // things with images
310         new Attribute("valign", Dict.VERS_FROM32, AttrCheckImpl.VALIGN),
311         new Attribute("value", Dict.VERS_ALL, AttrCheckImpl.TEXT), // OPTION, PARAM
312         new Attribute("valuetype", Dict.VERS_HTML40, AttrCheckImpl.VTYPE), // PARAM: data, ref, object
313         new Attribute("version", Dict.VERS_ALL, AttrCheckImpl.TEXT), // HTML
314         new Attribute("vlink", Dict.VERS_LOOSE, AttrCheckImpl.COLOR), // BODY
315         new Attribute("vspace", Dict.VERS_LOOSE, AttrCheckImpl.NUMBER), // IMG, OBJECT, APPLET
316         new Attribute("width", Dict.VERS_ALL, AttrCheckImpl.LENGTH), // pixels only for TD/TH
317         new Attribute("wrap", Dict.VERS_NETSCAPE, AttrCheckImpl.TEXT), // textarea
318         new Attribute("xml:lang", Dict.VERS_XML, AttrCheckImpl.TEXT), // XML language
319         new Attribute("xml:space", Dict.VERS_XML, AttrCheckImpl.TEXT), // XML language
320         new Attribute("xmlns", Dict.VERS_ALL, AttrCheckImpl.TEXT), // name space
321         new Attribute("rbspan", Dict.VERS_XHTML11, AttrCheckImpl.NUMBER), // ruby markup
322     };
323 
324     /**
325      * Map containing all the installed attributes.
326      */
327     private Map attributeHashtable = new Hashtable();
328 
329     /**
330      * lookup an installed Attribute.
331      * @param name attribute name
332      * @return Attribute or null if the attribute is not found
333      */
334     public Attribute lookup(String name)
335     {
336         return (Attribute) this.attributeHashtable.get(name);
337     }
338 
339     /**
340      * installs a new Attribute.
341      * @param attr Atribute
342      * @return installed Attribute
343      */
344     public Attribute install(Attribute attr)
345     {
346         return (Attribute) this.attributeHashtable.put(attr.getName(), attr);
347     }
348 
349     /**
350      * public method for finding attribute definition by name.
351      * @param attval AttVal instance
352      * @return Attribute with name = attval.name
353      */
354     public Attribute findAttribute(AttVal attval)
355     {
356         Attribute np;
357 
358         if (attval.attribute != null)
359         {
360             np = lookup(attval.attribute);
361             return np;
362         }
363 
364         return null;
365     }
366 
367     /**
368      * Does the given attibute contains an url?
369      * @param attrname attribute name
370      * @return <code>true</code> if the given attribute is expected to contain an URL
371      */
372     public boolean isUrl(String attrname)
373     {
374         Attribute np;
375 
376         np = lookup(attrname);
377         return (np != null && np.getAttrchk() == AttrCheckImpl.URL);
378     }
379 
380     /**
381      * Does the given attibute contains a script?
382      * @param attrname attribute name
383      * @return <code>true</code> if the given attribute is expected to contain a script
384      */
385     public boolean isScript(String attrname)
386     {
387         Attribute np;
388 
389         np = lookup(attrname);
390         return (np != null && np.getAttrchk() == AttrCheckImpl.SCRIPT);
391     }
392 
393     /**
394      * Does the given attibute contains a literal attribute?
395      * @param attrname attribute name
396      * @return <code>true</code> if the given attribute is expected to contain a literal attribute
397      */
398     public boolean isLiteralAttribute(String attrname)
399     {
400         Attribute np;
401 
402         np = lookup(attrname);
403         return (np != null && np.isLiteral());
404     }
405 
406     /**
407      * Declare a new literal attribute.
408      * @param name atribute name
409      */
410     public void declareLiteralAttrib(String name)
411     {
412         // Henry Zrepa reports that some folk are using embed with script attributes where newlines are signficant.
413         // These
414         // need to be declared and handled specially!
415         Attribute attrib = lookup(name);
416 
417         if (attrib == null)
418         {
419             attrib = install(new Attribute(name, Dict.VERS_PROPRIETARY, null));
420         }
421 
422         attrib.setLiteral(true);
423     }
424 
425     /**
426      * Returns the default attribute table instance.
427      * @return AttributeTable instance
428      */
429     public static AttributeTable getDefaultAttributeTable()
430     {
431         if (defaultAttributeTable == null)
432         {
433             defaultAttributeTable = new AttributeTable();
434             for (int i = 0; i < ATTRS.length; i++)
435             {
436                 defaultAttributeTable.install(ATTRS[i]);
437             }
438             attrHref = defaultAttributeTable.lookup("href");
439             attrSrc = defaultAttributeTable.lookup("src");
440             attrId = defaultAttributeTable.lookup("id");
441             attrName = defaultAttributeTable.lookup("name");
442             attrSummary = defaultAttributeTable.lookup("summary");
443             attrAlt = defaultAttributeTable.lookup("alt");
444             attrLongdesc = defaultAttributeTable.lookup("longdesc");
445             attrUsemap = defaultAttributeTable.lookup("usemap");
446             attrIsmap = defaultAttributeTable.lookup("ismap");
447             attrLanguage = defaultAttributeTable.lookup("language");
448             attrType = defaultAttributeTable.lookup("type");
449             attrTitle = defaultAttributeTable.lookup("title");
450             attrXmlns = defaultAttributeTable.lookup("xmlns");
451             attrValue = defaultAttributeTable.lookup("value");
452             attrContent = defaultAttributeTable.lookup("content");
453             attrDatafld = defaultAttributeTable.lookup("datafld");
454             attrWidth = defaultAttributeTable.lookup("width");
455             attrHeight = defaultAttributeTable.lookup("height");
456 
457             attrAlt.setNowrap(true);
458             attrValue.setNowrap(true);
459             attrContent.setNowrap(true);
460         }
461         return defaultAttributeTable;
462     }
463 
464 }