Debian Codegraph @

src/com/nwalsh/saxon/Windows1252.java

raw symbols SCIP
1 /* This file was kindly provided by Sectra AB, Sweden to DocBook community */
2 package com.nwalsh.saxon;
3
4 import com.icl.saxon.charcode.PluggableCharacterSet;
5
6 /**
7 *
8 * $Id: Windows1252.java 7277 2007-08-23 05:10:07Z xmldoc $
9 *
10 * File: Windows1252CharacterSet.java
11 * Created: May 26 2004
12 * Author: Pontus Haglund
13 * Project: Venus
14 *
15 * This class extends Saxon 6.5.x with the windows-1252 character set.
16 *
17 * It is particularly useful when generating HTML Help for
18 * Western European Languages.
19 *
20 * To use this class for generating HTML Help output with the
21 * DocBook XSL stylesheets, complete the following steps:
22 *
23 * 1. Make sure that the Saxon 6.5.x jar file and the jar file for
24 * the DocBook Saxon extensions are in your CLASSPATH
25 *
26 * 2. Create a DocBook XSL customization layer -- a file named
27 * "mystylesheet.xsl" or whatever -- that, at a minimum,
28 * contains the following:
29 *
30 * <xsl:stylesheet
31 * xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
32 * version='1.0'>
33 * <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl"/>
34 * <xsl:output method="html" encoding="WINDOWS-1252" indent="no"/>
35 * <xsl:param name="htmlhelp.encoding" select="'WINDOWS-1252'"></xsl:param>
36 * <xsl:param name="chunker.output.encoding" select="'WINDOWS-1252'"></xsl:param>
37 * <xsl:param name="saxon.character.representation" select="'native'"></xsl:param>
38 * </xsl:stylesheet>
39 *
40 * 3. Invoke Saxon with the "encoding.windows-1252" Java system
41 * property set to "com.nwalsh.saxon.Windows1252"; for example:
42 *
43 * java \
44 * -Dencoding.windows-1252=com.nwalsh.saxon.Windows1252 \
45 * com.icl.saxon.StyleSheet \
46 * mydoc.xml mystylesheet.xsl
47 *
48 * Or, for a more complete "real world" case showing other
49 * options you'll typically want to use:
50 *
51 * java \
52 * -Dencoding.windows-1252=com.nwalsh.saxon.Windows1252 \
53 * -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl \
54 * -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl \
55 * -Djavax.xml.transform.TransformerFactory=com.icl.saxon.TransformerFactoryImpl \
56 * com.icl.saxon.StyleSheet \
57 * -x org.apache.xml.resolver.tools.ResolvingXMLReader \
58 * -y org.apache.xml.resolver.tools.ResolvingXMLReader \
59 * -r org.apache.xml.resolver.tools.CatalogResolver \
60 * mydoc.xml mystylesheet.xsl
61 *
62 * In both cases, the "mystylesheet.xsl" file should be a DocBook
63 * customization layer containing the parameters show in step 2.
64 *
65 */
66
67 public class Windows1252 implements PluggableCharacterSet {
68
69 public final boolean inCharset(int c) {
70
71 return (c >= 0x00 && c <= 0x7F) ||
72 (c >= 0xA0 && c <= 0xFF) ||
73 (c == 0x20AC) ||
74 (c == 0x201A) ||
75 (c == 0x0192) ||
76 (c == 0x201E) ||
77 (c == 0x2026) ||
78 (c == 0x2020) ||
79 (c == 0x2021) ||
80 (c == 0x02C6) ||
81 (c == 0x2030) ||
82 (c == 0x0160) ||
83 (c == 0x2039) ||
84 (c == 0x0152) ||
85 (c == 0x017D) ||
86 (c == 0x2018) ||
87 (c == 0x2019) ||
88 (c == 0x201C) ||
89 (c == 0x201D) ||
90 (c == 0x2022) ||
91 (c == 0x2013) ||
92 (c == 0x2014) ||
93 (c == 0x02DC) ||
94 (c == 0x2122) ||
95 (c == 0x0161) ||
96 (c == 0x203A) ||
97 (c == 0x0153) ||
98 (c == 0x017E) ||
99 (c == 0x0178);
100
101
102 }
103
104 public String getEncodingName() {
105 return "WINDOWS-1252";
106 }
107
108 }