com.hfg.xml.parser.SpecialCharacterEntities Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com_hfg Show documentation
Show all versions of com_hfg Show documentation
com.hfg xml, html, svg, and bioinformatics utility library
package com.hfg.xml.parser;
import java.util.HashMap;
//------------------------------------------------------------------------------
/**
Lookup class for the character entities defined in XHTML1-special.ent
@author J. Alex Taylor, hairyfatguy.com
*/
//------------------------------------------------------------------------------
// com.hfg XML/HTML Coding Library
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
// [email protected]
//------------------------------------------------------------------------------
public class SpecialCharacterEntities
{
private static HashMap sEntityMap = new HashMap<>(35);
static
{
// CO Controls and Basic Latin
sEntityMap.put("quot", "#34");
sEntityMap.put("amp", "#38");
sEntityMap.put("apos", "#39");
sEntityMap.put("lt", "#60");
sEntityMap.put("gt", "#62");
// Latin Extended-A
sEntityMap.put("OElig", "#338");
sEntityMap.put("oelig", "#339");
sEntityMap.put("Scaron", "#352");
sEntityMap.put("scaron", "#353");
sEntityMap.put("Yuml", "#376");
// Spacing Modifier Letters
sEntityMap.put("circ", "#710");
sEntityMap.put("tilde", "#732");
// General Punctuation
sEntityMap.put("ensp", "#8194");
sEntityMap.put("emsp", "#8195");
sEntityMap.put("thinsp", "#8201");
sEntityMap.put("zwnj", "#8204");
sEntityMap.put("zwj", "#8205");
sEntityMap.put("lrm", "#8206");
sEntityMap.put("rlm", "#8207");
sEntityMap.put("ndash", "#8211");
sEntityMap.put("mdash", "#8212");
sEntityMap.put("lsquo", "#8216");
sEntityMap.put("rsquo", "#8217");
sEntityMap.put("sbquo", "#8218");
sEntityMap.put("ldquo", "#8220");
sEntityMap.put("rdquo", "#8221");
sEntityMap.put("bdquo", "#8222");
sEntityMap.put("dagger", "#8224");
sEntityMap.put("Dagger", "#8225");
sEntityMap.put("permil", "#8240");
sEntityMap.put("lsaquo", "#8249");
sEntityMap.put("rsaquo", "#8250");
sEntityMap.put("euro", "#8364");
}
//---------------------------------------------------------------------------
/**
@param inEntity String such as 'quot' from the character entity '"'
@return String with the Unicode character representation (ex: '#34' given 'quot' as input).
*/
public static String resolveEntity(String inEntity)
{
return (String) sEntityMap.get(inEntity);
}
}