KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ditchnet > xml > Xhtml


1 /*
2  * The contents of this file are subject to the GNU Lesser General Public
3  * License Version 2.1 (the "License"); you may not use this file
4  * except in compliance with the License. You may obtain a copy of
5  * the License at http://www.gnu.org/copyleft/lesser.html
6  *
7  * Software distributed under the License is distributed on an "AS
8  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9  * implied. See the License for the specific language governing
10  * rights and limitations under the License.
11  *
12  * Developer:
13  * Todd Ditchendorf, todd@ditchnet.org
14  *
15  */

16
17 /**
18  * @author Todd Ditchendorf
19  * @since 2005-03-12
20  * @version 0.8
21  *
22  *
23  *
24  *
25  */

26 package org.ditchnet.xml;
27
28 /**
29  * <p>Some of the {@link org.ditchnet.jsp.util.JspResponseWriter} class'
30  * public instance methods write markup (XML, specifically) to the response
31  * stream. The <code>Xml</code> interface, it's static inner interfaces
32  * <code>Tag</code> and <code>Attr</code> enforce type-safety and decrease the
33  * likelyhood of malformed XML (which is not truely XML anyway) being
34  * generated by the JspResponseWriter class.</p>
35  * <p>This class is one implementation of the <code>Xml</code> interface that
36  * represents a specific XML vocabulary - XHTML 1.0 Transitional.</p>
37  * <p>This class' static inner classes {@link org.ditchnet.xml.Xhtml.Tag}
38  * and {@link org.ditchnet.xml.Xhtml.Attr} present an enumerations of
39  * elements and attributes included in the XHTML vocabulary.</p>
40  *
41  * @author Todd Ditchendorf
42  *
43  *
44  */

45 public class Xhtml implements Xml {
46     
47     /**
48      * Private constructor. This is a utility class that may not be
49      * instanciated by client code.
50      */

51     private Xhtml() { }
52     
53     /**
54      * <p>This class implements the Type-Safe Enum pattern as outlined by
55      * Joshua Bloch in <em>Effective Java</em>. The only constructor is
56      * private, and therefore this class may not be instanciated by client
57      * code.</p>
58      * <p>This class' static member variables present the complete set of
59      * elements available in the XHTML 1.0 Transitional vocabulary.</p>
60      *
61      * @since 2005-03-12
62      * @version 0.8
63      * @author Todd Ditchendorf
64      *
65      */

66     public static class Tag implements Xml.Tag {
67         
68         public static final Tag A = new Tag("a");
69         public static final Tag ABBR = new Tag("abbr");
70         public static final Tag ACRONYM = new Tag("acronym");
71         public static final Tag ADDRESS = new Tag("address");
72         public static final Tag APPLET = new Tag("applet");
73         public static final Tag BASE = new Tag("base");
74         public static final Tag BLOCKQUOTE = new Tag("blockquote");
75         public static final Tag BODY = new Tag("body");
76         public static final Tag BR = new Tag("br");
77         public static final Tag BUTTON = new Tag("button");
78         public static final Tag CAPTION = new Tag("caption");
79         public static final Tag CITE = new Tag("cite");
80         public static final Tag CODE = new Tag("code");
81         public static final Tag COMMENT = new Tag("comment");
82         public static final Tag DD = new Tag("dd");
83         public static final Tag DEL = new Tag("del");
84         public static final Tag DFN = new Tag("dfn");
85         public static final Tag DIR = new Tag("dir");
86         public static final Tag DIV = new Tag("div");
87         public static final Tag DL = new Tag("dl");
88         public static final Tag DT = new Tag("dt");
89         public static final Tag EM = new Tag("em");
90         public static final Tag HEAD = new Tag("head");
91         public static final Tag FORM = new Tag("form");
92         public static final Tag FIELDSET = new Tag("fieldset");
93         public static final Tag HTML = new Tag("html");
94         public static final Tag H1 = new Tag("h1");
95         public static final Tag H2 = new Tag("h2");
96         public static final Tag H3 = new Tag("h3");
97         public static final Tag H4 = new Tag("h4");
98         public static final Tag H5 = new Tag("h5");
99         public static final Tag H6 = new Tag("h6");
100         public static final Tag IFRAME = new Tag("iframe");
101         public static final Tag IMG = new Tag("img");
102         public static final Tag INPUT = new Tag("input");
103         public static final Tag LABEL = new Tag("label");
104         public static final Tag LEGEND = new Tag("legend");
105         public static final Tag LI = new Tag("li");
106         public static final Tag LINK = new Tag("link");
107         public static final Tag META = new Tag("meta");
108         public static final Tag NOSCRIPT = new Tag("noscript");
109         public static final Tag OBJECT = new Tag("object");
110         public static final Tag OL = new Tag("ol");
111         public static final Tag OPTGROUP = new Tag("optgroup");
112         public static final Tag OPTION = new Tag("option");
113         public static final Tag PARAM = new Tag("param");
114         public static final Tag PRE = new Tag("pre");
115         public static final Tag Q = new Tag("q");
116         public static final Tag SAMP = new Tag("samp");
117         public static final Tag SPAN = new Tag("span");
118         public static final Tag SCRIPT = new Tag("script");
119         public static final Tag STRONG = new Tag("strong");
120         public static final Tag SUMMARY = new Tag("summary");
121         public static final Tag TABLE = new Tag("table");
122         public static final Tag TITLE = new Tag("title");
123         public static final Tag TEXTAREA = new Tag("textarea");
124         public static final Tag TBODY = new Tag("tbody");
125         public static final Tag TD = new Tag("td");
126         public static final Tag TFOOT = new Tag("tfoot");
127         public static final Tag THEAD = new Tag("thead");
128         public static final Tag TH = new Tag("th");
129         public static final Tag TR = new Tag("tr");
130         public static final Tag UL = new Tag("ul");
131         public static final Tag VAR = new Tag("var");
132         
133         /** This tag's name */
134         private final String JavaDoc name;
135         
136         /**
137          * Sole private constructor. Used only to construct public static final
138          * enumeration of elements available in XHTML 1.0 Transitional.
139          * Stores reference to this tag's name.
140          */

141         private Tag(final String JavaDoc name) {
142             this.name = name;
143         }
144         
145         /**
146          * Return this tag's name.
147          */

148         public String JavaDoc toString() {
149             return name;
150         }
151         
152     }
153     
154     /**
155      * <p>This class implements the Type-Safe Enum pattern as outlined by
156      * Joshua Bloch in <em>Effective Java</em>. The only constructor is
157      * private, and therefore this class may not be instanciated by client
158      * code.</p>
159      * <p>This class' static member variables present the complete set of
160      * attribute names available in the XHTML 1.0 Transitional
161      * vocabulary.</p>
162      *
163      * @since 2005-03-12
164      * @version 0.8
165      * @author Todd Ditchendorf
166      *
167      *
168      */

169     public static class Attr implements Xml.Attr {
170                 
171         public static final Attr ALT = new Attr("alt");
172         public static final Attr BORDER = new Attr("border");
173         public static final Attr CHECKED = new Attr("checked");
174         public static final Attr CLASS = new Attr("class");
175         public static final Attr DIR = new Attr("dir");
176         public static final Attr DISABLED = new Attr("disabled");
177         public static final Attr HREF = new Attr("href");
178         public static final Attr ID = new Attr("id");
179         public static final Attr LANG = new Attr("lang");
180         public static final Attr LONGDESC = new Attr("longdesc");
181         public static final Attr NAME = new Attr("name");
182         public static final Attr ONBLUR = new Attr("onblur");
183         public static final Attr ONCHANGE = new Attr("onchange");
184         public static final Attr ONCLICK = new Attr("onclick");
185         public static final Attr ONDBLCLICK = new Attr("ondblclick");
186         public static final Attr ONFOCUS = new Attr("onfocus");
187         public static final Attr ONKEYDOWN = new Attr("onkeydown");
188         public static final Attr ONKEYPRESS = new Attr("onkeypress");
189         public static final Attr ONKEYUP = new Attr("onkeyup");
190         public static final Attr ONLOAD = new Attr("onload");
191         public static final Attr ONMOUSEDOWN = new Attr("onmousedown");
192         public static final Attr ONMOUSEMOVE = new Attr("onmousemove");
193         public static final Attr ONMOUSEOVER = new Attr("onmouseover");
194         public static final Attr ONSELECT = new Attr("onselect");
195         public static final Attr REL = new Attr("rel");
196         public static final Attr SELECTED = new Attr("selected");
197         public static final Attr SRC = new Attr("src");
198         public static final Attr STYLE = new Attr("style");
199         public static final Attr TARGET = new Attr("target");
200         public static final Attr TITLE = new Attr("title");
201         public static final Attr TYPE = new Attr("type");
202         public static final Attr VALUE = new Attr("value");
203         
204         /** This attribute's name */
205         private final String JavaDoc name;
206         
207         /**
208          * Sole private constructor. Used only to construct public static final
209          * enumeration of attribute names available in XHTML 1.0
210          * Transitional.
211          * Stores reference to this tag's name.
212          */

213         private Attr(final String JavaDoc name) {
214             this.name = name;
215         }
216         
217         /**
218          * Return this attribute's name.
219          */

220         public String JavaDoc toString() {
221             return name;
222         }
223     }
224     
225 }
226
227
228
Popular Tags