1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
package org.apache.maven.scm.provider.local.metadata.io.xpp3; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
import java.io.IOException; |
15 | |
import java.io.InputStream; |
16 | |
import java.io.Reader; |
17 | |
import java.text.DateFormat; |
18 | |
import java.util.Locale; |
19 | |
import org.apache.maven.scm.provider.local.metadata.LocalScmMetadata; |
20 | |
import org.codehaus.plexus.util.ReaderFactory; |
21 | |
import org.codehaus.plexus.util.xml.pull.MXParser; |
22 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParser; |
23 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
@SuppressWarnings( "all" ) |
31 | 0 | public class LocalScmMetadataXpp3Reader |
32 | |
{ |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | 0 | private boolean addDefaultEntities = true; |
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed ) |
66 | |
throws XmlPullParserException |
67 | |
{ |
68 | 0 | if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) ) |
69 | |
{ |
70 | 0 | return false; |
71 | |
} |
72 | 0 | if ( parsed.contains( tagName ) ) |
73 | |
{ |
74 | 0 | throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null ); |
75 | |
} |
76 | 0 | parsed.add( tagName ); |
77 | 0 | return true; |
78 | |
} |
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
public boolean getAddDefaultEntities() |
86 | |
{ |
87 | 0 | return addDefaultEntities; |
88 | |
} |
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
private boolean getBooleanValue( String s, String attribute, XmlPullParser parser ) |
100 | |
throws XmlPullParserException |
101 | |
{ |
102 | 0 | return getBooleanValue( s, attribute, parser, null ); |
103 | |
} |
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue ) |
116 | |
throws XmlPullParserException |
117 | |
{ |
118 | 0 | if ( s != null && s.length() != 0 ) |
119 | |
{ |
120 | 0 | return Boolean.valueOf( s ).booleanValue(); |
121 | |
} |
122 | 0 | if ( defaultValue != null ) |
123 | |
{ |
124 | 0 | return Boolean.valueOf( defaultValue ).booleanValue(); |
125 | |
} |
126 | 0 | return false; |
127 | |
} |
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
140 | |
throws XmlPullParserException |
141 | |
{ |
142 | 0 | if ( s != null ) |
143 | |
{ |
144 | |
try |
145 | |
{ |
146 | 0 | return Byte.valueOf( s ).byteValue(); |
147 | |
} |
148 | 0 | catch ( NumberFormatException e ) |
149 | |
{ |
150 | 0 | if ( strict ) |
151 | |
{ |
152 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, null ); |
153 | |
} |
154 | |
} |
155 | |
} |
156 | 0 | return 0; |
157 | |
} |
158 | |
|
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
private char getCharacterValue( String s, String attribute, XmlPullParser parser ) |
169 | |
throws XmlPullParserException |
170 | |
{ |
171 | 0 | if ( s != null ) |
172 | |
{ |
173 | 0 | return s.charAt( 0 ); |
174 | |
} |
175 | 0 | return 0; |
176 | |
} |
177 | |
|
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser ) |
188 | |
throws XmlPullParserException |
189 | |
{ |
190 | 0 | return getDateValue( s, attribute, null, parser ); |
191 | |
} |
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser ) |
204 | |
throws XmlPullParserException |
205 | |
{ |
206 | 0 | if ( s != null ) |
207 | |
{ |
208 | 0 | String effectiveDateFormat = dateFormat; |
209 | 0 | if ( dateFormat == null ) |
210 | |
{ |
211 | 0 | effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"; |
212 | |
} |
213 | 0 | if ( "long".equals( effectiveDateFormat ) ) |
214 | |
{ |
215 | |
try |
216 | |
{ |
217 | 0 | return new java.util.Date( Long.parseLong( s ) ); |
218 | |
} |
219 | 0 | catch ( NumberFormatException e ) |
220 | |
{ |
221 | 0 | throw new XmlPullParserException( e.getMessage() ); |
222 | |
} |
223 | |
} |
224 | |
else |
225 | |
{ |
226 | |
try |
227 | |
{ |
228 | 0 | DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, Locale.US ); |
229 | 0 | return dateParser.parse( s ); |
230 | |
} |
231 | 0 | catch ( java.text.ParseException e ) |
232 | |
{ |
233 | 0 | throw new XmlPullParserException( e.getMessage() ); |
234 | |
} |
235 | |
} |
236 | |
} |
237 | 0 | return null; |
238 | |
} |
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
|
244 | |
|
245 | |
|
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
251 | |
throws XmlPullParserException |
252 | |
{ |
253 | 0 | if ( s != null ) |
254 | |
{ |
255 | |
try |
256 | |
{ |
257 | 0 | return Double.valueOf( s ).doubleValue(); |
258 | |
} |
259 | 0 | catch ( NumberFormatException e ) |
260 | |
{ |
261 | 0 | if ( strict ) |
262 | |
{ |
263 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null ); |
264 | |
} |
265 | |
} |
266 | |
} |
267 | 0 | return 0; |
268 | |
} |
269 | |
|
270 | |
|
271 | |
|
272 | |
|
273 | |
|
274 | |
|
275 | |
|
276 | |
|
277 | |
|
278 | |
|
279 | |
|
280 | |
private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
281 | |
throws XmlPullParserException |
282 | |
{ |
283 | 0 | if ( s != null ) |
284 | |
{ |
285 | |
try |
286 | |
{ |
287 | 0 | return Float.valueOf( s ).floatValue(); |
288 | |
} |
289 | 0 | catch ( NumberFormatException e ) |
290 | |
{ |
291 | 0 | if ( strict ) |
292 | |
{ |
293 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null ); |
294 | |
} |
295 | |
} |
296 | |
} |
297 | 0 | return 0; |
298 | |
} |
299 | |
|
300 | |
|
301 | |
|
302 | |
|
303 | |
|
304 | |
|
305 | |
|
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
311 | |
throws XmlPullParserException |
312 | |
{ |
313 | 0 | if ( s != null ) |
314 | |
{ |
315 | |
try |
316 | |
{ |
317 | 0 | return Integer.valueOf( s ).intValue(); |
318 | |
} |
319 | 0 | catch ( NumberFormatException e ) |
320 | |
{ |
321 | 0 | if ( strict ) |
322 | |
{ |
323 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, null ); |
324 | |
} |
325 | |
} |
326 | |
} |
327 | 0 | return 0; |
328 | |
} |
329 | |
|
330 | |
|
331 | |
|
332 | |
|
333 | |
|
334 | |
|
335 | |
|
336 | |
|
337 | |
|
338 | |
|
339 | |
|
340 | |
private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
341 | |
throws XmlPullParserException |
342 | |
{ |
343 | 0 | if ( s != null ) |
344 | |
{ |
345 | |
try |
346 | |
{ |
347 | 0 | return Long.valueOf( s ).longValue(); |
348 | |
} |
349 | 0 | catch ( NumberFormatException e ) |
350 | |
{ |
351 | 0 | if ( strict ) |
352 | |
{ |
353 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, null ); |
354 | |
} |
355 | |
} |
356 | |
} |
357 | 0 | return 0; |
358 | |
} |
359 | |
|
360 | |
|
361 | |
|
362 | |
|
363 | |
|
364 | |
|
365 | |
|
366 | |
|
367 | |
|
368 | |
|
369 | |
|
370 | |
private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
371 | |
throws XmlPullParserException |
372 | |
{ |
373 | 0 | if ( s == null ) |
374 | |
{ |
375 | 0 | if ( strict ) |
376 | |
{ |
377 | 0 | throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null ); |
378 | |
} |
379 | |
} |
380 | 0 | return s; |
381 | |
} |
382 | |
|
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | |
|
388 | |
|
389 | |
|
390 | |
|
391 | |
|
392 | |
|
393 | |
private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
394 | |
throws XmlPullParserException |
395 | |
{ |
396 | 0 | if ( s != null ) |
397 | |
{ |
398 | |
try |
399 | |
{ |
400 | 0 | return Short.valueOf( s ).shortValue(); |
401 | |
} |
402 | 0 | catch ( NumberFormatException e ) |
403 | |
{ |
404 | 0 | if ( strict ) |
405 | |
{ |
406 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, null ); |
407 | |
} |
408 | |
} |
409 | |
} |
410 | 0 | return 0; |
411 | |
} |
412 | |
|
413 | |
|
414 | |
|
415 | |
|
416 | |
|
417 | |
|
418 | |
|
419 | |
private String getTrimmedValue( String s ) |
420 | |
{ |
421 | 0 | if ( s != null ) |
422 | |
{ |
423 | 0 | s = s.trim(); |
424 | |
} |
425 | 0 | return s; |
426 | |
} |
427 | |
|
428 | |
|
429 | |
|
430 | |
|
431 | |
|
432 | |
|
433 | |
|
434 | |
|
435 | |
|
436 | |
|
437 | |
|
438 | |
private LocalScmMetadata parseLocalScmMetadata( String tagName, XmlPullParser parser, boolean strict ) |
439 | |
throws IOException, XmlPullParserException |
440 | |
{ |
441 | 0 | LocalScmMetadata localScmMetadata = new LocalScmMetadata(); |
442 | 0 | java.util.Set parsed = new java.util.HashSet(); |
443 | 0 | int eventType = parser.getEventType(); |
444 | 0 | boolean foundRoot = false; |
445 | 0 | localScmMetadata.setModelEncoding( parser.getInputEncoding() ); |
446 | 0 | while ( eventType != XmlPullParser.END_DOCUMENT ) |
447 | |
{ |
448 | 0 | if ( eventType == XmlPullParser.START_TAG ) |
449 | |
{ |
450 | 0 | if ( parser.getName().equals( tagName ) ) |
451 | |
{ |
452 | 0 | foundRoot = true; |
453 | |
} |
454 | 0 | else if ( strict && ! foundRoot ) |
455 | |
{ |
456 | 0 | throw new XmlPullParserException( "Expected root element '" + tagName + "' but found '" + parser.getName() + "'", parser, null ); |
457 | |
} |
458 | 0 | else if ( checkFieldWithDuplicate( parser, "repositoryFileNames", null, parsed ) ) |
459 | |
{ |
460 | 0 | java.util.List repositoryFileNames = new java.util.ArrayList(); |
461 | 0 | localScmMetadata.setRepositoryFileNames( repositoryFileNames ); |
462 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
463 | |
{ |
464 | 0 | if ( parser.getName().equals( "repositoryFileName" ) ) |
465 | |
{ |
466 | 0 | repositoryFileNames.add( getTrimmedValue( parser.nextText() ) ); |
467 | |
} |
468 | 0 | else if ( strict ) |
469 | |
{ |
470 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
471 | |
} |
472 | |
else |
473 | |
{ |
474 | |
|
475 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
476 | |
} |
477 | |
} |
478 | 0 | } |
479 | 0 | else if ( strict ) |
480 | |
{ |
481 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
482 | |
} |
483 | |
} |
484 | 0 | eventType = parser.next(); |
485 | |
} |
486 | 0 | return localScmMetadata; |
487 | |
} |
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
|
493 | |
|
494 | |
|
495 | |
|
496 | |
|
497 | |
|
498 | |
public LocalScmMetadata read( Reader reader, boolean strict ) |
499 | |
throws IOException, XmlPullParserException |
500 | |
{ |
501 | 0 | XmlPullParser parser = new MXParser(); |
502 | |
|
503 | 0 | parser.setInput( reader ); |
504 | |
|
505 | 0 | if ( addDefaultEntities ) |
506 | |
{ |
507 | |
|
508 | |
|
509 | |
|
510 | |
|
511 | 0 | parser.defineEntityReplacementText( "nbsp", "\u00a0" ); |
512 | 0 | parser.defineEntityReplacementText( "iexcl", "\u00a1" ); |
513 | 0 | parser.defineEntityReplacementText( "cent", "\u00a2" ); |
514 | 0 | parser.defineEntityReplacementText( "pound", "\u00a3" ); |
515 | 0 | parser.defineEntityReplacementText( "curren", "\u00a4" ); |
516 | 0 | parser.defineEntityReplacementText( "yen", "\u00a5" ); |
517 | 0 | parser.defineEntityReplacementText( "brvbar", "\u00a6" ); |
518 | 0 | parser.defineEntityReplacementText( "sect", "\u00a7" ); |
519 | 0 | parser.defineEntityReplacementText( "uml", "\u00a8" ); |
520 | 0 | parser.defineEntityReplacementText( "copy", "\u00a9" ); |
521 | 0 | parser.defineEntityReplacementText( "ordf", "\u00aa" ); |
522 | 0 | parser.defineEntityReplacementText( "laquo", "\u00ab" ); |
523 | 0 | parser.defineEntityReplacementText( "not", "\u00ac" ); |
524 | 0 | parser.defineEntityReplacementText( "shy", "\u00ad" ); |
525 | 0 | parser.defineEntityReplacementText( "reg", "\u00ae" ); |
526 | 0 | parser.defineEntityReplacementText( "macr", "\u00af" ); |
527 | 0 | parser.defineEntityReplacementText( "deg", "\u00b0" ); |
528 | 0 | parser.defineEntityReplacementText( "plusmn", "\u00b1" ); |
529 | 0 | parser.defineEntityReplacementText( "sup2", "\u00b2" ); |
530 | 0 | parser.defineEntityReplacementText( "sup3", "\u00b3" ); |
531 | 0 | parser.defineEntityReplacementText( "acute", "\u00b4" ); |
532 | 0 | parser.defineEntityReplacementText( "micro", "\u00b5" ); |
533 | 0 | parser.defineEntityReplacementText( "para", "\u00b6" ); |
534 | 0 | parser.defineEntityReplacementText( "middot", "\u00b7" ); |
535 | 0 | parser.defineEntityReplacementText( "cedil", "\u00b8" ); |
536 | 0 | parser.defineEntityReplacementText( "sup1", "\u00b9" ); |
537 | 0 | parser.defineEntityReplacementText( "ordm", "\u00ba" ); |
538 | 0 | parser.defineEntityReplacementText( "raquo", "\u00bb" ); |
539 | 0 | parser.defineEntityReplacementText( "frac14", "\u00bc" ); |
540 | 0 | parser.defineEntityReplacementText( "frac12", "\u00bd" ); |
541 | 0 | parser.defineEntityReplacementText( "frac34", "\u00be" ); |
542 | 0 | parser.defineEntityReplacementText( "iquest", "\u00bf" ); |
543 | 0 | parser.defineEntityReplacementText( "Agrave", "\u00c0" ); |
544 | 0 | parser.defineEntityReplacementText( "Aacute", "\u00c1" ); |
545 | 0 | parser.defineEntityReplacementText( "Acirc", "\u00c2" ); |
546 | 0 | parser.defineEntityReplacementText( "Atilde", "\u00c3" ); |
547 | 0 | parser.defineEntityReplacementText( "Auml", "\u00c4" ); |
548 | 0 | parser.defineEntityReplacementText( "Aring", "\u00c5" ); |
549 | 0 | parser.defineEntityReplacementText( "AElig", "\u00c6" ); |
550 | 0 | parser.defineEntityReplacementText( "Ccedil", "\u00c7" ); |
551 | 0 | parser.defineEntityReplacementText( "Egrave", "\u00c8" ); |
552 | 0 | parser.defineEntityReplacementText( "Eacute", "\u00c9" ); |
553 | 0 | parser.defineEntityReplacementText( "Ecirc", "\u00ca" ); |
554 | 0 | parser.defineEntityReplacementText( "Euml", "\u00cb" ); |
555 | 0 | parser.defineEntityReplacementText( "Igrave", "\u00cc" ); |
556 | 0 | parser.defineEntityReplacementText( "Iacute", "\u00cd" ); |
557 | 0 | parser.defineEntityReplacementText( "Icirc", "\u00ce" ); |
558 | 0 | parser.defineEntityReplacementText( "Iuml", "\u00cf" ); |
559 | 0 | parser.defineEntityReplacementText( "ETH", "\u00d0" ); |
560 | 0 | parser.defineEntityReplacementText( "Ntilde", "\u00d1" ); |
561 | 0 | parser.defineEntityReplacementText( "Ograve", "\u00d2" ); |
562 | 0 | parser.defineEntityReplacementText( "Oacute", "\u00d3" ); |
563 | 0 | parser.defineEntityReplacementText( "Ocirc", "\u00d4" ); |
564 | 0 | parser.defineEntityReplacementText( "Otilde", "\u00d5" ); |
565 | 0 | parser.defineEntityReplacementText( "Ouml", "\u00d6" ); |
566 | 0 | parser.defineEntityReplacementText( "times", "\u00d7" ); |
567 | 0 | parser.defineEntityReplacementText( "Oslash", "\u00d8" ); |
568 | 0 | parser.defineEntityReplacementText( "Ugrave", "\u00d9" ); |
569 | 0 | parser.defineEntityReplacementText( "Uacute", "\u00da" ); |
570 | 0 | parser.defineEntityReplacementText( "Ucirc", "\u00db" ); |
571 | 0 | parser.defineEntityReplacementText( "Uuml", "\u00dc" ); |
572 | 0 | parser.defineEntityReplacementText( "Yacute", "\u00dd" ); |
573 | 0 | parser.defineEntityReplacementText( "THORN", "\u00de" ); |
574 | 0 | parser.defineEntityReplacementText( "szlig", "\u00df" ); |
575 | 0 | parser.defineEntityReplacementText( "agrave", "\u00e0" ); |
576 | 0 | parser.defineEntityReplacementText( "aacute", "\u00e1" ); |
577 | 0 | parser.defineEntityReplacementText( "acirc", "\u00e2" ); |
578 | 0 | parser.defineEntityReplacementText( "atilde", "\u00e3" ); |
579 | 0 | parser.defineEntityReplacementText( "auml", "\u00e4" ); |
580 | 0 | parser.defineEntityReplacementText( "aring", "\u00e5" ); |
581 | 0 | parser.defineEntityReplacementText( "aelig", "\u00e6" ); |
582 | 0 | parser.defineEntityReplacementText( "ccedil", "\u00e7" ); |
583 | 0 | parser.defineEntityReplacementText( "egrave", "\u00e8" ); |
584 | 0 | parser.defineEntityReplacementText( "eacute", "\u00e9" ); |
585 | 0 | parser.defineEntityReplacementText( "ecirc", "\u00ea" ); |
586 | 0 | parser.defineEntityReplacementText( "euml", "\u00eb" ); |
587 | 0 | parser.defineEntityReplacementText( "igrave", "\u00ec" ); |
588 | 0 | parser.defineEntityReplacementText( "iacute", "\u00ed" ); |
589 | 0 | parser.defineEntityReplacementText( "icirc", "\u00ee" ); |
590 | 0 | parser.defineEntityReplacementText( "iuml", "\u00ef" ); |
591 | 0 | parser.defineEntityReplacementText( "eth", "\u00f0" ); |
592 | 0 | parser.defineEntityReplacementText( "ntilde", "\u00f1" ); |
593 | 0 | parser.defineEntityReplacementText( "ograve", "\u00f2" ); |
594 | 0 | parser.defineEntityReplacementText( "oacute", "\u00f3" ); |
595 | 0 | parser.defineEntityReplacementText( "ocirc", "\u00f4" ); |
596 | 0 | parser.defineEntityReplacementText( "otilde", "\u00f5" ); |
597 | 0 | parser.defineEntityReplacementText( "ouml", "\u00f6" ); |
598 | 0 | parser.defineEntityReplacementText( "divide", "\u00f7" ); |
599 | 0 | parser.defineEntityReplacementText( "oslash", "\u00f8" ); |
600 | 0 | parser.defineEntityReplacementText( "ugrave", "\u00f9" ); |
601 | 0 | parser.defineEntityReplacementText( "uacute", "\u00fa" ); |
602 | 0 | parser.defineEntityReplacementText( "ucirc", "\u00fb" ); |
603 | 0 | parser.defineEntityReplacementText( "uuml", "\u00fc" ); |
604 | 0 | parser.defineEntityReplacementText( "yacute", "\u00fd" ); |
605 | 0 | parser.defineEntityReplacementText( "thorn", "\u00fe" ); |
606 | 0 | parser.defineEntityReplacementText( "yuml", "\u00ff" ); |
607 | |
|
608 | |
|
609 | |
|
610 | |
|
611 | |
|
612 | 0 | parser.defineEntityReplacementText( "OElig", "\u0152" ); |
613 | 0 | parser.defineEntityReplacementText( "oelig", "\u0153" ); |
614 | 0 | parser.defineEntityReplacementText( "Scaron", "\u0160" ); |
615 | 0 | parser.defineEntityReplacementText( "scaron", "\u0161" ); |
616 | 0 | parser.defineEntityReplacementText( "Yuml", "\u0178" ); |
617 | 0 | parser.defineEntityReplacementText( "circ", "\u02c6" ); |
618 | 0 | parser.defineEntityReplacementText( "tilde", "\u02dc" ); |
619 | 0 | parser.defineEntityReplacementText( "ensp", "\u2002" ); |
620 | 0 | parser.defineEntityReplacementText( "emsp", "\u2003" ); |
621 | 0 | parser.defineEntityReplacementText( "thinsp", "\u2009" ); |
622 | 0 | parser.defineEntityReplacementText( "zwnj", "\u200c" ); |
623 | 0 | parser.defineEntityReplacementText( "zwj", "\u200d" ); |
624 | 0 | parser.defineEntityReplacementText( "lrm", "\u200e" ); |
625 | 0 | parser.defineEntityReplacementText( "rlm", "\u200f" ); |
626 | 0 | parser.defineEntityReplacementText( "ndash", "\u2013" ); |
627 | 0 | parser.defineEntityReplacementText( "mdash", "\u2014" ); |
628 | 0 | parser.defineEntityReplacementText( "lsquo", "\u2018" ); |
629 | 0 | parser.defineEntityReplacementText( "rsquo", "\u2019" ); |
630 | 0 | parser.defineEntityReplacementText( "sbquo", "\u201a" ); |
631 | 0 | parser.defineEntityReplacementText( "ldquo", "\u201c" ); |
632 | 0 | parser.defineEntityReplacementText( "rdquo", "\u201d" ); |
633 | 0 | parser.defineEntityReplacementText( "bdquo", "\u201e" ); |
634 | 0 | parser.defineEntityReplacementText( "dagger", "\u2020" ); |
635 | 0 | parser.defineEntityReplacementText( "Dagger", "\u2021" ); |
636 | 0 | parser.defineEntityReplacementText( "permil", "\u2030" ); |
637 | 0 | parser.defineEntityReplacementText( "lsaquo", "\u2039" ); |
638 | 0 | parser.defineEntityReplacementText( "rsaquo", "\u203a" ); |
639 | 0 | parser.defineEntityReplacementText( "euro", "\u20ac" ); |
640 | |
|
641 | |
|
642 | |
|
643 | |
|
644 | |
|
645 | 0 | parser.defineEntityReplacementText( "fnof", "\u0192" ); |
646 | 0 | parser.defineEntityReplacementText( "Alpha", "\u0391" ); |
647 | 0 | parser.defineEntityReplacementText( "Beta", "\u0392" ); |
648 | 0 | parser.defineEntityReplacementText( "Gamma", "\u0393" ); |
649 | 0 | parser.defineEntityReplacementText( "Delta", "\u0394" ); |
650 | 0 | parser.defineEntityReplacementText( "Epsilon", "\u0395" ); |
651 | 0 | parser.defineEntityReplacementText( "Zeta", "\u0396" ); |
652 | 0 | parser.defineEntityReplacementText( "Eta", "\u0397" ); |
653 | 0 | parser.defineEntityReplacementText( "Theta", "\u0398" ); |
654 | 0 | parser.defineEntityReplacementText( "Iota", "\u0399" ); |
655 | 0 | parser.defineEntityReplacementText( "Kappa", "\u039a" ); |
656 | 0 | parser.defineEntityReplacementText( "Lambda", "\u039b" ); |
657 | 0 | parser.defineEntityReplacementText( "Mu", "\u039c" ); |
658 | 0 | parser.defineEntityReplacementText( "Nu", "\u039d" ); |
659 | 0 | parser.defineEntityReplacementText( "Xi", "\u039e" ); |
660 | 0 | parser.defineEntityReplacementText( "Omicron", "\u039f" ); |
661 | 0 | parser.defineEntityReplacementText( "Pi", "\u03a0" ); |
662 | 0 | parser.defineEntityReplacementText( "Rho", "\u03a1" ); |
663 | 0 | parser.defineEntityReplacementText( "Sigma", "\u03a3" ); |
664 | 0 | parser.defineEntityReplacementText( "Tau", "\u03a4" ); |
665 | 0 | parser.defineEntityReplacementText( "Upsilon", "\u03a5" ); |
666 | 0 | parser.defineEntityReplacementText( "Phi", "\u03a6" ); |
667 | 0 | parser.defineEntityReplacementText( "Chi", "\u03a7" ); |
668 | 0 | parser.defineEntityReplacementText( "Psi", "\u03a8" ); |
669 | 0 | parser.defineEntityReplacementText( "Omega", "\u03a9" ); |
670 | 0 | parser.defineEntityReplacementText( "alpha", "\u03b1" ); |
671 | 0 | parser.defineEntityReplacementText( "beta", "\u03b2" ); |
672 | 0 | parser.defineEntityReplacementText( "gamma", "\u03b3" ); |
673 | 0 | parser.defineEntityReplacementText( "delta", "\u03b4" ); |
674 | 0 | parser.defineEntityReplacementText( "epsilon", "\u03b5" ); |
675 | 0 | parser.defineEntityReplacementText( "zeta", "\u03b6" ); |
676 | 0 | parser.defineEntityReplacementText( "eta", "\u03b7" ); |
677 | 0 | parser.defineEntityReplacementText( "theta", "\u03b8" ); |
678 | 0 | parser.defineEntityReplacementText( "iota", "\u03b9" ); |
679 | 0 | parser.defineEntityReplacementText( "kappa", "\u03ba" ); |
680 | 0 | parser.defineEntityReplacementText( "lambda", "\u03bb" ); |
681 | 0 | parser.defineEntityReplacementText( "mu", "\u03bc" ); |
682 | 0 | parser.defineEntityReplacementText( "nu", "\u03bd" ); |
683 | 0 | parser.defineEntityReplacementText( "xi", "\u03be" ); |
684 | 0 | parser.defineEntityReplacementText( "omicron", "\u03bf" ); |
685 | 0 | parser.defineEntityReplacementText( "pi", "\u03c0" ); |
686 | 0 | parser.defineEntityReplacementText( "rho", "\u03c1" ); |
687 | 0 | parser.defineEntityReplacementText( "sigmaf", "\u03c2" ); |
688 | 0 | parser.defineEntityReplacementText( "sigma", "\u03c3" ); |
689 | 0 | parser.defineEntityReplacementText( "tau", "\u03c4" ); |
690 | 0 | parser.defineEntityReplacementText( "upsilon", "\u03c5" ); |
691 | 0 | parser.defineEntityReplacementText( "phi", "\u03c6" ); |
692 | 0 | parser.defineEntityReplacementText( "chi", "\u03c7" ); |
693 | 0 | parser.defineEntityReplacementText( "psi", "\u03c8" ); |
694 | 0 | parser.defineEntityReplacementText( "omega", "\u03c9" ); |
695 | 0 | parser.defineEntityReplacementText( "thetasym", "\u03d1" ); |
696 | 0 | parser.defineEntityReplacementText( "upsih", "\u03d2" ); |
697 | 0 | parser.defineEntityReplacementText( "piv", "\u03d6" ); |
698 | 0 | parser.defineEntityReplacementText( "bull", "\u2022" ); |
699 | 0 | parser.defineEntityReplacementText( "hellip", "\u2026" ); |
700 | 0 | parser.defineEntityReplacementText( "prime", "\u2032" ); |
701 | 0 | parser.defineEntityReplacementText( "Prime", "\u2033" ); |
702 | 0 | parser.defineEntityReplacementText( "oline", "\u203e" ); |
703 | 0 | parser.defineEntityReplacementText( "frasl", "\u2044" ); |
704 | 0 | parser.defineEntityReplacementText( "weierp", "\u2118" ); |
705 | 0 | parser.defineEntityReplacementText( "image", "\u2111" ); |
706 | 0 | parser.defineEntityReplacementText( "real", "\u211c" ); |
707 | 0 | parser.defineEntityReplacementText( "trade", "\u2122" ); |
708 | 0 | parser.defineEntityReplacementText( "alefsym", "\u2135" ); |
709 | 0 | parser.defineEntityReplacementText( "larr", "\u2190" ); |
710 | 0 | parser.defineEntityReplacementText( "uarr", "\u2191" ); |
711 | 0 | parser.defineEntityReplacementText( "rarr", "\u2192" ); |
712 | 0 | parser.defineEntityReplacementText( "darr", "\u2193" ); |
713 | 0 | parser.defineEntityReplacementText( "harr", "\u2194" ); |
714 | 0 | parser.defineEntityReplacementText( "crarr", "\u21b5" ); |
715 | 0 | parser.defineEntityReplacementText( "lArr", "\u21d0" ); |
716 | 0 | parser.defineEntityReplacementText( "uArr", "\u21d1" ); |
717 | 0 | parser.defineEntityReplacementText( "rArr", "\u21d2" ); |
718 | 0 | parser.defineEntityReplacementText( "dArr", "\u21d3" ); |
719 | 0 | parser.defineEntityReplacementText( "hArr", "\u21d4" ); |
720 | 0 | parser.defineEntityReplacementText( "forall", "\u2200" ); |
721 | 0 | parser.defineEntityReplacementText( "part", "\u2202" ); |
722 | 0 | parser.defineEntityReplacementText( "exist", "\u2203" ); |
723 | 0 | parser.defineEntityReplacementText( "empty", "\u2205" ); |
724 | 0 | parser.defineEntityReplacementText( "nabla", "\u2207" ); |
725 | 0 | parser.defineEntityReplacementText( "isin", "\u2208" ); |
726 | 0 | parser.defineEntityReplacementText( "notin", "\u2209" ); |
727 | 0 | parser.defineEntityReplacementText( "ni", "\u220b" ); |
728 | 0 | parser.defineEntityReplacementText( "prod", "\u220f" ); |
729 | 0 | parser.defineEntityReplacementText( "sum", "\u2211" ); |
730 | 0 | parser.defineEntityReplacementText( "minus", "\u2212" ); |
731 | 0 | parser.defineEntityReplacementText( "lowast", "\u2217" ); |
732 | 0 | parser.defineEntityReplacementText( "radic", "\u221a" ); |
733 | 0 | parser.defineEntityReplacementText( "prop", "\u221d" ); |
734 | 0 | parser.defineEntityReplacementText( "infin", "\u221e" ); |
735 | 0 | parser.defineEntityReplacementText( "ang", "\u2220" ); |
736 | 0 | parser.defineEntityReplacementText( "and", "\u2227" ); |
737 | 0 | parser.defineEntityReplacementText( "or", "\u2228" ); |
738 | 0 | parser.defineEntityReplacementText( "cap", "\u2229" ); |
739 | 0 | parser.defineEntityReplacementText( "cup", "\u222a" ); |
740 | 0 | parser.defineEntityReplacementText( "int", "\u222b" ); |
741 | 0 | parser.defineEntityReplacementText( "there4", "\u2234" ); |
742 | 0 | parser.defineEntityReplacementText( "sim", "\u223c" ); |
743 | 0 | parser.defineEntityReplacementText( "cong", "\u2245" ); |
744 | 0 | parser.defineEntityReplacementText( "asymp", "\u2248" ); |
745 | 0 | parser.defineEntityReplacementText( "ne", "\u2260" ); |
746 | 0 | parser.defineEntityReplacementText( "equiv", "\u2261" ); |
747 | 0 | parser.defineEntityReplacementText( "le", "\u2264" ); |
748 | 0 | parser.defineEntityReplacementText( "ge", "\u2265" ); |
749 | 0 | parser.defineEntityReplacementText( "sub", "\u2282" ); |
750 | 0 | parser.defineEntityReplacementText( "sup", "\u2283" ); |
751 | 0 | parser.defineEntityReplacementText( "nsub", "\u2284" ); |
752 | 0 | parser.defineEntityReplacementText( "sube", "\u2286" ); |
753 | 0 | parser.defineEntityReplacementText( "supe", "\u2287" ); |
754 | 0 | parser.defineEntityReplacementText( "oplus", "\u2295" ); |
755 | 0 | parser.defineEntityReplacementText( "otimes", "\u2297" ); |
756 | 0 | parser.defineEntityReplacementText( "perp", "\u22a5" ); |
757 | 0 | parser.defineEntityReplacementText( "sdot", "\u22c5" ); |
758 | 0 | parser.defineEntityReplacementText( "lceil", "\u2308" ); |
759 | 0 | parser.defineEntityReplacementText( "rceil", "\u2309" ); |
760 | 0 | parser.defineEntityReplacementText( "lfloor", "\u230a" ); |
761 | 0 | parser.defineEntityReplacementText( "rfloor", "\u230b" ); |
762 | 0 | parser.defineEntityReplacementText( "lang", "\u2329" ); |
763 | 0 | parser.defineEntityReplacementText( "rang", "\u232a" ); |
764 | 0 | parser.defineEntityReplacementText( "loz", "\u25ca" ); |
765 | 0 | parser.defineEntityReplacementText( "spades", "\u2660" ); |
766 | 0 | parser.defineEntityReplacementText( "clubs", "\u2663" ); |
767 | 0 | parser.defineEntityReplacementText( "hearts", "\u2665" ); |
768 | 0 | parser.defineEntityReplacementText( "diams", "\u2666" ); |
769 | |
|
770 | |
} |
771 | |
|
772 | 0 | parser.next(); |
773 | 0 | return parseLocalScmMetadata( "localScmMetadata", parser, strict ); |
774 | |
} |
775 | |
|
776 | |
|
777 | |
|
778 | |
|
779 | |
|
780 | |
|
781 | |
|
782 | |
|
783 | |
|
784 | |
public LocalScmMetadata read( Reader reader ) |
785 | |
throws IOException, XmlPullParserException |
786 | |
{ |
787 | 0 | return read( reader, true ); |
788 | |
} |
789 | |
|
790 | |
|
791 | |
|
792 | |
|
793 | |
|
794 | |
|
795 | |
|
796 | |
|
797 | |
|
798 | |
|
799 | |
public LocalScmMetadata read( InputStream in, boolean strict ) |
800 | |
throws IOException, XmlPullParserException |
801 | |
{ |
802 | 0 | Reader reader = ReaderFactory.newXmlReader( in ); |
803 | |
|
804 | 0 | return read( reader, strict ); |
805 | |
} |
806 | |
|
807 | |
|
808 | |
|
809 | |
|
810 | |
|
811 | |
|
812 | |
|
813 | |
|
814 | |
|
815 | |
public LocalScmMetadata read( InputStream in ) |
816 | |
throws IOException, XmlPullParserException |
817 | |
{ |
818 | 0 | Reader reader = ReaderFactory.newXmlReader( in ); |
819 | |
|
820 | 0 | return read( reader ); |
821 | |
} |
822 | |
|
823 | |
|
824 | |
|
825 | |
|
826 | |
|
827 | |
|
828 | |
public void setAddDefaultEntities( boolean addDefaultEntities ) |
829 | |
{ |
830 | 0 | this.addDefaultEntities = addDefaultEntities; |
831 | 0 | } |
832 | |
|
833 | |
} |