KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > text > html > HTML


1 /*
2  * @(#)HTML.java 1.41 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.swing.text.html;
8
9 import java.io.*;
10 import java.util.Hashtable JavaDoc;
11 import javax.swing.text.AttributeSet JavaDoc;
12 import javax.swing.text.StyleConstants JavaDoc;
13 import javax.swing.text.StyleContext JavaDoc;
14
15 /**
16  * Constants used in the <code>HTMLDocument</code>. These
17  * are basically tag and attribute definitions.
18  *
19  * @author Timothy Prinzing
20  * @author Sunita Mani
21  *
22  * @version 1.41 12/19/03
23  */

24 public class HTML {
25
26     /**
27      * Typesafe enumeration for an HTML tag. Although the
28      * set of HTML tags is a closed set, we have left the
29      * set open so that people can add their own tag types
30      * to their custom parser and still communicate to the
31      * reader.
32      */

33     public static class Tag {
34
35     /** @since 1.3 */
36     public Tag() {}
37
38         /**
39          * Creates a new <code>Tag</code> with the specified <code>id</code>,
40          * and with <code>causesBreak</code> and <code>isBlock</code>
41          * set to <code>false</code>.
42          *
43          * @param id the id of the new tag
44          */

45         protected Tag(String JavaDoc id) {
46         this(id, false, false);
47     }
48
49         /**
50          * Creates a new <code>Tag</code> with the specified <code>id</code>;
51          * <code>causesBreak</code> and <code>isBlock</code> are defined
52          * by the user.
53          *
54          * @param id the id of the new tag
55          * @param causesBreak <code>true</code> if this tag
56          * causes a break to the flow of data
57          * @param isBlock <code>true</code> if the tag is used
58          * to add structure to a document
59          */

60     protected Tag(String JavaDoc id, boolean causesBreak, boolean isBlock) {
61         name = id;
62         this.breakTag = causesBreak;
63         this.blockTag = isBlock;
64     }
65
66     /**
67          * Returns <code>true</code> if this tag is a block
68          * tag, which is a tag used to add structure to a
69          * document.
70      *
71          * @return <code>true</code> if this tag is a block
72          * tag, otherwise returns <code>false</code>
73      */

74     public boolean isBlock() {
75         return blockTag;
76     }
77
78     /**
79          * Returns <code>true</code> if this tag causes a
80          * line break to the flow of data, otherwise returns
81          * <code>false</code>.
82      *
83      * @return <code>true</code> if this tag causes a
84          * line break to the flow of data, otherwise returns
85          * <code>false</code>
86      */

87     public boolean breaksFlow() {
88         return breakTag;
89     }
90
91     /**
92      * Returns <code>true</code> if this tag is pre-formatted,
93          * which is true if the tag is either <code>PRE</code> or
94          * <code>TEXTAREA</code>.
95          *
96          * @return <code>true</code> if this tag is pre-formatted,
97          * otherwise returns <code>false</code>
98      */

99     public boolean isPreformatted() {
100         return (this == PRE || this == TEXTAREA);
101     }
102
103     /**
104      * Returns the string representation of the
105      * tag.
106          *
107          * @return the <code>String</code> representation of the tag
108      */

109         public String JavaDoc toString() {
110         return name;
111     }
112
113     boolean blockTag;
114     boolean breakTag;
115     String JavaDoc name;
116     boolean unknown;
117
118         // --- Tag Names -----------------------------------
119

120         public static final Tag A = new Tag("a");
121         public static final Tag ADDRESS = new Tag("address");
122         public static final Tag APPLET = new Tag("applet");
123         public static final Tag AREA = new Tag("area");
124         public static final Tag B = new Tag("b");
125         public static final Tag BASE = new Tag("base");
126         public static final Tag BASEFONT = new Tag("basefont");
127         public static final Tag BIG = new Tag("big");
128         public static final Tag BLOCKQUOTE = new Tag("blockquote", true, true);
129         public static final Tag BODY = new Tag("body", true, true);
130         public static final Tag BR = new Tag("br", true, false);
131         public static final Tag CAPTION = new Tag("caption");
132         public static final Tag CENTER = new Tag("center", true, false);
133         public static final Tag CITE = new Tag("cite");
134         public static final Tag CODE = new Tag("code");
135         public static final Tag DD = new Tag("dd", true, true);
136         public static final Tag DFN = new Tag("dfn");
137         public static final Tag DIR = new Tag("dir", true, true);
138         public static final Tag DIV = new Tag("div", true, true);
139         public static final Tag DL = new Tag("dl", true, true);
140         public static final Tag DT = new Tag("dt", true, true);
141         public static final Tag EM = new Tag("em");
142         public static final Tag FONT = new Tag("font");
143         public static final Tag FORM = new Tag("form", true, false);
144     public static final Tag FRAME = new Tag("frame");
145     public static final Tag FRAMESET = new Tag("frameset");
146         public static final Tag H1 = new Tag("h1", true, true);
147         public static final Tag H2 = new Tag("h2", true, true);
148         public static final Tag H3 = new Tag("h3", true, true);
149         public static final Tag H4 = new Tag("h4", true, true);
150         public static final Tag H5 = new Tag("h5", true, true);
151         public static final Tag H6 = new Tag("h6", true, true);
152         public static final Tag HEAD = new Tag("head", true, true);
153         public static final Tag HR = new Tag("hr", true, false);
154         public static final Tag HTML = new Tag("html", true, false);
155         public static final Tag I = new Tag("i");
156         public static final Tag IMG = new Tag("img");
157         public static final Tag INPUT = new Tag("input");
158         public static final Tag ISINDEX = new Tag("isindex", true, false);
159         public static final Tag KBD = new Tag("kbd");
160         public static final Tag LI = new Tag("li", true, true);
161         public static final Tag LINK = new Tag("link");
162         public static final Tag MAP = new Tag("map");
163         public static final Tag MENU = new Tag("menu", true, true);
164         public static final Tag META = new Tag("meta");
165     /*public*/ static final Tag NOBR = new Tag("nobr");
166     public static final Tag NOFRAMES = new Tag("noframes", true, true);
167         public static final Tag OBJECT = new Tag("object");
168         public static final Tag OL = new Tag("ol", true, true);
169         public static final Tag OPTION = new Tag("option");
170         public static final Tag P = new Tag("p", true, true);
171         public static final Tag PARAM = new Tag("param");
172         public static final Tag PRE = new Tag("pre", true, true);
173         public static final Tag SAMP = new Tag("samp");
174         public static final Tag SCRIPT = new Tag("script");
175         public static final Tag SELECT = new Tag("select");
176         public static final Tag SMALL = new Tag("small");
177         public static final Tag SPAN = new Tag("span");
178         public static final Tag STRIKE = new Tag("strike");
179         public static final Tag S = new Tag("s");
180         public static final Tag STRONG = new Tag("strong");
181         public static final Tag STYLE = new Tag("style");
182         public static final Tag SUB = new Tag("sub");
183         public static final Tag SUP = new Tag("sup");
184         public static final Tag TABLE = new Tag("table", false, true);
185         public static final Tag TD = new Tag("td", true, true);
186         public static final Tag TEXTAREA = new Tag("textarea");
187         public static final Tag TH = new Tag("th", true, true);
188         public static final Tag TITLE = new Tag("title", true, true);
189         public static final Tag TR = new Tag("tr", false, true);
190         public static final Tag TT = new Tag("tt");
191         public static final Tag U = new Tag("u");
192         public static final Tag UL = new Tag("ul", true, true);
193         public static final Tag VAR = new Tag("var");
194
195     /**
196      * All text content must be in a paragraph element.
197      * If a paragraph didn't exist when content was
198      * encountered, a paragraph is manufactured.
199      * <p>
200      * This is a tag synthesized by the HTML reader.
201      * Since elements are identified by their tag type,
202      * we create a some fake tag types to mark the elements
203      * that were manufactured.
204      */

205     public static final Tag IMPLIED = new Tag("p-implied");
206
207     /**
208      * All text content is labeled with this tag.
209      * <p>
210      * This is a tag synthesized by the HTML reader.
211      * Since elements are identified by their tag type,
212      * we create a some fake tag types to mark the elements
213      * that were manufactured.
214      */

215     public static final Tag CONTENT = new Tag("content");
216
217     /**
218      * All comments are labeled with this tag.
219      * <p>
220      * This is a tag synthesized by the HTML reader.
221      * Since elements are identified by their tag type,
222      * we create a some fake tag types to mark the elements
223      * that were manufactured.
224      */

225     public static final Tag COMMENT = new Tag("comment");
226
227     static final Tag allTags[] = {
228         A, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BIG,
229         BLOCKQUOTE, BODY, BR, CAPTION, CENTER, CITE, CODE,
230         DD, DFN, DIR, DIV, DL, DT, EM, FONT, FORM, FRAME,
231         FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HR, HTML,
232         I, IMG, INPUT, ISINDEX, KBD, LI, LINK, MAP, MENU,
233         META, NOBR, NOFRAMES, OBJECT, OL, OPTION, P, PARAM,
234         PRE, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, S,
235         STRONG, STYLE, SUB, SUP, TABLE, TD, TEXTAREA,
236         TH, TITLE, TR, TT, U, UL, VAR
237     };
238
239     static {
240         // Force HTMLs static initialize to be loaded.
241
getTag("html");
242     }
243     }
244
245     // There is no unique instance of UnknownTag, so we allow it to be
246
// Serializable.
247
public static class UnknownTag extends Tag implements Serializable {
248     
249         /**
250          * Creates a new <code>UnknownTag</code> with the specified
251          * <code>id</code>.
252          * @param id the id of the new tag
253          */

254     public UnknownTag(String JavaDoc id) {
255         super(id);
256     }
257
258         /**
259          * Returns the hash code which corresponds to the string
260          * for this tag.
261          */

262     public int hashCode() {
263         return toString().hashCode();
264     }
265
266     /**
267      * Compares this object to the specifed object.
268      * The result is <code>true</code> if and only if the argument is not
269      * <code>null</code> and is an <code>UnknownTag</code> object
270          * with the same name.
271          *
272      * @param obj the object to compare this tag with
273      * @return <code>true</code> if the objects are equal;
274      * <code>false</code> otherwise
275      */

276         public boolean equals(Object JavaDoc obj) {
277         if (obj instanceof UnknownTag) {
278         return toString().equals(obj.toString());
279         }
280         return false;
281     }
282
283     private void writeObject(java.io.ObjectOutputStream JavaDoc s)
284                  throws IOException {
285         s.defaultWriteObject();
286         s.writeBoolean(blockTag);
287         s.writeBoolean(breakTag);
288         s.writeBoolean(unknown);
289         s.writeObject(name);
290     }
291
292     private void readObject(ObjectInputStream s)
293         throws ClassNotFoundException JavaDoc, IOException {
294         s.defaultReadObject();
295         blockTag = s.readBoolean();
296         breakTag = s.readBoolean();
297         unknown = s.readBoolean();
298         name = (String JavaDoc)s.readObject();
299     }
300     }
301
302     /**
303      * Typesafe enumeration representing an HTML
304      * attribute.
305      */

306     public static final class Attribute {
307
308         /**
309          * Creates a new <code>Attribute</code> with the specified
310          * <code>id</code>.
311          *
312          * @param id the id of the new <code>Attribute</code>
313          */

314     Attribute(String JavaDoc id) {
315         name = id;
316     }
317
318         /**
319          * Returns the string representation of this attribute.
320          * @return the string representation of this attribute
321          */

322     public String JavaDoc toString() {
323         return name;
324     }
325
326     private String JavaDoc name;
327
328     public static final Attribute SIZE = new Attribute("size");
329     public static final Attribute COLOR = new Attribute("color");
330     public static final Attribute CLEAR = new Attribute("clear");
331     public static final Attribute BACKGROUND = new Attribute("background");
332     public static final Attribute BGCOLOR = new Attribute("bgcolor");
333     public static final Attribute TEXT = new Attribute("text");
334     public static final Attribute LINK = new Attribute("link");
335     public static final Attribute VLINK = new Attribute("vlink");
336     public static final Attribute ALINK = new Attribute("alink");
337     public static final Attribute WIDTH = new Attribute("width");
338     public static final Attribute HEIGHT = new Attribute("height");
339     public static final Attribute ALIGN = new Attribute("align");
340     public static final Attribute NAME = new Attribute("name");
341     public static final Attribute HREF = new Attribute("href");
342     public static final Attribute REL = new Attribute("rel");
343     public static final Attribute REV = new Attribute("rev");
344     public static final Attribute TITLE = new Attribute("title");
345     public static final Attribute TARGET = new Attribute("target");
346     public static final Attribute SHAPE = new Attribute("shape");
347     public static final Attribute COORDS = new Attribute("coords");
348     public static final Attribute ISMAP = new Attribute("ismap");
349     public static final Attribute NOHREF = new Attribute("nohref");
350     public static final Attribute ALT = new Attribute("alt");
351     public static final Attribute ID = new Attribute("id");
352     public static final Attribute SRC = new Attribute("src");
353     public static final Attribute HSPACE = new Attribute("hspace");
354     public static final Attribute VSPACE = new Attribute("vspace");
355     public static final Attribute USEMAP = new Attribute("usemap");
356     public static final Attribute LOWSRC = new Attribute("lowsrc");
357     public static final Attribute CODEBASE = new Attribute("codebase");
358     public static final Attribute CODE = new Attribute("code");
359     public static final Attribute ARCHIVE = new Attribute("archive");
360     public static final Attribute VALUE = new Attribute("value");
361     public static final Attribute VALUETYPE = new Attribute("valuetype");
362     public static final Attribute TYPE = new Attribute("type");
363     public static final Attribute CLASS = new Attribute("class");
364     public static final Attribute STYLE = new Attribute("style");
365     public static final Attribute LANG = new Attribute("lang");
366     public static final Attribute FACE = new Attribute("face");
367     public static final Attribute DIR = new Attribute("dir");
368     public static final Attribute DECLARE = new Attribute("declare");
369     public static final Attribute CLASSID = new Attribute("classid");
370     public static final Attribute DATA = new Attribute("data");
371     public static final Attribute CODETYPE = new Attribute("codetype");
372     public static final Attribute STANDBY = new Attribute("standby");
373     public static final Attribute BORDER = new Attribute("border");
374     public static final Attribute SHAPES = new Attribute("shapes");
375     public static final Attribute NOSHADE = new Attribute("noshade");
376     public static final Attribute COMPACT = new Attribute("compact");
377     public static final Attribute START = new Attribute("start");
378     public static final Attribute ACTION = new Attribute("action");
379     public static final Attribute METHOD = new Attribute("method");
380     public static final Attribute ENCTYPE = new Attribute("enctype");
381     public static final Attribute CHECKED = new Attribute("checked");
382     public static final Attribute MAXLENGTH = new Attribute("maxlength");
383     public static final Attribute MULTIPLE = new Attribute("multiple");
384     public static final Attribute SELECTED = new Attribute("selected");
385     public static final Attribute ROWS = new Attribute("rows");
386     public static final Attribute COLS = new Attribute("cols");
387     public static final Attribute DUMMY = new Attribute("dummy");
388     public static final Attribute CELLSPACING = new Attribute("cellspacing");
389     public static final Attribute CELLPADDING = new Attribute("cellpadding");
390     public static final Attribute VALIGN = new Attribute("valign");
391     public static final Attribute HALIGN = new Attribute("halign");
392     public static final Attribute NOWRAP = new Attribute("nowrap");
393     public static final Attribute ROWSPAN = new Attribute("rowspan");
394     public static final Attribute COLSPAN = new Attribute("colspan");
395     public static final Attribute PROMPT = new Attribute("prompt");
396     public static final Attribute HTTPEQUIV = new Attribute("http-equiv");
397     public static final Attribute CONTENT = new Attribute("content");
398     public static final Attribute LANGUAGE = new Attribute("language");
399     public static final Attribute VERSION = new Attribute("version");
400     public static final Attribute N = new Attribute("n");
401     public static final Attribute FRAMEBORDER = new Attribute("frameborder");
402     public static final Attribute MARGINWIDTH = new Attribute("marginwidth");
403     public static final Attribute MARGINHEIGHT = new Attribute("marginheight");
404     public static final Attribute SCROLLING = new Attribute("scrolling");
405     public static final Attribute NORESIZE = new Attribute("noresize");
406     public static final Attribute ENDTAG = new Attribute("endtag");
407     public static final Attribute COMMENT = new Attribute("comment");
408     static final Attribute MEDIA = new Attribute("media");
409
410     static final Attribute allAttributes[] = {
411         FACE,
412         COMMENT,
413         SIZE,
414         COLOR,
415         CLEAR,
416         BACKGROUND,
417         BGCOLOR,
418         TEXT,
419         LINK,
420         VLINK,
421         ALINK,
422         WIDTH,
423         HEIGHT,
424         ALIGN,
425         NAME,
426         HREF,
427             REL,
428             REV,
429             TITLE,
430             TARGET,
431             SHAPE,
432             COORDS,
433             ISMAP,
434             NOHREF,
435             ALT,
436             ID,
437             SRC,
438             HSPACE,
439             VSPACE,
440             USEMAP,
441             LOWSRC,
442             CODEBASE,
443             CODE,
444             ARCHIVE,
445             VALUE,
446             VALUETYPE,
447             TYPE,
448             CLASS,
449             STYLE,
450             LANG,
451             DIR,
452             DECLARE,
453             CLASSID,
454             DATA,
455             CODETYPE,
456             STANDBY,
457             BORDER,
458             SHAPES,
459             NOSHADE,
460             COMPACT,
461             START,
462             ACTION,
463             METHOD,
464             ENCTYPE,
465             CHECKED,
466             MAXLENGTH,
467             MULTIPLE,
468             SELECTED,
469             ROWS,
470             COLS,
471             DUMMY,
472             CELLSPACING,
473             CELLPADDING,
474             VALIGN,
475             HALIGN,
476             NOWRAP,
477             ROWSPAN,
478             COLSPAN,
479             PROMPT,
480             HTTPEQUIV,
481             CONTENT,
482             LANGUAGE,
483             VERSION,
484             N,
485             FRAMEBORDER,
486             MARGINWIDTH,
487             MARGINHEIGHT,
488             SCROLLING,
489             NORESIZE,
490             MEDIA,
491         ENDTAG
492     };
493     }
494
495     // The secret to 73, is that, given that the Hashtable contents
496
// never change once the static initialization happens, the initial size
497
// that the hashtable grew to was determined, and then that very size
498
// is used.
499
//
500
private static final Hashtable JavaDoc tagHashtable = new Hashtable JavaDoc(73);
501
502     /** Maps from StyleConstant key to HTML.Tag. */
503     private static final Hashtable JavaDoc scMapping = new Hashtable JavaDoc(8);
504
505     static {
506
507     for (int i = 0; i < Tag.allTags.length; i++ ) {
508         tagHashtable.put(Tag.allTags[i].toString(), Tag.allTags[i]);
509         StyleContext.registerStaticAttributeKey(Tag.allTags[i]);
510     }
511     StyleContext.registerStaticAttributeKey(Tag.IMPLIED);
512     StyleContext.registerStaticAttributeKey(Tag.CONTENT);
513     StyleContext.registerStaticAttributeKey(Tag.COMMENT);
514     for (int i = 0; i < Attribute.allAttributes.length; i++) {
515         StyleContext.registerStaticAttributeKey(Attribute.
516                             allAttributes[i]);
517     }
518     StyleContext.registerStaticAttributeKey(HTML.NULL_ATTRIBUTE_VALUE);
519         scMapping.put(StyleConstants.Bold, Tag.B);
520         scMapping.put(StyleConstants.Italic, Tag.I);
521         scMapping.put(StyleConstants.Underline, Tag.U);
522         scMapping.put(StyleConstants.StrikeThrough, Tag.STRIKE);
523         scMapping.put(StyleConstants.Superscript, Tag.SUP);
524         scMapping.put(StyleConstants.Subscript, Tag.SUB);
525         scMapping.put(StyleConstants.FontFamily, Tag.FONT);
526         scMapping.put(StyleConstants.FontSize, Tag.FONT);
527     }
528
529     /**
530      * Returns the set of actual HTML tags that
531      * are recognized by the default HTML reader.
532      * This set does not include tags that are
533      * manufactured by the reader.
534      */

535     public static Tag[] getAllTags() {
536     Tag[] tags = new Tag[Tag.allTags.length];
537     System.arraycopy(Tag.allTags, 0, tags, 0, Tag.allTags.length);
538     return tags;
539     }
540
541     /**
542      * Fetches a tag constant for a well-known tag name (i.e. one of
543      * the tags in the set {A, ADDRESS, APPLET, AREA, B,
544      * BASE, BASEFONT, BIG,
545      * BLOCKQUOTE, BODY, BR, CAPTION, CENTER, CITE, CODE,
546      * DD, DFN, DIR, DIV, DL, DT, EM, FONT, FORM, FRAME,
547      * FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HR, HTML,
548      * I, IMG, INPUT, ISINDEX, KBD, LI, LINK, MAP, MENU,
549      * META, NOBR, NOFRAMES, OBJECT, OL, OPTION, P, PARAM,
550      * PRE, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, S,
551      * STRONG, STYLE, SUB, SUP, TABLE, TD, TEXTAREA,
552      * TH, TITLE, TR, TT, U, UL, VAR}. If the given
553      * name does not represent one of the well-known tags, then
554      * <code>null</code> will be returned.
555      *
556      * @param tagName the <code>String</code> name requested
557      * @return a tag constant corresponding to the <code>tagName</code>,
558      * or <code>null</code> if not found
559      */

560     public static Tag getTag(String JavaDoc tagName) {
561
562     Object JavaDoc t = tagHashtable.get(tagName);
563     return (t == null ? null : (Tag)t);
564     }
565
566     /**
567      * Returns the HTML <code>Tag</code> associated with the
568      * <code>StyleConstants</code> key <code>sc</code>.
569      * If no matching <code>Tag</code> is found, returns
570      * <code>null</code>.
571      *
572      * @param sc the <code>StyleConstants</code> key
573      * @return tag which corresponds to <code>sc</code>, or
574      * <code>null</code> if not found
575      */

576     static Tag getTagForStyleConstantsKey(StyleConstants JavaDoc sc) {
577         return (Tag)scMapping.get(sc);
578     }
579
580     /**
581      * Fetches an integer attribute value. Attribute values
582      * are stored as a string, and this is a convenience method
583      * to convert to an actual integer.
584      *
585      * @param attr the set of attributes to use to try to fetch a value
586      * @param key the key to use to fetch the value
587      * @param def the default value to use if the attribute isn't
588      * defined or there is an error converting to an integer
589      */

590     public static int getIntegerAttributeValue(AttributeSet JavaDoc attr,
591                            Attribute key, int def) {
592     int value = def;
593     String JavaDoc istr = (String JavaDoc) attr.getAttribute(key);
594     if (istr != null) {
595         try {
596         value = Integer.valueOf(istr).intValue();
597         } catch (NumberFormatException JavaDoc e) {
598         value = def;
599         }
600     }
601     return value;
602     }
603
604     // This is used in cases where the value for the attribute has not
605
// been specified.
606
//
607
public static final String JavaDoc NULL_ATTRIBUTE_VALUE = "#DEFAULT";
608
609     // size determined similar to size of tagHashtable
610
private static final Hashtable JavaDoc attHashtable = new Hashtable JavaDoc(77);
611
612     static {
613
614     for (int i = 0; i < Attribute.allAttributes.length; i++ ) {
615         attHashtable.put(Attribute.allAttributes[i].toString(), Attribute.allAttributes[i]);
616     }
617     }
618
619     /**
620      * Returns the set of HTML attributes recognized.
621      * @return the set of HTML attributes recognized
622      */

623     public static Attribute[] getAllAttributeKeys() {
624     Attribute[] attributes = new Attribute[Attribute.allAttributes.length];
625     System.arraycopy(Attribute.allAttributes, 0,
626              attributes, 0, Attribute.allAttributes.length);
627     return attributes;
628     }
629
630     /**
631      * Fetches an attribute constant for a well-known attribute name
632      * (i.e. one of the attributes in the set {FACE, COMMENT, SIZE,
633      * COLOR, CLEAR, BACKGROUND, BGCOLOR, TEXT, LINK, VLINK, ALINK,
634      * WIDTH, HEIGHT, ALIGN, NAME, HREF, REL, REV, TITLE, TARGET,
635      * SHAPE, COORDS, ISMAP, NOHREF, ALT, ID, SRC, HSPACE, VSPACE,
636      * USEMAP, LOWSRC, CODEBASE, CODE, ARCHIVE, VALUE, VALUETYPE,
637      * TYPE, CLASS, STYLE, LANG, DIR, DECLARE, CLASSID, DATA, CODETYPE,
638      * STANDBY, BORDER, SHAPES, NOSHADE, COMPACT, START, ACTION, METHOD,
639      * ENCTYPE, CHECKED, MAXLENGTH, MULTIPLE, SELECTED, ROWS, COLS,
640      * DUMMY, CELLSPACING, CELLPADDING, VALIGN, HALIGN, NOWRAP, ROWSPAN,
641      * COLSPAN, PROMPT, HTTPEQUIV, CONTENT, LANGUAGE, VERSION, N,
642      * FRAMEBORDER, MARGINWIDTH, MARGINHEIGHT, SCROLLING, NORESIZE,
643      * MEDIA, ENDTAG}).
644      * If the given name does not represent one of the well-known attributes,
645      * then <code>null</code> will be returned.
646      *
647      * @param attName the <code>String</code> requested
648      * @return the <code>Attribute</code> corresponding to <code>attName</code>
649      */

650     public static Attribute getAttributeKey(String JavaDoc attName) {
651     Object JavaDoc a = attHashtable.get(attName);
652     if (a == null) {
653       return null;
654     }
655     return (Attribute)a;
656     }
657
658 }
659
Popular Tags