001/* 
002    Licensed to the Apache Software Foundation (ASF) under one
003    or more contributor license agreements.  See the NOTICE file
004    distributed with this work for additional information
005    regarding copyright ownership.  The ASF licenses this file
006    to you under the Apache License, Version 2.0 (the
007    "License"); you may not use this file except in compliance
008    with the License.  You may obtain a copy of the License at
009
010       http://www.apache.org/licenses/LICENSE-2.0
011
012    Unless required by applicable law or agreed to in writing,
013    software distributed under the License is distributed on an
014    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015    KIND, either express or implied.  See the License for the
016    specific language governing permissions and limitations
017    under the License.  
018 */
019
020package org.apache.wiki.util;
021
022/**
023 *  Provides constants for the Extensible HyperText Markup Language (XHTML) 1.0.
024 *
025 * @since     2.10
026 */
027public enum XHTML 
028{
029    // XHTML element type names ...........................................
030
031    a, abbr, acronym, address, applet, area,
032    b, base, basefont, bdo, big, blockquote, body, br, button,
033    caption, center, cite, code, col, colgroup,
034    dd, del, dfn, dir, div, dl, dt,
035    em,
036    fieldset, font, form, frame, frameset,
037    h1, h2, h3, h4, h5, h6, head, hr, html,
038    i, iframe, img, input, ins, isindex,
039    kbd,
040    label,
041    legend, li, link,
042    map, menu, meta,
043    noframes, noscript,
044    object, ol, optgroup, option,
045    p, param, pre,
046    q,
047    s, samp, script, select, small, span, strike, strong, style, sub, sup,
048    table, tbody, td, textarea, tfoot, th, thead, title, tr, tt,
049    u, ul,
050    var;
051
052
053    /** 
054     *  Returns the element type name (AKA generic identifier).
055     *  This is a convenience method that returns the same value 
056     *  as <tt>XHTML.&lt;GI&gt;>.name();</tt>.
057     */
058    public String getName()
059    {
060        return this.name();
061    }
062
063    
064    // XML Public and Namespace identifiers for XHTML .........................
065
066    /** XML Namespace URI for the Extensible HyperText Markup Language (XHTML). */
067    public static final String XMLNS_xhtml = "http://www.w3.org/1999/xhtml";
068
069    /** A String containing the Formal Public Identifier (FPI) for the XHTML 1.0 Strict DTD. */
070    public static final String STRICT_DTD_PubId = "-//W3C//DTD XHTML 1.0 Strict//EN";
071    /** A String containing a system identifier for the XHTML 1.0 Strict DTD. */
072    public static String STRICT_DTD_SysId = "xhtml1-strict.dtd";
073
074    /** A String containing the Formal Public Identifier (FPI) for the XHTML 1.0 Transitional DTD. */
075    public static final String TRANSITIONAL_DTD_PubId = "-//W3C//DTD XHTML 1.0 Transitional//EN";
076    /** A String containing a system identifier for the XHTML 1.0 Transitional DTD. */
077    public static String TRANSITIONAL_DTD_SysId = "xhtml1-transitional.dtd";
078
079    /** A String containing the Formal Public Identifier (FPI) for the XHTML 1.0 Frameset DTD. */
080    public static final String FRAMESET_DTD_PubId = "-//W3C//DTD XHTML 1.0 Frameset//EN";
081    /** A String containing a system identifier for the XHTML 1.0 Frameset DTD. */
082    public static String FRAMESET_DTD_SysId = "xhtml1-frameset.dtd";
083
084    // CSS strings ........................................................
085
086    /** An identifier for the CSS stylesheet notation using its W3C home page URI. */
087    public static final String CSS_style  = "http://www.w3.org/Style/CSS/";
088
089
090    // XHTML common attribute names .......................................
091
092    /** String containing the XHTML 'id' attribute name (i.e., 'id'). */
093    public static final String ATTR_id            = "id";
094
095    /** String containing the XHTML 'class' attribute name (i.e., 'class'). */
096    public static final String ATTR_class         = "class";
097
098    /** String containing the XHTML 'name' attribute name (i.e., 'name'). */
099    public static final String ATTR_name          = "name";
100
101    /** String containing the XHTML 'type' attribute name (i.e., 'type'). */
102    public static final String ATTR_type          = "type";
103
104    /** String containing the XHTML 'value' attribute name (i.e., 'value'). */
105    public static final String ATTR_value         = "value";
106
107    /** String containing the XHTML 'href' attribute name (i.e., 'href'). */
108    public static final String ATTR_href          = "href";
109
110    /** String containing the XHTML 'title' attribute name (i.e., 'title'). */
111    public static final String ATTR_title         = "title";
112
113    /** String containing the XHTML 'width' attribute name (i.e., 'width'). */
114    public static final String ATTR_width         = "width";
115
116    /** String containing the XHTML 'height' attribute name (i.e., 'height'). */
117    public static final String ATTR_height        = "height";
118
119    /** String containing the XHTML 'border' attribute name (i.e., 'border'). */
120    public static final String ATTR_border        = "border";
121
122    /** String containing the XHTML 'colspan' attribute name (i.e., 'colspan'). */
123    public static final String ATTR_colspan       = "colspan";
124
125    /** String containing the XHTML 'src' attribute name (i.e., 'src'). */
126    public static final String ATTR_src           = "src";
127
128    /** String containing the XHTML 'alt' attribute name (i.e., 'alt'). */
129    public static final String ATTR_alt           = "alt";
130
131    // okay, maybe not so common
132
133    /** String containing the XHTML 'bgcolor' attribute name (i.e., 'bgcolor'). */
134    public static final String ATTR_bgcolor       = "bgcolor";
135
136    /** String containing the XHTML 'checked' attribute name (i.e., 'checked'). */
137    public static final String ATTR_checked       = "checked";
138    
139    /** String containing the XHTML 'cols' attribute name (i.e., 'cols'). */
140    public static final String ATTR_cols          = "cols";
141    
142    /** String containing the XHTML 'content' attribute name (i.e., 'content'). */
143    public static final String ATTR_content       = "content";
144
145    /** String containing the XHTML 'http-equiv' attribute name (i.e., 'http-equiv'). */
146    public static final String ATTR_httpEquiv     = "http-equiv";
147
148    /** String containing the XHTML 'scheme' attribute name (i.e., 'scheme'). */
149    public static final String ATTR_scheme        = "scheme";
150
151    /** String containing the XHTML 'rel' attribute name (i.e., 'rel'). */
152    public static final String ATTR_rel           = "rel";
153
154    /** String containing the XHTML 'rows' attribute name (i.e., 'rows'). */
155    public static final String ATTR_rows          = "rows";
156    
157    /** String containing the XHTML 'selected' attribute name (i.e., 'selected'). */
158    public static final String ATTR_selected      = "selected";
159    
160    /** String containing the XHTML 'size' attribute name (i.e., 'size'). */
161    public static final String ATTR_size          = "size";
162    
163    /** String containing the XHTML 'style' attribute name (i.e., 'style'). */
164    public static final String ATTR_style         = "style";
165
166    /** String containing the XHTML 'align' attribute name (i.e., 'align'). */
167    public static final String ATTR_align         = "align";
168
169    /** String containing the XHTML 'cellpadding' attribute name (i.e., 'cellpadding'). */
170    public static final String ATTR_cellpadding   = "cellpadding";
171    
172    /** String containing the XHTML 'cellspacing' attribute name (i.e., 'cellspacing'). */
173    public static final String ATTR_cellspacing   = "cellspacing";
174
175    // XHTML character entities ...........................................
176
177    /**
178     *  Returns a String containing the named character entity corresponding to
179     *  the character number <tt>num</tt> for the range 160-255. Throws an 
180     *  ArrayOutOfBoundsException if beyond the prescribed range.
181     */
182    public static String getNamedCharacterEntity(final int num )
183    {
184        return CHARACTER_ENTITIES[num-160];
185    }
186
187    /* Conversion table for the XHTML upper ASCII character entities (character numbers 160-255). */
188    private static final String[] CHARACTER_ENTITIES = {
189        "nbsp" /* 160 */,   "iexcl" /* 161 */,  "cent" /* 162 */,   "pound" /* 163 */,
190        "curren" /* 164 */, "yen" /* 165 */,    "brvbar" /* 166 */, "sect" /* 167 */,
191        "uml" /* 168 */,    "copy" /* 169 */,   "ordf" /* 170 */,   "laquo" /* 171 */,
192        "not" /* 172 */,    "shy" /* 173 */,    "reg" /* 174 */,    "macr" /* 175 */,
193        "deg" /* 176 */,    "plusmn" /* 177 */, "sup2" /* 178 */,   "sup3" /* 179 */,
194        "acute" /* 180 */,  "micro" /* 181 */,  "para" /* 182 */,   "middot" /* 183 */,
195        "cedil" /* 184 */,  "sup1" /* 185 */,   "ordm" /* 186 */,   "raquo" /* 187 */,
196        "frac14" /* 188 */, "frac12" /* 189 */, "frac34" /* 190 */, "iquest" /* 191 */,
197        "Agrave" /* 192 */, "Aacute" /* 193 */, "Acirc" /* 194 */,  "Atilde" /* 195 */,
198        "Auml" /* 196 */,   "Aring" /* 197 */,  "AElig" /* 198 */,  "Ccedil" /* 199 */,
199        "Egrave" /* 200 */, "Eacute" /* 201 */, "Ecirc" /* 202 */,  "Euml" /* 203 */,
200        "Igrave" /* 204 */, "Iacute" /* 205 */, "Icirc" /* 206 */,  "Iuml" /* 207 */,
201        "ETH" /* 208 */,    "Ntilde" /* 209 */, "Ograve" /* 210 */, "Oacute" /* 211 */,
202        "Ocirc" /* 212 */,  "Otilde" /* 213 */, "Ouml" /* 214 */,   "times" /* 215 */,
203        "Oslash" /* 216 */, "Ugrave" /* 217 */, "Uacute" /* 218 */, "Ucirc" /* 219 */,
204        "Uuml" /* 220 */,   "Yacute" /* 221 */, "THORN" /* 222 */,  "szlig" /* 223 */,
205        "agrave" /* 224 */, "aacute" /* 225 */, "acirc" /* 226 */,  "atilde" /* 227 */,
206        "auml" /* 228 */,   "aring" /* 229 */,  "aelig" /* 230 */,  "ccedil" /* 231 */,
207        "egrave" /* 232 */, "eacute" /* 233 */, "ecirc" /* 234 */,  "euml" /* 235 */,
208        "igrave" /* 236 */, "iacute" /* 237 */, "icirc" /* 238 */,  "iuml" /* 239 */,
209        "eth" /* 240 */,    "ntilde" /* 241 */, "ograve" /* 242 */, "oacute" /* 243 */,
210        "ocirc" /* 244 */,  "otilde" /* 245 */, "ouml" /* 246 */,   "divide" /* 247 */,
211        "oslash" /* 248 */, "ugrave" /* 249 */, "uacute" /* 250 */, "ucirc" /* 251 */,
212        "uuml" /* 252 */,   "yacute" /* 253 */, "thorn" /* 254 */,  "yuml" /* 255 */ };
213
214} // end org.apache.wiki.util.XHTML