1 /* HTML.java -- HTML document tag constants
2 Copyright (C) 2002 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax
.swing
.text
.html
;
41 import java
.io
.Serializable
;
43 import java
.lang
.reflect
.Field
;
44 import java
.lang
.reflect
.Modifier
;
47 import java
.util
.TreeMap
;
49 import javax
.swing
.text
.AttributeSet
;
52 * HTML attribute and tag definitions.
53 * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
58 * Represents a HTML attribute.
60 public static class Attribute
61 implements Serializable
64 * The action attribute
66 public static final Attribute ACTION
= new Attribute("action");
71 public static final Attribute ALIGN
= new Attribute("align");
76 public static final Attribute ALINK
= new Attribute("alink");
81 public static final Attribute ALT
= new Attribute("alt");
84 * The archive attribute
86 public static final Attribute ARCHIVE
= new Attribute("archive");
89 * The background attribute
91 public static final Attribute BACKGROUND
= new Attribute("background");
94 * The bgcolor attribute
96 public static final Attribute BGCOLOR
= new Attribute("bgcolor");
99 * The border attribute
101 public static final Attribute BORDER
= new Attribute("border");
104 * The cellpadding attribute
106 public static final Attribute CELLPADDING
= new Attribute("cellpadding");
109 * The cellspacing attribute
111 public static final Attribute CELLSPACING
= new Attribute("cellspacing");
114 * The checked attribute
116 public static final Attribute CHECKED
= new Attribute("checked");
119 * The class attribute
121 public static final Attribute CLASS
= new Attribute("class");
124 * The classid attribute
126 public static final Attribute CLASSID
= new Attribute("classid");
129 * The clear attribute
131 public static final Attribute CLEAR
= new Attribute("clear");
136 public static final Attribute CODE
= new Attribute("code");
139 * The codebase attribute
141 public static final Attribute CODEBASE
= new Attribute("codebase");
144 * The codetype attribute
146 public static final Attribute CODETYPE
= new Attribute("codetype");
149 * The color attribute
151 public static final Attribute COLOR
= new Attribute("color");
156 public static final Attribute COLS
= new Attribute("cols");
159 * The colspan attribute
161 public static final Attribute COLSPAN
= new Attribute("colspan");
164 * The comment attribute
166 public static final Attribute COMMENT
= new Attribute("comment");
169 * The compact attribute
171 public static final Attribute COMPACT
= new Attribute("compact");
174 * The content attribute
176 public static final Attribute CONTENT
= new Attribute("content");
179 * The coords attribute
181 public static final Attribute COORDS
= new Attribute("coords");
186 public static final Attribute DATA
= new Attribute("data");
189 * The declare attribute
191 public static final Attribute DECLARE
= new Attribute("declare");
196 public static final Attribute DIR
= new Attribute("dir");
199 * The dummy attribute
201 public static final Attribute DUMMY
= new Attribute("dummy");
204 * The enctype attribute
206 public static final Attribute ENCTYPE
= new Attribute("enctype");
209 * The endtag attribute
211 public static final Attribute ENDTAG
= new Attribute("endtag");
216 public static final Attribute FACE
= new Attribute("face");
219 * The frameborder attribute
221 public static final Attribute FRAMEBORDER
= new Attribute("frameborder");
224 * The halign attribute
226 public static final Attribute HALIGN
= new Attribute("halign");
229 * The height attribute
231 public static final Attribute HEIGHT
= new Attribute("height");
236 public static final Attribute HREF
= new Attribute("href");
239 * The hspace attribute
241 public static final Attribute HSPACE
= new Attribute("hspace");
244 * The http-equiv attribute
246 public static final Attribute HTTPEQUIV
= new Attribute("http-equiv");
251 public static final Attribute ID
= new Attribute("id");
254 * The ismap attribute
256 public static final Attribute ISMAP
= new Attribute("ismap");
261 public static final Attribute LANG
= new Attribute("lang");
264 * The language attribute
266 public static final Attribute LANGUAGE
= new Attribute("language");
271 public static final Attribute LINK
= new Attribute("link");
274 * The lowsrc attribute
276 public static final Attribute LOWSRC
= new Attribute("lowsrc");
279 * The marginheight attribute
281 public static final Attribute MARGINHEIGHT
= new Attribute("marginheight");
284 * The marginwidth attribute
286 public static final Attribute MARGINWIDTH
= new Attribute("marginwidth");
289 * The maxlength attribute
291 public static final Attribute MAXLENGTH
= new Attribute("maxlength");
294 * The media attribute
296 public static final Attribute MEDIA
= new Attribute("media");
299 * The method attribute
301 public static final Attribute METHOD
= new Attribute("method");
304 * The multiple attribute
306 public static final Attribute MULTIPLE
= new Attribute("multiple");
311 public static final Attribute N
= new Attribute("n");
316 public static final Attribute NAME
= new Attribute("name");
319 * The nohref attribute
321 public static final Attribute NOHREF
= new Attribute("nohref");
324 * The noresize attribute
326 public static final Attribute NORESIZE
= new Attribute("noresize");
329 * The noshade attribute
331 public static final Attribute NOSHADE
= new Attribute("noshade");
334 * The nowrap attribute
336 public static final Attribute NOWRAP
= new Attribute("nowrap");
339 * The prompt attribute
341 public static final Attribute PROMPT
= new Attribute("prompt");
346 public static final Attribute REL
= new Attribute("rel");
351 public static final Attribute REV
= new Attribute("rev");
356 public static final Attribute ROWS
= new Attribute("rows");
359 * The rowspan attribute
361 public static final Attribute ROWSPAN
= new Attribute("rowspan");
364 * The scrolling attribute
366 public static final Attribute SCROLLING
= new Attribute("scrolling");
369 * The selected attribute
371 public static final Attribute SELECTED
= new Attribute("selected");
374 * The shape attribute
376 public static final Attribute SHAPE
= new Attribute("shape");
379 * The shapes attribute
381 public static final Attribute SHAPES
= new Attribute("shapes");
386 public static final Attribute SIZE
= new Attribute("size");
391 public static final Attribute SRC
= new Attribute("src");
394 * The standby attribute
396 public static final Attribute STANDBY
= new Attribute("standby");
399 * The start attribute
401 public static final Attribute START
= new Attribute("start");
404 * The style attribute
406 public static final Attribute STYLE
= new Attribute("style");
409 * The target attribute
411 public static final Attribute TARGET
= new Attribute("target");
416 public static final Attribute TEXT
= new Attribute("text");
419 * The title attribute
421 public static final Attribute TITLE
= new Attribute("title");
426 public static final Attribute TYPE
= new Attribute("type");
429 * The usemap attribute
431 public static final Attribute USEMAP
= new Attribute("usemap");
434 * The valign attribute
436 public static final Attribute VALIGN
= new Attribute("valign");
439 * The value attribute
441 public static final Attribute VALUE
= new Attribute("value");
444 * The valuetype attribute
446 public static final Attribute VALUETYPE
= new Attribute("valuetype");
449 * The version attribute
451 public static final Attribute VERSION
= new Attribute("version");
454 * The vlink attribute
456 public static final Attribute VLINK
= new Attribute("vlink");
459 * The vspace attribute
461 public static final Attribute VSPACE
= new Attribute("vspace");
464 * The width attribute
466 public static final Attribute WIDTH
= new Attribute("width");
467 private final String name
;
470 * Creates the attribute with the given name.
472 protected Attribute(String a_name
)
478 * Calls compareTo on the tag names (Strings)
480 public int compareTo(Object other
)
482 return name
.compareTo(((Attribute
) other
).name
);
486 * The attributes are equal if the names are equal
489 public boolean equals(Object other
)
494 if (!(other
instanceof Attribute
))
497 Attribute that
= (Attribute
) other
;
499 return that
.name
.equalsIgnoreCase(name
);
503 * Returns the hash code which corresponds to the string for this tag.
505 public int hashCode()
507 return name
== null ?
0 : name
.hashCode();
511 * Returns the attribute name. The names of the built-in attributes
512 * are always returned in lowercase.
514 public String
toString()
520 * Return an array of all attributes, declared in the HTML.Attribute
521 * class. WARNING: attributes are the only public fields,
522 * expected in this class.
524 static Attribute
[] getAllAttributes()
526 Field
[] f
= Attribute
.class.getFields();
527 Attribute
[] attrs
= new Attribute
[ f
.length
];
532 for (int i
= 0; i
< f
.length
; i
++)
536 if ((x
.getModifiers() & Modifier
.STATIC
) != 0)
538 if (x
.getType().equals(Attribute
.class))
542 a
= (Attribute
) x
.get(null);
547 ex
.printStackTrace(System
.err
);
548 throw new Error("This should never happen, report a bug");
559 * Represents a HTML tag.
561 public static class Tag
562 implements Comparable
, Serializable
567 public static final Tag A
= new Tag("a");
570 * The <address> tag
572 public static final Tag ADDRESS
= new Tag("address");
575 * The <applet> tag
577 public static final Tag APPLET
= new Tag("applet");
580 * The <area> tag
582 public static final Tag AREA
= new Tag("area");
587 public static final Tag B
= new Tag("b");
590 * The <base> tag
592 public static final Tag BASE
= new Tag("base");
595 * The <basefont> tag
597 public static final Tag BASEFONT
= new Tag("basefont");
600 * The <big> tag
602 public static final Tag BIG
= new Tag("big");
605 * The <blockquote> tag , breaks flow, block tag.
607 public static final Tag BLOCKQUOTE
= new Tag("blockquote", BREAKS
| BLOCK
);
610 * The <body> tag , breaks flow, block tag.
612 public static final Tag BODY
= new Tag("body", BREAKS
| BLOCK
);
615 * The <br> tag , breaks flow.
617 public static final Tag BR
= new Tag("br", BREAKS
);
620 * The <caption> tag
622 public static final Tag CAPTION
= new Tag("caption");
625 * The <center> tag , breaks flow.
627 public static final Tag CENTER
= new Tag("center", BREAKS
);
630 * The <cite> tag
632 public static final Tag CITE
= new Tag("cite");
635 * The <code> tag
637 public static final Tag CODE
= new Tag("code");
640 * The <dd> tag , breaks flow, block tag.
642 public static final Tag DD
= new Tag("dd", BREAKS
| BLOCK
);
645 * The <dfn> tag
647 public static final Tag DFN
= new Tag("dfn");
650 * The <dir> tag , breaks flow, block tag.
652 public static final Tag DIR
= new Tag("dir", BREAKS
| BLOCK
);
655 * The <div> tag , breaks flow, block tag.
657 public static final Tag DIV
= new Tag("div", BREAKS
| BLOCK
);
660 * The <dl> tag , breaks flow, block tag.
662 public static final Tag DL
= new Tag("dl", BREAKS
| BLOCK
);
665 * The <dt> tag , breaks flow, block tag.
667 public static final Tag DT
= new Tag("dt", BREAKS
| BLOCK
);
672 public static final Tag EM
= new Tag("em");
675 * The <font> tag
677 public static final Tag FONT
= new Tag("font");
680 * The <form> tag , breaks flow.
682 public static final Tag FORM
= new Tag("form", BREAKS
);
685 * The <frame> tag
687 public static final Tag FRAME
= new Tag("frame");
690 * The <frameset> tag
692 public static final Tag FRAMESET
= new Tag("frameset");
695 * The <h1> tag , breaks flow, block tag.
697 public static final Tag H1
= new Tag("h1", BREAKS
| BLOCK
);
700 * The <h2> tag , breaks flow, block tag.
702 public static final Tag H2
= new Tag("h2", BREAKS
| BLOCK
);
705 * The <h3> tag , breaks flow, block tag.
707 public static final Tag H3
= new Tag("h3", BREAKS
| BLOCK
);
710 * The <h4> tag , breaks flow, block tag.
712 public static final Tag H4
= new Tag("h4", BREAKS
| BLOCK
);
715 * The <h5> tag , breaks flow, block tag.
717 public static final Tag H5
= new Tag("h5", BREAKS
| BLOCK
);
720 * The <h6> tag , breaks flow, block tag.
722 public static final Tag H6
= new Tag("h6", BREAKS
| BLOCK
);
725 * The <head> tag , breaks flow, block tag.
727 public static final Tag HEAD
= new Tag("head", BREAKS
| BLOCK
);
730 * The <hr> tag , breaks flow.
732 public static final Tag HR
= new Tag("hr", BREAKS
);
735 * The <html> tag , breaks flow.
737 public static final Tag HTML
= new Tag("html", BREAKS
);
742 public static final Tag I
= new Tag("i");
745 * The <img> tag
747 public static final Tag IMG
= new Tag("img");
750 * The <input> tag
752 public static final Tag INPUT
= new Tag("input");
755 * The <isindex> tag , breaks flow.
757 public static final Tag ISINDEX
= new Tag("isindex", BREAKS
);
760 * The <kbd> tag
762 public static final Tag KBD
= new Tag("kbd");
765 * The <li> tag , breaks flow, block tag.
767 public static final Tag LI
= new Tag("li", BREAKS
| BLOCK
);
770 * The <link> tag
772 public static final Tag LINK
= new Tag("link");
775 * The <map> tag
777 public static final Tag MAP
= new Tag("map");
780 * The <menu> tag , breaks flow, block tag.
782 public static final Tag MENU
= new Tag("menu", BREAKS
| BLOCK
);
785 * The <meta> tag
787 public static final Tag META
= new Tag("meta");
790 * The <nobr> tag
792 public static final Tag NOBR
= new Tag("nobr");
795 * The <noframes> tag , breaks flow, block tag.
797 public static final Tag NOFRAMES
= new Tag("noframes", BREAKS
| BLOCK
);
800 * The <object> tag
802 public static final Tag OBJECT
= new Tag("object");
805 * The <ol> tag , breaks flow, block tag.
807 public static final Tag OL
= new Tag("ol", BREAKS
| BLOCK
);
810 * The <option> tag
812 public static final Tag OPTION
= new Tag("option");
815 * The <p> tag , breaks flow, block tag.
817 public static final Tag P
= new Tag("p", BREAKS
| BLOCK
);
820 * The <param> tag
822 public static final Tag PARAM
= new Tag("param");
825 * The <pre> tag , breaks flow, block tag, preformatted.
827 public static final Tag PRE
= new Tag("pre", BREAKS
| BLOCK
| PREFORMATTED
);
832 public static final Tag S
= new Tag("s");
835 * The <samp> tag
837 public static final Tag SAMP
= new Tag("samp");
840 * The <script> tag
842 public static final Tag SCRIPT
= new Tag("script");
845 * The <select> tag
847 public static final Tag SELECT
= new Tag("select");
850 * The <small> tag
852 public static final Tag SMALL
= new Tag("small");
855 * The <span> tag
857 public static final Tag SPAN
= new Tag("span");
860 * The <strike> tag
862 public static final Tag STRIKE
= new Tag("strike");
865 * The <strong> tag
867 public static final Tag STRONG
= new Tag("strong");
870 * The <style> tag
872 public static final Tag STYLE
= new Tag("style");
875 * The <sub> tag
877 public static final Tag SUB
= new Tag("sub");
880 * The <sup> tag
882 public static final Tag SUP
= new Tag("sup");
885 * The <table> tag , block tag.
887 public static final Tag TABLE
= new Tag("table", BLOCK
);
890 * The <td> tag , breaks flow, block tag.
892 public static final Tag TD
= new Tag("td", BREAKS
| BLOCK
);
895 * The <textarea> tag , preformatted.
897 public static final Tag TEXTAREA
= new Tag("textarea", PREFORMATTED
);
900 * The <th> tag , breaks flow, block tag.
902 public static final Tag TH
= new Tag("th", BREAKS
| BLOCK
);
905 * The <title> tag , breaks flow, block tag.
907 public static final Tag TITLE
= new Tag("title", BREAKS
| BLOCK
);
910 * The <tr> tag , block tag.
912 public static final Tag TR
= new Tag("tr", BLOCK
);
917 public static final Tag TT
= new Tag("tt");
922 public static final Tag U
= new Tag("u");
925 * The <ul> tag , breaks flow, block tag.
927 public static final Tag UL
= new Tag("ul", BREAKS
| BLOCK
);
930 * The <var> tag
932 public static final Tag VAR
= new Tag("var");
937 * Total number of syntetic tags, delared in the Tag class.
938 * This must be adjusted if the new synthetic tags are declared.
939 * Otherwise the HTML.getAllTags() will not work as expected.
941 private static final int TOTAL_SYNTHETIC_TAGS
= 3;
944 * All comments are labeled with this tag.
945 * This tag is not included into the array, returned by getAllTags().
946 * toString() returns 'comment'. HTML reader synthesizes this tag.
948 public static final Tag COMMENT
= new Tag("comment", SYNTHETIC
);
951 * All text content is labeled with this tag.
952 * This tag is not included into the array, returned by getAllTags().
953 * toString() returns 'content'. HTML reader synthesizes this tag.
955 public static final Tag CONTENT
= new Tag("content", SYNTHETIC
);
958 * All text content must be in a paragraph element.
959 * If a paragraph didn't exist when content was encountered,
960 * a paragraph is manufactured.
961 * toString() returns 'p-implied'. HTML reader synthesizes this tag.
963 public static final Tag IMPLIED
= new Tag("p-implied", SYNTHETIC
);
968 * Create the unitialised instance of HTML.Tag.
970 * The {@link #breaksFlow()}, {@link #isBlock()}
971 * and {@link #isPreformatted()} will always return false.
972 * The {@link #toString()} will return <code>null</code>.
983 * Creates a new Tag with the specified id, and with causesBreak
984 * and isBlock set to false.
986 protected Tag(String id
)
993 * Creates a new Tag with the specified tag name and
994 * causesBreak and isBlock properties.
996 protected Tag(String id
, boolean causesBreak
, boolean isBlock
)
1015 * Create a tag taking flags.
1017 Tag(String id
, int a_flags
)
1024 * Returns true if this tag is a block tag, which is a tag used to
1025 * add structure to a document.
1027 public boolean isBlock()
1029 return (flags
& BLOCK
) != 0;
1033 * Returns true if this tag is pre-formatted, which is true if
1034 * the tag is either PRE or TEXTAREA
1036 public boolean isPreformatted()
1038 return (flags
& PREFORMATTED
) != 0;
1042 * Returns true if this tag causes a line break to the flow of text
1044 public boolean breaksFlow()
1046 return (flags
& BREAKS
) != 0;
1050 * Calls compareTo on the tag names (Strings)
1052 public int compareTo(Object other
)
1054 return name
.compareTo(((Tag
) other
).name
);
1058 * The tags are equal if the names are equal (ignoring case).
1060 public boolean equals(Object other
)
1067 if (!(other
instanceof Tag
))
1072 Tag that
= (Tag
) other
;
1074 return that
.name
.equalsIgnoreCase(name
);
1078 * Returns the hash code which corresponds to the string for this tag.
1080 public int hashCode()
1082 return name
== null ?
0 : name
.hashCode();
1086 * Returns the tag name. The names of the built-in tags are always
1087 * returned in lowercase.
1089 public String
toString()
1095 * Return an array of HTML tags, declared in HTML.Tag class.
1096 * WARNING: This method expects that the Tags are the only
1097 * public fields declared in the Tag class.
1099 static Tag
[] getAllTags()
1101 Field
[] f
= Tag
.class.getFields();
1104 // The syntetic tags are not included.
1105 Tag
[] tags
= new Tag
[ f
.length
- TOTAL_SYNTHETIC_TAGS
];
1109 for (int i
= 0; i
< f
.length
; i
++)
1113 if ((x
.getModifiers() & Modifier
.STATIC
) != 0)
1115 if (x
.getType().equals(Tag
.class))
1119 t
= (Tag
) x
.get(null);
1121 if (!t
.isSyntetic())
1126 catch (IllegalAccessException ex
)
1130 catch (IllegalArgumentException ex
)
1142 * Returns true for tags, generated by the html reader
1143 * (COMMENT, CONTENT and IMPLIED).
1145 boolean isSyntetic()
1147 return (flags
& SYNTHETIC
) != 0;
1150 private static void unexpected(Exception ex
)
1153 throw new Error("This should never happen, report a bug", ex
);
1158 * Represents an unknown HTML tag.
1159 * @author Mark Wielaard (mark@klomp.org)
1161 public static class UnknownTag
1163 implements Serializable
1165 private static final long serialVersionUID
= -1534369342247250625L;
1168 * Creates a new UnknownTag with the specified name
1169 * @param name The tag name.
1172 public UnknownTag(String name
)
1179 * This value is returned for attributes without value that have no
1180 * default value defined in the DTD.
1182 public static final String NULL_ATTRIBUTE_VALUE
= "#DEFAULT";
1184 /* Package level html tag flags */
1185 static final int BREAKS
= 1;
1186 static final int BLOCK
= 2;
1187 static final int PREFORMATTED
= 4;
1188 static final int SYNTHETIC
= 8;
1189 private static Map tagMap
;
1190 private static Map attrMap
;
1193 * The public constructor (does nothing). It it seldom required to have
1194 * an instance of this class, because all public fields and methods
1199 // Nothing to do here.
1203 * Returns the set of the recognized HTML attributes.
1205 public static HTML
.Attribute
[] getAllAttributeKeys()
1207 return Attribute
.getAllAttributes();
1211 * Returns the set of actual HTML tags that are recognized by
1212 * the default HTML reader. The returned array does not include the
1213 * COMMENT, CONTENT and IMPLIED tags.
1215 public static HTML
.Tag
[] getAllTags()
1217 return Tag
.getAllTags();
1221 * Returns an htl attribute constant for the given attribute name.
1222 * @param attName the attribute name, case insensitive
1224 public static Attribute
getAttributeKey(String attName
)
1226 if (attrMap
== null)
1228 // Create the map on demand.
1229 attrMap
= new TreeMap();
1231 Attribute
[] attrs
= getAllAttributeKeys();
1233 for (int i
= 0; i
< attrs
.length
; i
++)
1235 attrMap
.put(attrs
[ i
].toString(), attrs
[ i
]);
1239 return (Attribute
) attrMap
.get(attName
.toLowerCase());
1243 * Searches the value of given attribute in the provided set.
1244 * If the value is found (String type expected), tries to parse it as
1245 * an integer value. If succeded, returns the obtained integer value.
1247 * For example:<p><code>
1248 * SimpleAttributeSet ase = new SimpleAttributeSet();
1249 * ase.addAttribute(HTML.getAttributeKey("size"),"222");
1250 * System.out.println(
1251 * HTML.getIntegerAttributeValue
1252 * (ase, HTML.getAttributeKey("size"), 333)); // prints "222"
1253 * System.out.println(
1254 * HTML.getIntegerAttributeValue
1255 * (ase, HTML.getAttributeKey("width"), 333)); // prints "333".
1259 * @param set The attribute set to search in. If the set contains the
1260 * given attribute, it must by a type of String.
1261 * @param attribute The html attribute to search in
1262 * @param defaultValue The value that is returned if the attribute is not
1263 * found in the given set or if the NumberFormatException was thrown
1264 * during the parsing.
1266 public static int getIntegerAttributeValue(AttributeSet set
,
1267 HTML
.Attribute attribute
,
1271 Object v
= set
.getAttribute(attribute
);
1275 return defaultValue
;
1280 return Integer
.parseInt(v
.toString().trim());
1282 catch (Exception ex
)
1284 return defaultValue
;
1289 * Returns a HTML tag constant for the given HTML attribute name.
1290 * If the tag is unknown, the null is returned.
1291 * @param tagName the tag name, case insensitive
1293 public static Tag
getTag(String tagName
)
1297 // Create the mao on demand.
1298 tagMap
= new TreeMap();
1300 Tag
[] tags
= getAllTags();
1302 for (int i
= 0; i
< tags
.length
; i
++)
1304 tagMap
.put(tags
[ i
].toString(), tags
[ i
]);
1308 return (Tag
) tagMap
.get(tagName
.toLowerCase());