##### Coverage Report - org.jaxen.saxpath.base.Verifier

Classes in this File | Line Coverage | Branch Coverage | Complexity
Verifier |
97% |
98% |
| 188.66666666666666;188.667

1 |  |
     /*--
2 |  |
3 |  |
      $Id$
4 |  |
5 |  |
      Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin.
6 |  |
      All rights reserved.
7 |  |
8 |  |
      Redistribution and use in source and binary forms, with or without
9 |  |
      modification, are permitted provided that the following conditions
10 |  |
      are met:
11 |  |
12 |  |
      1. Redistributions of source code must retain the above copyright
13 |  |
         notice, this list of conditions, and the following disclaimer.
14 |  |
15 |  |
      2. Redistributions in binary form must reproduce the above copyright
16 |  |
         notice, this list of conditions, and the disclaimer that follows
17 |  |
         these conditions in the documentation and/or other materials
18 |  |
         provided with the distribution.
19 |  |
20 |  |
      3. The name "JDOM" must not be used to endorse or promote products
21 |  |
         derived from this software without prior written permission.  For
22 |  |
         written permission, please contact <request_AT_jdom_DOT_org>.
23 |  |
24 |  |
      4. Products derived from this software may not be called "JDOM", nor
25 |  |
         may "JDOM" appear in their name, without prior written permission
26 |  |
         from the JDOM Project Management <request_AT_jdom_DOT_org>.
27 |  |
28 |  |
      In addition, we request (but do not require) that you include in the
29 |  |
      end-user documentation provided with the redistribution and/or in the
30 |  |
      software itself an acknowledgement equivalent to the following:
31 |  |
          "This product includes software developed by the
32 |  |
           JDOM Project (http://www.jdom.org/)."
33 |  |
      Alternatively, the acknowledgment may be graphical using the logos
34 |  |
      available at http://www.jdom.org/images/logos.
35 |  |
36 |  |
      THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37 |  |
      WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38 |  |
      OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39 |  |
      DISCLAIMED.  IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
40 |  |
      CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 |  |
      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42 |  |
      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43 |  |
      USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44 |  |
      ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45 |  |
      OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46 |  |
      OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 |  |
      SUCH DAMAGE.
48 |  |
49 |  |
      This software consists of voluntary contributions made by many
50 |  |
      individuals on behalf of the JDOM Project and was originally
51 |  |
      created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
52 |  |
      Brett McLaughlin <brett_AT_jdom_DOT_org>.  For more information
53 |  |
      on the JDOM Project, please see <http://www.jdom.org/>.
54 |  |
55 |  |
      */
56 |  |
57 |  |
     package org.jaxen.saxpath.base;
58 |  |
59 |  |
     /**
60 |  |
      * A utility class to handle well-formedness checks on names.
61 |  |
      *
62 |  |
      * @author  Brett McLaughlin
63 |  |
      * @author  Elliotte Rusty Harold
64 |  |
      * @author  Jason Hunter
65 |  |
      * @author  Bradley S. Huffman
66 |  |
      */
67 | 0 |
     final class Verifier {
68 |  |
69 |  |
         /**
70 |  |
          * This is a utility function for determining whether a specified
71 |  |
          * character is a name character according to production 4 of the
72 |  |
          * XML 1.0 specification.
73 |  |
          *
74 |  |
          * @param c <code>char</code> to check for XML name compliance.
75 |  |
          * @return <code>boolean</code> true if it's a name character,
76 |  |
          *                                false otherwise
77 |  |
          */
78 |  |
          static boolean isXMLNCNameCharacter(char c) {
79 |  |
80 | 140274 |
           return (isXMLLetter(c) || isXMLDigit(c) || c == '.' || c == '-'
81 |  |
                                  || c == '_' || isXMLCombiningChar(c)
82 |  |
                                  || isXMLExtender(c));
83 |  |
         }
84 |  |
85 |  |
         /**
86 |  |
          * This is a utility function for determining whether a specified
87 |  |
          * character is a legal name start character according to production 5
88 |  |
          * of the XML 1.0 specification. This production does allow names
89 |  |
          * to begin with colons which the Namespaces in XML Recommendation
90 |  |
          * disallows.
91 |  |
          *
92 |  |
          * @param c <code>char</code> to check for XML name start compliance
93 |  |
          * @return true if it's a name start character, false otherwise
94 |  |
          */
95 |  |
         static boolean isXMLNCNameStartCharacter(char c) {
96 |  |
97 | 35370 |
           return (isXMLLetter(c) || c == '_');
98 |  |
99 |  |
         }
100 |  |
101 |  |
         /**
102 |  |
          * Determine whether a specified character
103 |  |
          * is a letter according to production 84 of the XML 1.0 specification.
104 |  |
          *
105 |  |
          * @param c <code>char</code> to check for XML name compliance
106 |  |
          * @return <code>String</code> true if it's a letter, false otherwise
107 |  |
          */
108 |  |
         static boolean isXMLLetter(char c) {
109 |  |
             // Note that order is very important here.  The search proceeds
110 |  |
             // from lowest to highest values, so that no searching occurs
111 |  |
             // above the character's value.  BTW, the first line is equivalent to:
112 |  |
             // if (c >= 0x0041 && c <= 0x005A) return true;
113 |  |
114 | 175644 |
             if (c < 0x0041) return false;  if (c <= 0x005a) return true;
115 | 151986 |
             if (c < 0x0061) return false;  if (c <= 0x007A) return true;
116 | 14448 |
             if (c < 0x00C0) return false;  if (c <= 0x00D6) return true;
117 | 14430 |
             if (c < 0x00D8) return false;  if (c <= 0x00F6) return true;
118 | 14430 |
             if (c < 0x00F8) return false;  if (c <= 0x00FF) return true;
119 | 14430 |
             if (c < 0x0100) return false;  if (c <= 0x0131) return true;
120 | 14430 |
             if (c < 0x0134) return false;  if (c <= 0x013E) return true;
121 | 14430 |
             if (c < 0x0141) return false;  if (c <= 0x0148) return true;
122 | 14430 |
             if (c < 0x014A) return false;  if (c <= 0x017E) return true;
123 | 14430 |
             if (c < 0x0180) return false;  if (c <= 0x01C3) return true;
124 | 14430 |
             if (c < 0x01CD) return false;  if (c <= 0x01F0) return true;
125 | 14430 |
             if (c < 0x01F4) return false;  if (c <= 0x01F5) return true;
126 | 14430 |
             if (c < 0x01FA) return false;  if (c <= 0x0217) return true;
127 | 14430 |
             if (c < 0x0250) return false;  if (c <= 0x02A8) return true;
128 | 14430 |
             if (c < 0x02BB) return false;  if (c <= 0x02C1) return true;
129 | 14430 |
             if (c == 0x0386) return true;
130 | 14430 |
             if (c < 0x0388) return false;  if (c <= 0x038A) return true;
131 | 14430 |
             if (c == 0x038C) return true;
132 | 14430 |
             if (c < 0x038E) return false;  if (c <= 0x03A1) return true;
133 | 14430 |
             if (c < 0x03A3) return false;  if (c <= 0x03CE) return true;
134 | 14430 |
             if (c < 0x03D0) return false;  if (c <= 0x03D6) return true;
135 | 14430 |
             if (c == 0x03DA) return true;
136 | 14430 |
             if (c == 0x03DC) return true;
137 | 14430 |
             if (c == 0x03DE) return true;
138 | 14430 |
             if (c == 0x03E0) return true;
139 | 14430 |
             if (c < 0x03E2) return false;  if (c <= 0x03F3) return true;
140 | 14430 |
             if (c < 0x0401) return false;  if (c <= 0x040C) return true;
141 | 14430 |
             if (c < 0x040E) return false;  if (c <= 0x044F) return true;
142 | 14430 |
             if (c < 0x0451) return false;  if (c <= 0x045C) return true;
143 | 14430 |
             if (c < 0x045E) return false;  if (c <= 0x0481) return true;
144 | 14430 |
             if (c < 0x0490) return false;  if (c <= 0x04C4) return true;
145 | 14430 |
             if (c < 0x04C7) return false;  if (c <= 0x04C8) return true;
146 | 14430 |
             if (c < 0x04CB) return false;  if (c <= 0x04CC) return true;
147 | 14430 |
             if (c < 0x04D0) return false;  if (c <= 0x04EB) return true;
148 | 14430 |
             if (c < 0x04EE) return false;  if (c <= 0x04F5) return true;
149 | 14430 |
             if (c < 0x04F8) return false;  if (c <= 0x04F9) return true;
150 | 14430 |
             if (c < 0x0531) return false;  if (c <= 0x0556) return true;
151 | 14430 |
             if (c == 0x0559) return true;
152 | 14430 |
             if (c < 0x0561) return false;  if (c <= 0x0586) return true;
153 | 14430 |
             if (c < 0x05D0) return false;  if (c <= 0x05EA) return true;
154 | 14430 |
             if (c < 0x05F0) return false;  if (c <= 0x05F2) return true;
155 | 14430 |
             if (c < 0x0621) return false;  if (c <= 0x063A) return true;
156 | 14430 |
             if (c < 0x0641) return false;  if (c <= 0x064A) return true;
157 | 14430 |
             if (c < 0x0671) return false;  if (c <= 0x06B7) return true;
158 | 14430 |
             if (c < 0x06BA) return false;  if (c <= 0x06BE) return true;
159 | 14430 |
             if (c < 0x06C0) return false;  if (c <= 0x06CE) return true;
160 | 14430 |
             if (c < 0x06D0) return false;  if (c <= 0x06D3) return true;
161 | 14430 |
             if (c == 0x06D5) return true;
162 | 14430 |
             if (c < 0x06E5) return false;  if (c <= 0x06E6) return true;
163 | 14430 |
             if (c < 0x0905) return false;  if (c <= 0x0939) return true;
164 | 14430 |
             if (c == 0x093D) return true;
165 | 14430 |
             if (c < 0x0958) return false;  if (c <= 0x0961) return true;
166 | 14430 |
             if (c < 0x0985) return false;  if (c <= 0x098C) return true;
167 | 14430 |
             if (c < 0x098F) return false;  if (c <= 0x0990) return true;
168 | 14430 |
             if (c < 0x0993) return false;  if (c <= 0x09A8) return true;
169 | 14430 |
             if (c < 0x09AA) return false;  if (c <= 0x09B0) return true;
170 | 14430 |
             if (c == 0x09B2) return true;
171 | 14430 |
             if (c < 0x09B6) return false;  if (c <= 0x09B9) return true;
172 | 14430 |
             if (c < 0x09DC) return false;  if (c <= 0x09DD) return true;
173 | 14430 |
             if (c < 0x09DF) return false;  if (c <= 0x09E1) return true;
174 | 14430 |
             if (c < 0x09F0) return false;  if (c <= 0x09F1) return true;
175 | 14430 |
             if (c < 0x0A05) return false;  if (c <= 0x0A0A) return true;
176 | 14430 |
             if (c < 0x0A0F) return false;  if (c <= 0x0A10) return true;
177 | 14430 |
             if (c < 0x0A13) return false;  if (c <= 0x0A28) return true;
178 | 14430 |
             if (c < 0x0A2A) return false;  if (c <= 0x0A30) return true;
179 | 14430 |
             if (c < 0x0A32) return false;  if (c <= 0x0A33) return true;
180 | 14430 |
             if (c < 0x0A35) return false;  if (c <= 0x0A36) return true;
181 | 14430 |
             if (c < 0x0A38) return false;  if (c <= 0x0A39) return true;
182 | 14430 |
             if (c < 0x0A59) return false;  if (c <= 0x0A5C) return true;
183 | 14430 |
             if (c == 0x0A5E) return true;
184 | 14430 |
             if (c < 0x0A72) return false;  if (c <= 0x0A74) return true;
185 | 14430 |
             if (c < 0x0A85) return false;  if (c <= 0x0A8B) return true;
186 | 14430 |
             if (c == 0x0A8D) return true;
187 | 14430 |
             if (c < 0x0A8F) return false;  if (c <= 0x0A91) return true;
188 | 14430 |
             if (c < 0x0A93) return false;  if (c <= 0x0AA8) return true;
189 | 14430 |
             if (c < 0x0AAA) return false;  if (c <= 0x0AB0) return true;
190 | 14430 |
             if (c < 0x0AB2) return false;  if (c <= 0x0AB3) return true;
191 | 14430 |
             if (c < 0x0AB5) return false;  if (c <= 0x0AB9) return true;
192 | 14430 |
             if (c == 0x0ABD) return true;
193 | 14430 |
             if (c == 0x0AE0) return true;
194 | 14430 |
             if (c < 0x0B05) return false;  if (c <= 0x0B0C) return true;
195 | 14430 |
             if (c < 0x0B0F) return false;  if (c <= 0x0B10) return true;
196 | 14430 |
             if (c < 0x0B13) return false;  if (c <= 0x0B28) return true;
197 | 14430 |
             if (c < 0x0B2A) return false;  if (c <= 0x0B30) return true;
198 | 14430 |
             if (c < 0x0B32) return false;  if (c <= 0x0B33) return true;
199 | 14430 |
             if (c < 0x0B36) return false;  if (c <= 0x0B39) return true;
200 | 14430 |
             if (c == 0x0B3D) return true;
201 | 14430 |
             if (c < 0x0B5C) return false;  if (c <= 0x0B5D) return true;
202 | 14430 |
             if (c < 0x0B5F) return false;  if (c <= 0x0B61) return true;
203 | 14430 |
             if (c < 0x0B85) return false;  if (c <= 0x0B8A) return true;
204 | 14430 |
             if (c < 0x0B8E) return false;  if (c <= 0x0B90) return true;
205 | 14430 |
             if (c < 0x0B92) return false;  if (c <= 0x0B95) return true;
206 | 14430 |
             if (c < 0x0B99) return false;  if (c <= 0x0B9A) return true;
207 | 14430 |
             if (c == 0x0B9C) return true;
208 | 14430 |
             if (c < 0x0B9E) return false;  if (c <= 0x0B9F) return true;
209 | 14430 |
             if (c < 0x0BA3) return false;  if (c <= 0x0BA4) return true;
210 | 14430 |
             if (c < 0x0BA8) return false;  if (c <= 0x0BAA) return true;
211 | 14430 |
             if (c < 0x0BAE) return false;  if (c <= 0x0BB5) return true;
212 | 14430 |
             if (c < 0x0BB7) return false;  if (c <= 0x0BB9) return true;
213 | 14430 |
             if (c < 0x0C05) return false;  if (c <= 0x0C0C) return true;
214 | 14430 |
             if (c < 0x0C0E) return false;  if (c <= 0x0C10) return true;
215 | 14430 |
             if (c < 0x0C12) return false;  if (c <= 0x0C28) return true;
216 | 14430 |
             if (c < 0x0C2A) return false;  if (c <= 0x0C33) return true;
217 | 14430 |
             if (c < 0x0C35) return false;  if (c <= 0x0C39) return true;
218 | 14430 |
             if (c < 0x0C60) return false;  if (c <= 0x0C61) return true;
219 | 14430 |
             if (c < 0x0C85) return false;  if (c <= 0x0C8C) return true;
220 | 14430 |
             if (c < 0x0C8E) return false;  if (c <= 0x0C90) return true;
221 | 14430 |
             if (c < 0x0C92) return false;  if (c <= 0x0CA8) return true;
222 | 14430 |
             if (c < 0x0CAA) return false;  if (c <= 0x0CB3) return true;
223 | 14430 |
             if (c < 0x0CB5) return false;  if (c <= 0x0CB9) return true;
224 | 14430 |
             if (c == 0x0CDE) return true;
225 | 14430 |
             if (c < 0x0CE0) return false;  if (c <= 0x0CE1) return true;
226 | 14430 |
             if (c < 0x0D05) return false;  if (c <= 0x0D0C) return true;
227 | 14430 |
             if (c < 0x0D0E) return false;  if (c <= 0x0D10) return true;
228 | 14430 |
             if (c < 0x0D12) return false;  if (c <= 0x0D28) return true;
229 | 14430 |
             if (c < 0x0D2A) return false;  if (c <= 0x0D39) return true;
230 | 14430 |
             if (c < 0x0D60) return false;  if (c <= 0x0D61) return true;
231 | 14430 |
             if (c < 0x0E01) return false;  if (c <= 0x0E2E) return true;
232 | 14430 |
             if (c == 0x0E30) return true;
233 | 14430 |
             if (c < 0x0E32) return false;  if (c <= 0x0E33) return true;
234 | 14430 |
             if (c < 0x0E40) return false;  if (c <= 0x0E45) return true;
235 | 14430 |
             if (c < 0x0E81) return false;  if (c <= 0x0E82) return true;
236 | 14430 |
             if (c == 0x0E84) return true;
237 | 14430 |
             if (c < 0x0E87) return false;  if (c <= 0x0E88) return true;
238 | 14430 |
             if (c == 0x0E8A) return true;
239 | 14430 |
             if (c == 0x0E8D) return true;
240 | 14430 |
             if (c < 0x0E94) return false;  if (c <= 0x0E97) return true;
241 | 14430 |
             if (c < 0x0E99) return false;  if (c <= 0x0E9F) return true;
242 | 14430 |
             if (c < 0x0EA1) return false;  if (c <= 0x0EA3) return true;
243 | 14430 |
             if (c == 0x0EA5) return true;
244 | 14430 |
             if (c == 0x0EA7) return true;
245 | 14430 |
             if (c < 0x0EAA) return false;  if (c <= 0x0EAB) return true;
246 | 14430 |
             if (c < 0x0EAD) return false;  if (c <= 0x0EAE) return true;
247 | 14430 |
             if (c == 0x0EB0) return true;
248 | 14430 |
             if (c < 0x0EB2) return false;  if (c <= 0x0EB3) return true;
249 | 14430 |
             if (c == 0x0EBD) return true;
250 | 14430 |
             if (c < 0x0EC0) return false;  if (c <= 0x0EC4) return true;
251 | 14430 |
             if (c < 0x0F40) return false;  if (c <= 0x0F47) return true;
252 | 14430 |
             if (c < 0x0F49) return false;  if (c <= 0x0F69) return true;
253 | 14430 |
             if (c < 0x10A0) return false;  if (c <= 0x10C5) return true;
254 | 14412 |
             if (c < 0x10D0) return false;  if (c <= 0x10F6) return true;
255 | 14412 |
             if (c == 0x1100) return true;
256 | 14412 |
             if (c < 0x1102) return false;  if (c <= 0x1103) return true;
257 | 14412 |
             if (c < 0x1105) return false;  if (c <= 0x1107) return true;
258 | 14412 |
             if (c == 0x1109) return true;
259 | 14412 |
             if (c < 0x110B) return false;  if (c <= 0x110C) return true;
260 | 14412 |
             if (c < 0x110E) return false;  if (c <= 0x1112) return true;
261 | 14412 |
             if (c == 0x113C) return true;
262 | 14412 |
             if (c == 0x113E) return true;
263 | 14412 |
             if (c == 0x1140) return true;
264 | 14412 |
             if (c == 0x114C) return true;
265 | 14412 |
             if (c == 0x114E) return true;
266 | 14412 |
             if (c == 0x1150) return true;
267 | 14412 |
             if (c < 0x1154) return false;  if (c <= 0x1155) return true;
268 | 14412 |
             if (c == 0x1159) return true;
269 | 14412 |
             if (c < 0x115F) return false;  if (c <= 0x1161) return true;
270 | 14412 |
             if (c == 0x1163) return true;
271 | 14412 |
             if (c == 0x1165) return true;
272 | 14412 |
             if (c == 0x1167) return true;
273 | 14412 |
             if (c == 0x1169) return true;
274 | 14412 |
             if (c < 0x116D) return false;  if (c <= 0x116E) return true;
275 | 14412 |
             if (c < 0x1172) return false;  if (c <= 0x1173) return true;
276 | 14412 |
             if (c == 0x1175) return true;
277 | 14412 |
             if (c == 0x119E) return true;
278 | 14412 |
             if (c == 0x11A8) return true;
279 | 14412 |
             if (c == 0x11AB) return true;
280 | 14412 |
             if (c < 0x11AE) return false;  if (c <= 0x11AF) return true;
281 | 14412 |
             if (c < 0x11B7) return false;  if (c <= 0x11B8) return true;
282 | 14412 |
             if (c == 0x11BA) return true;
283 | 14412 |
             if (c < 0x11BC) return false;  if (c <= 0x11C2) return true;
284 | 14412 |
             if (c == 0x11EB) return true;
285 | 14412 |
             if (c == 0x11F0) return true;
286 | 14412 |
             if (c == 0x11F9) return true;
287 | 14412 |
             if (c < 0x1E00) return false;  if (c <= 0x1E9B) return true;
288 | 14412 |
             if (c < 0x1EA0) return false;  if (c <= 0x1EF9) return true;
289 | 14412 |
             if (c < 0x1F00) return false;  if (c <= 0x1F15) return true;
290 | 14412 |
             if (c < 0x1F18) return false;  if (c <= 0x1F1D) return true;
291 | 14412 |
             if (c < 0x1F20) return false;  if (c <= 0x1F45) return true;
292 | 14412 |
             if (c < 0x1F48) return false;  if (c <= 0x1F4D) return true;
293 | 14412 |
             if (c < 0x1F50) return false;  if (c <= 0x1F57) return true;
294 | 14412 |
             if (c == 0x1F59) return true;
295 | 14412 |
             if (c == 0x1F5B) return true;
296 | 14412 |
             if (c == 0x1F5D) return true;
297 | 14412 |
             if (c < 0x1F5F) return false;  if (c <= 0x1F7D) return true;
298 | 14412 |
             if (c < 0x1F80) return false;  if (c <= 0x1FB4) return true;
299 | 14412 |
             if (c < 0x1FB6) return false;  if (c <= 0x1FBC) return true;
300 | 14412 |
             if (c == 0x1FBE) return true;
301 | 14412 |
             if (c < 0x1FC2) return false;  if (c <= 0x1FC4) return true;
302 | 14412 |
             if (c < 0x1FC6) return false;  if (c <= 0x1FCC) return true;
303 | 14412 |
             if (c < 0x1FD0) return false;  if (c <= 0x1FD3) return true;
304 | 14412 |
             if (c < 0x1FD6) return false;  if (c <= 0x1FDB) return true;
305 | 14412 |
             if (c < 0x1FE0) return false;  if (c <= 0x1FEC) return true;
306 | 14412 |
             if (c < 0x1FF2) return false;  if (c <= 0x1FF4) return true;
307 | 14412 |
             if (c < 0x1FF6) return false;  if (c <= 0x1FFC) return true;
308 | 14412 |
             if (c == 0x2126) return true;
309 | 14412 |
             if (c < 0x212A) return false;  if (c <= 0x212B) return true;
310 | 14412 |
             if (c == 0x212E) return true;
311 | 14412 |
             if (c < 0x2180) return false;  if (c <= 0x2182) return true;
312 | 14412 |
             if (c == 0x3007) return true;
313 | 14412 |
             if (c < 0x3021) return false;  if (c <= 0x3029) return true;
314 | 14412 |
             if (c < 0x3041) return false;  if (c <= 0x3094) return true;
315 | 14412 |
             if (c < 0x30A1) return false;  if (c <= 0x30FA) return true;
316 | 14412 |
             if (c < 0x3105) return false;  if (c <= 0x312C) return true;
317 | 14412 |
             if (c < 0x4E00) return false;  if (c <= 0x9FA5) return true;
318 | 14412 |
             if (c < 0xAC00) return false;  if (c <= 0xD7A3) return true;
319 |  |
320 | 14412 |
             return false;
321 |  |
322 |  |
         }
323 |  |
324 |  |
         /**
325 |  |
          * Determine whether a specified character
326 |  |
          * is a combining character according to production 87
327 |  |
          * of the XML 1.0 specification.
328 |  |
          *
329 |  |
          * @param c <code>char</code> to check
330 |  |
          * @return <code>boolean</code> true if it's a combining character,
331 |  |
          *         false otherwise
332 |  |
          */
333 |  |
         static boolean isXMLCombiningChar(char c) {
334 |  |
             // CombiningChar
335 | 17508 |
             if (c < 0x0300) return false;  if (c <= 0x0345) return true;
336 | 6 |
             if (c < 0x0360) return false;  if (c <= 0x0361) return true;
337 | 6 |
             if (c < 0x0483) return false;  if (c <= 0x0486) return true;
338 | 6 |
             if (c < 0x0591) return false;  if (c <= 0x05A1) return true;
339 |  |
340 | 6 |
             if (c < 0x05A3) return false;  if (c <= 0x05B9) return true;
341 | 6 |
             if (c < 0x05BB) return false;  if (c <= 0x05BD) return true;
342 | 6 |
             if (c == 0x05BF) return true;
343 | 6 |
             if (c < 0x05C1) return false;  if (c <= 0x05C2) return true;
344 |  |
345 | 6 |
             if (c == 0x05C4) return true;
346 | 6 |
             if (c < 0x064B) return false;  if (c <= 0x0652) return true;
347 | 6 |
             if (c == 0x0670) return true;
348 | 6 |
             if (c < 0x06D6) return false;  if (c <= 0x06DC) return true;
349 |  |
350 | 6 |
             if (c < 0x06DD) return false;  if (c <= 0x06DF) return true;
351 | 6 |
             if (c < 0x06E0) return false;  if (c <= 0x06E4) return true;
352 | 6 |
             if (c < 0x06E7) return false;  if (c <= 0x06E8) return true;
353 |  |
354 | 6 |
             if (c < 0x06EA) return false;  if (c <= 0x06ED) return true;
355 | 6 |
             if (c < 0x0901) return false;  if (c <= 0x0903) return true;
356 | 6 |
             if (c == 0x093C) return true;
357 | 6 |
             if (c < 0x093E) return false;  if (c <= 0x094C) return true;
358 |  |
359 | 6 |
             if (c == 0x094D) return true;
360 | 6 |
             if (c < 0x0951) return false;  if (c <= 0x0954) return true;
361 | 6 |
             if (c < 0x0962) return false;  if (c <= 0x0963) return true;
362 | 6 |
             if (c < 0x0981) return false;  if (c <= 0x0983) return true;
363 |  |
364 | 6 |
             if (c == 0x09BC) return true;
365 | 6 |
             if (c == 0x09BE) return true;
366 | 6 |
             if (c == 0x09BF) return true;
367 | 6 |
             if (c < 0x09C0) return false;  if (c <= 0x09C4) return true;
368 | 6 |
             if (c < 0x09C7) return false;  if (c <= 0x09C8) return true;
369 |  |
370 | 6 |
             if (c < 0x09CB) return false;  if (c <= 0x09CD) return true;
371 | 6 |
             if (c == 0x09D7) return true;
372 | 6 |
             if (c < 0x09E2) return false;  if (c <= 0x09E3) return true;
373 | 6 |
             if (c == 0x0A02) return true;
374 | 6 |
             if (c == 0x0A3C) return true;
375 |  |
376 | 6 |
             if (c == 0x0A3E) return true;
377 | 6 |
             if (c == 0x0A3F) return true;
378 | 6 |
             if (c < 0x0A40) return false;  if (c <= 0x0A42) return true;
379 | 6 |
             if (c < 0x0A47) return false;  if (c <= 0x0A48) return true;
380 |  |
381 | 6 |
             if (c < 0x0A4B) return false;  if (c <= 0x0A4D) return true;
382 | 6 |
             if (c < 0x0A70) return false;  if (c <= 0x0A71) return true;
383 | 6 |
             if (c < 0x0A81) return false;  if (c <= 0x0A83) return true;
384 | 6 |
             if (c == 0x0ABC) return true;
385 |  |
386 | 6 |
             if (c < 0x0ABE) return false;  if (c <= 0x0AC5) return true;
387 | 6 |
             if (c < 0x0AC7) return false;  if (c <= 0x0AC9) return true;
388 | 6 |
             if (c < 0x0ACB) return false;  if (c <= 0x0ACD) return true;
389 |  |
390 | 6 |
             if (c < 0x0B01) return false;  if (c <= 0x0B03) return true;
391 | 6 |
             if (c == 0x0B3C) return true;
392 | 6 |
             if (c < 0x0B3E) return false;  if (c <= 0x0B43) return true;
393 | 6 |
             if (c < 0x0B47) return false;  if (c <= 0x0B48) return true;
394 |  |
395 | 6 |
             if (c < 0x0B4B) return false;  if (c <= 0x0B4D) return true;
396 | 6 |
             if (c < 0x0B56) return false;  if (c <= 0x0B57) return true;
397 | 6 |
             if (c < 0x0B82) return false;  if (c <= 0x0B83) return true;
398 |  |
399 | 6 |
             if (c < 0x0BBE) return false;  if (c <= 0x0BC2) return true;
400 | 6 |
             if (c < 0x0BC6) return false;  if (c <= 0x0BC8) return true;
401 | 6 |
             if (c < 0x0BCA) return false;  if (c <= 0x0BCD) return true;
402 | 6 |
             if (c == 0x0BD7) return true;
403 |  |
404 | 6 |
             if (c < 0x0C01) return false;  if (c <= 0x0C03) return true;
405 | 6 |
             if (c < 0x0C3E) return false;  if (c <= 0x0C44) return true;
406 | 6 |
             if (c < 0x0C46) return false;  if (c <= 0x0C48) return true;
407 |  |
408 | 6 |
             if (c < 0x0C4A) return false;  if (c <= 0x0C4D) return true;
409 | 6 |
             if (c < 0x0C55) return false;  if (c <= 0x0C56) return true;
410 | 6 |
             if (c < 0x0C82) return false;  if (c <= 0x0C83) return true;
411 |  |
412 | 6 |
             if (c < 0x0CBE) return false;  if (c <= 0x0CC4) return true;
413 | 6 |
             if (c < 0x0CC6) return false;  if (c <= 0x0CC8) return true;
414 | 6 |
             if (c < 0x0CCA) return false;  if (c <= 0x0CCD) return true;
415 |  |
416 | 6 |
             if (c < 0x0CD5) return false;  if (c <= 0x0CD6) return true;
417 | 6 |
             if (c < 0x0D02) return false;  if (c <= 0x0D03) return true;
418 | 6 |
             if (c < 0x0D3E) return false;  if (c <= 0x0D43) return true;
419 |  |
420 | 6 |
             if (c < 0x0D46) return false;  if (c <= 0x0D48) return true;
421 | 6 |
             if (c < 0x0D4A) return false;  if (c <= 0x0D4D) return true;
422 | 6 |
             if (c == 0x0D57) return true;
423 | 6 |
             if (c == 0x0E31) return true;
424 |  |
425 | 6 |
             if (c < 0x0E34) return false;  if (c <= 0x0E3A) return true;
426 | 6 |
             if (c < 0x0E47) return false;  if (c <= 0x0E4E) return true;
427 | 6 |
             if (c == 0x0EB1) return true;
428 | 6 |
             if (c < 0x0EB4) return false;  if (c <= 0x0EB9) return true;
429 |  |
430 | 6 |
             if (c < 0x0EBB) return false;  if (c <= 0x0EBC) return true;
431 | 6 |
             if (c < 0x0EC8) return false;  if (c <= 0x0ECD) return true;
432 | 6 |
             if (c < 0x0F18) return false;  if (c <= 0x0F19) return true;
433 | 6 |
             if (c == 0x0F35) return true;
434 |  |
435 | 6 |
             if (c == 0x0F37) return true;
436 | 6 |
             if (c == 0x0F39) return true;
437 | 6 |
             if (c == 0x0F3E) return true;
438 | 6 |
             if (c == 0x0F3F) return true;
439 | 6 |
             if (c < 0x0F71) return false;  if (c <= 0x0F84) return true;
440 |  |
441 | 6 |
             if (c < 0x0F86) return false;  if (c <= 0x0F8B) return true;
442 | 6 |
             if (c < 0x0F90) return false;  if (c <= 0x0F95) return true;
443 | 6 |
             if (c == 0x0F97) return true;
444 | 6 |
             if (c < 0x0F99) return false;  if (c <= 0x0FAD) return true;
445 |  |
446 | 6 |
             if (c < 0x0FB1) return false;  if (c <= 0x0FB7) return true;
447 | 6 |
             if (c == 0x0FB9) return true;
448 | 6 |
             if (c < 0x20D0) return false;  if (c <= 0x20DC) return true;
449 | 0 |
             if (c == 0x20E1) return true;
450 |  |
451 | 0 |
             if (c < 0x302A) return false;  if (c <= 0x302F) return true;
452 | 0 |
             if (c == 0x3099) return true;
453 | 0 |
             if (c == 0x309A) return true;
454 |  |
455 | 0 |
             return false;
456 |  |
457 |  |
         }
458 |  |
459 |  |
         /**
460 |  |
          * Determine whether a specified
461 |  |
          * character is an extender according to production 88 of the XML 1.0
462 |  |
          * specification.
463 |  |
          *
464 |  |
          * @param c <code>char</code> to check
465 |  |
          * @return true if it's an extender, false otherwise
466 |  |
          */
467 |  |
         static boolean isXMLExtender(char c) {
468 |  |
469 | 17508 |
             if (c < 0x00B6) return false;  // quick short circuit
470 |  |
471 |  |
             // Extenders
472 | 6 |
             if (c == 0x00B7) return true;
473 | 6 |
             if (c == 0x02D0) return true;
474 | 6 |
             if (c == 0x02D1) return true;
475 | 6 |
             if (c == 0x0387) return true;
476 | 6 |
             if (c == 0x0640) return true;
477 | 6 |
             if (c == 0x0E46) return true;
478 | 6 |
             if (c == 0x0EC6) return true;
479 | 6 |
             if (c == 0x3005) return true;
480 |  |
481 | 6 |
             if (c < 0x3031) return false;  if (c <= 0x3035) return true;
482 | 0 |
             if (c < 0x309D) return false;  if (c <= 0x309E) return true;
483 | 0 |
             if (c < 0x30FC) return false;  if (c <= 0x30FE) return true;
484 |  |
485 | 0 |
             return false;
486 |  |
487 |  |
         }
488 |  |
489 |  |
         /**
490 |  |
          * Determine whether a specified Unicode character
491 |  |
          * is a digit according to production 88 of the XML 1.0 specification.
492 |  |
          *
493 |  |
          * @param c <code>char</code> to check for XML digit compliance
494 |  |
          * @return <code>boolean</code> true if it's a digit, false otherwise
495 |  |
          */
496 |  |
         static boolean isXMLDigit(char c) {
497 |  |
498 | 21774 |
             if (c < 0x0030) return false;  if (c <= 0x0039) return true;
499 | 5646 |
             if (c < 0x0660) return false;  if (c <= 0x0669) return true;
500 | 6 |
             if (c < 0x06F0) return false;  if (c <= 0x06F9) return true;
501 | 6 |
             if (c < 0x0966) return false;  if (c <= 0x096F) return true;
502 |  |
503 | 6 |
             if (c < 0x09E6) return false;  if (c <= 0x09EF) return true;
504 | 6 |
             if (c < 0x0A66) return false;  if (c <= 0x0A6F) return true;
505 | 6 |
             if (c < 0x0AE6) return false;  if (c <= 0x0AEF) return true;
506 |  |
507 | 6 |
             if (c < 0x0B66) return false;  if (c <= 0x0B6F) return true;
508 | 6 |
             if (c < 0x0BE7) return false;  if (c <= 0x0BEF) return true;
509 | 6 |
             if (c < 0x0C66) return false;  if (c <= 0x0C6F) return true;
510 |  |
511 | 6 |
             if (c < 0x0CE6) return false;  if (c <= 0x0CEF) return true;
512 | 6 |
             if (c < 0x0D66) return false;  if (c <= 0x0D6F) return true;
513 | 6 |
             if (c < 0x0E50) return false;  if (c <= 0x0E59) return true;
514 |  |
515 | 6 |
             if (c < 0x0ED0) return false;  if (c <= 0x0ED9) return true;
516 | 6 |
             if (c < 0x0F20) return false;  if (c <= 0x0F29) return true;
517 |  |
518 | 6 |
             return false;
519 |  |
         }
520 |  |
521 |  |
     }