1 package org.apache.maven.archiva.xml;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import java.util.HashMap;
26 * LatinEntities - simple utility class to handle latin entity conversion.
30 public class LatinEntities
32 private static final Map defaultEntityMap;
36 defaultEntityMap = new HashMap();
38 defaultEntityMap.put( "nbsp", "\u00a0" );
39 defaultEntityMap.put( "iexcl", "\u00a1" );
40 defaultEntityMap.put( "cent", "\u00a2" );
41 defaultEntityMap.put( "pound", "\u00a3" );
42 defaultEntityMap.put( "curren", "\u00a4" );
43 defaultEntityMap.put( "yen", "\u00a5" );
44 defaultEntityMap.put( "brvbar", "\u00a6" );
45 defaultEntityMap.put( "sect", "\u00a7" );
46 defaultEntityMap.put( "uml", "\u00a8" );
47 defaultEntityMap.put( "copy", "\u00a9" );
48 defaultEntityMap.put( "ordf", "\u00aa" );
49 defaultEntityMap.put( "laquo", "\u00ab" );
50 defaultEntityMap.put( "not", "\u00ac" );
51 defaultEntityMap.put( "shy", "\u00ad" );
52 defaultEntityMap.put( "reg", "\u00ae" );
53 defaultEntityMap.put( "macr", "\u00af" );
54 defaultEntityMap.put( "deg", "\u00b0" );
55 defaultEntityMap.put( "plusmn", "\u00b1" );
56 defaultEntityMap.put( "sup2", "\u00b2" );
57 defaultEntityMap.put( "sup3", "\u00b3" );
58 defaultEntityMap.put( "acute", "\u00b4" );
59 defaultEntityMap.put( "micro", "\u00b5" );
60 defaultEntityMap.put( "para", "\u00b6" );
61 defaultEntityMap.put( "middot", "\u00b7" );
62 defaultEntityMap.put( "cedil", "\u00b8" );
63 defaultEntityMap.put( "sup1", "\u00b9" );
64 defaultEntityMap.put( "ordm", "\u00ba" );
65 defaultEntityMap.put( "raquo", "\u00bb" );
66 defaultEntityMap.put( "frac14", "\u00bc" );
67 defaultEntityMap.put( "frac12", "\u00bd" );
68 defaultEntityMap.put( "frac34", "\u00be" );
69 defaultEntityMap.put( "iquest", "\u00bf" );
70 defaultEntityMap.put( "Agrave", "\u00c0" );
71 defaultEntityMap.put( "Aacute", "\u00c1" );
72 defaultEntityMap.put( "Acirc", "\u00c2" );
73 defaultEntityMap.put( "Atilde", "\u00c3" );
74 defaultEntityMap.put( "Auml", "\u00c4" );
75 defaultEntityMap.put( "Aring", "\u00c5" );
76 defaultEntityMap.put( "AElig", "\u00c6" );
77 defaultEntityMap.put( "Ccedil", "\u00c7" );
78 defaultEntityMap.put( "Egrave", "\u00c8" );
79 defaultEntityMap.put( "Eacute", "\u00c9" );
80 defaultEntityMap.put( "Ecirc", "\u00ca" );
81 defaultEntityMap.put( "Euml", "\u00cb" );
82 defaultEntityMap.put( "Igrave", "\u00cc" );
83 defaultEntityMap.put( "Iacute", "\u00cd" );
84 defaultEntityMap.put( "Icirc", "\u00ce" );
85 defaultEntityMap.put( "Iuml", "\u00cf" );
86 defaultEntityMap.put( "ETH", "\u00d0" );
87 defaultEntityMap.put( "Ntilde", "\u00d1" );
88 defaultEntityMap.put( "Ograve", "\u00d2" );
89 defaultEntityMap.put( "Oacute", "\u00d3" );
90 defaultEntityMap.put( "Ocirc", "\u00d4" );
91 defaultEntityMap.put( "Otilde", "\u00d5" );
92 defaultEntityMap.put( "Ouml", "\u00d6" );
93 defaultEntityMap.put( "times", "\u00d7" );
94 defaultEntityMap.put( "Oslash", "\u00d8" );
95 defaultEntityMap.put( "Ugrave", "\u00d9" );
96 defaultEntityMap.put( "Uacute", "\u00da" );
97 defaultEntityMap.put( "Ucirc", "\u00db" );
98 defaultEntityMap.put( "Uuml", "\u00dc" );
99 defaultEntityMap.put( "Yacute", "\u00dd" );
100 defaultEntityMap.put( "THORN", "\u00de" );
101 defaultEntityMap.put( "szlig", "\u00df" );
102 defaultEntityMap.put( "agrave", "\u00e0" );
103 defaultEntityMap.put( "aacute", "\u00e1" );
104 defaultEntityMap.put( "acirc", "\u00e2" );
105 defaultEntityMap.put( "atilde", "\u00e3" );
106 defaultEntityMap.put( "auml", "\u00e4" );
107 defaultEntityMap.put( "aring", "\u00e5" );
108 defaultEntityMap.put( "aelig", "\u00e6" );
109 defaultEntityMap.put( "ccedil", "\u00e7" );
110 defaultEntityMap.put( "egrave", "\u00e8" );
111 defaultEntityMap.put( "eacute", "\u00e9" );
112 defaultEntityMap.put( "ecirc", "\u00ea" );
113 defaultEntityMap.put( "euml", "\u00eb" );
114 defaultEntityMap.put( "igrave", "\u00ec" );
115 defaultEntityMap.put( "iacute", "\u00ed" );
116 defaultEntityMap.put( "icirc", "\u00ee" );
117 defaultEntityMap.put( "iuml", "\u00ef" );
118 defaultEntityMap.put( "eth", "\u00f0" );
119 defaultEntityMap.put( "ntilde", "\u00f1" );
120 defaultEntityMap.put( "ograve", "\u00f2" );
121 defaultEntityMap.put( "oacute", "\u00f3" );
122 defaultEntityMap.put( "ocirc", "\u00f4" );
123 defaultEntityMap.put( "otilde", "\u00f5" );
124 defaultEntityMap.put( "ouml", "\u00f6" );
125 defaultEntityMap.put( "divide", "\u00f7" );
126 defaultEntityMap.put( "oslash", "\u00f8" );
127 defaultEntityMap.put( "ugrave", "\u00f9" );
128 defaultEntityMap.put( "uacute", "\u00fa" );
129 defaultEntityMap.put( "ucirc", "\u00fb" );
130 defaultEntityMap.put( "uuml", "\u00fc" );
131 defaultEntityMap.put( "yacute", "\u00fd" );
132 defaultEntityMap.put( "thorn", "\u00fe" );
133 defaultEntityMap.put( "yuml", "\u00ff" );
135 // ----------------------------------------------------------------------
137 // ----------------------------------------------------------------------
139 defaultEntityMap.put( "OElig", "\u0152" );
140 defaultEntityMap.put( "oelig", "\u0153" );
141 defaultEntityMap.put( "Scaron", "\u0160" );
142 defaultEntityMap.put( "scaron", "\u0161" );
143 defaultEntityMap.put( "Yuml", "\u0178" );
144 defaultEntityMap.put( "circ", "\u02c6" );
145 defaultEntityMap.put( "tilde", "\u02dc" );
146 defaultEntityMap.put( "ensp", "\u2002" );
147 defaultEntityMap.put( "emsp", "\u2003" );
148 defaultEntityMap.put( "thinsp", "\u2009" );
149 defaultEntityMap.put( "zwnj", "\u200c" );
150 defaultEntityMap.put( "zwj", "\u200d" );
151 defaultEntityMap.put( "lrm", "\u200e" );
152 defaultEntityMap.put( "rlm", "\u200f" );
153 defaultEntityMap.put( "ndash", "\u2013" );
154 defaultEntityMap.put( "mdash", "\u2014" );
155 defaultEntityMap.put( "lsquo", "\u2018" );
156 defaultEntityMap.put( "rsquo", "\u2019" );
157 defaultEntityMap.put( "sbquo", "\u201a" );
158 defaultEntityMap.put( "ldquo", "\u201c" );
159 defaultEntityMap.put( "rdquo", "\u201d" );
160 defaultEntityMap.put( "bdquo", "\u201e" );
161 defaultEntityMap.put( "dagger", "\u2020" );
162 defaultEntityMap.put( "Dagger", "\u2021" );
163 defaultEntityMap.put( "permil", "\u2030" );
164 defaultEntityMap.put( "lsaquo", "\u2039" );
165 defaultEntityMap.put( "rsaquo", "\u203a" );
166 defaultEntityMap.put( "euro", "\u20ac" );
168 // ----------------------------------------------------------------------
170 // ----------------------------------------------------------------------
172 defaultEntityMap.put( "fnof", "\u0192" );
173 defaultEntityMap.put( "Alpha", "\u0391" );
174 defaultEntityMap.put( "Beta", "\u0392" );
175 defaultEntityMap.put( "Gamma", "\u0393" );
176 defaultEntityMap.put( "Delta", "\u0394" );
177 defaultEntityMap.put( "Epsilon", "\u0395" );
178 defaultEntityMap.put( "Zeta", "\u0396" );
179 defaultEntityMap.put( "Eta", "\u0397" );
180 defaultEntityMap.put( "Theta", "\u0398" );
181 defaultEntityMap.put( "Iota", "\u0399" );
182 defaultEntityMap.put( "Kappa", "\u039a" );
183 defaultEntityMap.put( "Lambda", "\u039b" );
184 defaultEntityMap.put( "Mu", "\u039c" );
185 defaultEntityMap.put( "Nu", "\u039d" );
186 defaultEntityMap.put( "Xi", "\u039e" );
187 defaultEntityMap.put( "Omicron", "\u039f" );
188 defaultEntityMap.put( "Pi", "\u03a0" );
189 defaultEntityMap.put( "Rho", "\u03a1" );
190 defaultEntityMap.put( "Sigma", "\u03a3" );
191 defaultEntityMap.put( "Tau", "\u03a4" );
192 defaultEntityMap.put( "Upsilon", "\u03a5" );
193 defaultEntityMap.put( "Phi", "\u03a6" );
194 defaultEntityMap.put( "Chi", "\u03a7" );
195 defaultEntityMap.put( "Psi", "\u03a8" );
196 defaultEntityMap.put( "Omega", "\u03a9" );
197 defaultEntityMap.put( "alpha", "\u03b1" );
198 defaultEntityMap.put( "beta", "\u03b2" );
199 defaultEntityMap.put( "gamma", "\u03b3" );
200 defaultEntityMap.put( "delta", "\u03b4" );
201 defaultEntityMap.put( "epsilon", "\u03b5" );
202 defaultEntityMap.put( "zeta", "\u03b6" );
203 defaultEntityMap.put( "eta", "\u03b7" );
204 defaultEntityMap.put( "theta", "\u03b8" );
205 defaultEntityMap.put( "iota", "\u03b9" );
206 defaultEntityMap.put( "kappa", "\u03ba" );
207 defaultEntityMap.put( "lambda", "\u03bb" );
208 defaultEntityMap.put( "mu", "\u03bc" );
209 defaultEntityMap.put( "nu", "\u03bd" );
210 defaultEntityMap.put( "xi", "\u03be" );
211 defaultEntityMap.put( "omicron", "\u03bf" );
212 defaultEntityMap.put( "pi", "\u03c0" );
213 defaultEntityMap.put( "rho", "\u03c1" );
214 defaultEntityMap.put( "sigmaf", "\u03c2" );
215 defaultEntityMap.put( "sigma", "\u03c3" );
216 defaultEntityMap.put( "tau", "\u03c4" );
217 defaultEntityMap.put( "upsilon", "\u03c5" );
218 defaultEntityMap.put( "phi", "\u03c6" );
219 defaultEntityMap.put( "chi", "\u03c7" );
220 defaultEntityMap.put( "psi", "\u03c8" );
221 defaultEntityMap.put( "omega", "\u03c9" );
222 defaultEntityMap.put( "thetasym", "\u03d1" );
223 defaultEntityMap.put( "upsih", "\u03d2" );
224 defaultEntityMap.put( "piv", "\u03d6" );
225 defaultEntityMap.put( "bull", "\u2022" );
226 defaultEntityMap.put( "hellip", "\u2026" );
227 defaultEntityMap.put( "prime", "\u2032" );
228 defaultEntityMap.put( "Prime", "\u2033" );
229 defaultEntityMap.put( "oline", "\u203e" );
230 defaultEntityMap.put( "frasl", "\u2044" );
231 defaultEntityMap.put( "weierp", "\u2118" );
232 defaultEntityMap.put( "image", "\u2111" );
233 defaultEntityMap.put( "real", "\u211c" );
234 defaultEntityMap.put( "trade", "\u2122" );
235 defaultEntityMap.put( "alefsym", "\u2135" );
236 defaultEntityMap.put( "larr", "\u2190" );
237 defaultEntityMap.put( "uarr", "\u2191" );
238 defaultEntityMap.put( "rarr", "\u2192" );
239 defaultEntityMap.put( "darr", "\u2193" );
240 defaultEntityMap.put( "harr", "\u2194" );
241 defaultEntityMap.put( "crarr", "\u21b5" );
242 defaultEntityMap.put( "lArr", "\u21d0" );
243 defaultEntityMap.put( "uArr", "\u21d1" );
244 defaultEntityMap.put( "rArr", "\u21d2" );
245 defaultEntityMap.put( "dArr", "\u21d3" );
246 defaultEntityMap.put( "hArr", "\u21d4" );
247 defaultEntityMap.put( "forall", "\u2200" );
248 defaultEntityMap.put( "part", "\u2202" );
249 defaultEntityMap.put( "exist", "\u2203" );
250 defaultEntityMap.put( "empty", "\u2205" );
251 defaultEntityMap.put( "nabla", "\u2207" );
252 defaultEntityMap.put( "isin", "\u2208" );
253 defaultEntityMap.put( "notin", "\u2209" );
254 defaultEntityMap.put( "ni", "\u220b" );
255 defaultEntityMap.put( "prod", "\u220f" );
256 defaultEntityMap.put( "sum", "\u2211" );
257 defaultEntityMap.put( "minus", "\u2212" );
258 defaultEntityMap.put( "lowast", "\u2217" );
259 defaultEntityMap.put( "radic", "\u221a" );
260 defaultEntityMap.put( "prop", "\u221d" );
261 defaultEntityMap.put( "infin", "\u221e" );
262 defaultEntityMap.put( "ang", "\u2220" );
263 defaultEntityMap.put( "and", "\u2227" );
264 defaultEntityMap.put( "or", "\u2228" );
265 defaultEntityMap.put( "cap", "\u2229" );
266 defaultEntityMap.put( "cup", "\u222a" );
267 defaultEntityMap.put( "int", "\u222b" );
268 defaultEntityMap.put( "there4", "\u2234" );
269 defaultEntityMap.put( "sim", "\u223c" );
270 defaultEntityMap.put( "cong", "\u2245" );
271 defaultEntityMap.put( "asymp", "\u2248" );
272 defaultEntityMap.put( "ne", "\u2260" );
273 defaultEntityMap.put( "equiv", "\u2261" );
274 defaultEntityMap.put( "le", "\u2264" );
275 defaultEntityMap.put( "ge", "\u2265" );
276 defaultEntityMap.put( "sub", "\u2282" );
277 defaultEntityMap.put( "sup", "\u2283" );
278 defaultEntityMap.put( "nsub", "\u2284" );
279 defaultEntityMap.put( "sube", "\u2286" );
280 defaultEntityMap.put( "supe", "\u2287" );
281 defaultEntityMap.put( "oplus", "\u2295" );
282 defaultEntityMap.put( "otimes", "\u2297" );
283 defaultEntityMap.put( "perp", "\u22a5" );
284 defaultEntityMap.put( "sdot", "\u22c5" );
285 defaultEntityMap.put( "lceil", "\u2308" );
286 defaultEntityMap.put( "rceil", "\u2309" );
287 defaultEntityMap.put( "lfloor", "\u230a" );
288 defaultEntityMap.put( "rfloor", "\u230b" );
289 defaultEntityMap.put( "lang", "\u2329" );
290 defaultEntityMap.put( "rang", "\u232a" );
291 defaultEntityMap.put( "loz", "\u25ca" );
292 defaultEntityMap.put( "spades", "\u2660" );
293 defaultEntityMap.put( "clubs", "\u2663" );
294 defaultEntityMap.put( "hearts", "\u2665" );
295 defaultEntityMap.put( "diams", "\u2666" );
298 public static String resolveEntity( String entity )
300 if ( entity == null )
306 if ( entity.trim().length() <= 0 )
312 if ( !( entity.charAt( 0 ) == '&' ) && ( entity.charAt( entity.length() ) == ';' ) )
314 // Invalid, not an entity.
318 String result = (String) defaultEntityMap.get( entity.substring( 1, entity.length() - 1 ) );
319 if ( result == null )