1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
package org.apache.maven.settings.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.settings.Activation; |
20 | |
import org.apache.maven.settings.ActivationFile; |
21 | |
import org.apache.maven.settings.ActivationOS; |
22 | |
import org.apache.maven.settings.ActivationProperty; |
23 | |
import org.apache.maven.settings.IdentifiableBase; |
24 | |
import org.apache.maven.settings.Mirror; |
25 | |
import org.apache.maven.settings.Profile; |
26 | |
import org.apache.maven.settings.Proxy; |
27 | |
import org.apache.maven.settings.Repository; |
28 | |
import org.apache.maven.settings.RepositoryBase; |
29 | |
import org.apache.maven.settings.RepositoryPolicy; |
30 | |
import org.apache.maven.settings.Server; |
31 | |
import org.apache.maven.settings.Settings; |
32 | |
import org.apache.maven.settings.TrackableBase; |
33 | |
import org.codehaus.plexus.util.ReaderFactory; |
34 | |
import org.codehaus.plexus.util.xml.Xpp3DomBuilder; |
35 | |
import org.codehaus.plexus.util.xml.pull.MXParser; |
36 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParser; |
37 | |
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; |
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | 3 | public class SettingsXpp3Reader |
45 | |
{ |
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | 3 | private boolean addDefaultEntities = true; |
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed ) |
79 | |
throws XmlPullParserException |
80 | |
{ |
81 | 71 | if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) ) |
82 | |
{ |
83 | 54 | return false; |
84 | |
} |
85 | 17 | if ( parsed.contains( tagName ) ) |
86 | |
{ |
87 | 0 | throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null ); |
88 | |
} |
89 | 17 | parsed.add( tagName ); |
90 | 17 | return true; |
91 | |
} |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
public boolean getAddDefaultEntities() |
99 | |
{ |
100 | 0 | return addDefaultEntities; |
101 | |
} |
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
|
112 | |
private boolean getBooleanValue( String s, String attribute, XmlPullParser parser ) |
113 | |
throws XmlPullParserException |
114 | |
{ |
115 | 0 | return getBooleanValue( s, attribute, parser, null ); |
116 | |
} |
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | |
|
126 | |
|
127 | |
|
128 | |
private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue ) |
129 | |
throws XmlPullParserException |
130 | |
{ |
131 | 2 | if ( s != null && s.length() != 0 ) |
132 | |
{ |
133 | 2 | return Boolean.valueOf( s ).booleanValue(); |
134 | |
} |
135 | 0 | if ( defaultValue != null ) |
136 | |
{ |
137 | 0 | return Boolean.valueOf( defaultValue ).booleanValue(); |
138 | |
} |
139 | 0 | return false; |
140 | |
} |
141 | |
|
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
153 | |
throws XmlPullParserException |
154 | |
{ |
155 | 0 | if ( s != null ) |
156 | |
{ |
157 | |
try |
158 | |
{ |
159 | 0 | return Byte.valueOf( s ).byteValue(); |
160 | |
} |
161 | 0 | catch ( NumberFormatException e ) |
162 | |
{ |
163 | 0 | if ( strict ) |
164 | |
{ |
165 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, null ); |
166 | |
} |
167 | |
} |
168 | |
} |
169 | 0 | return 0; |
170 | |
} |
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
|
178 | |
|
179 | |
|
180 | |
|
181 | |
private char getCharacterValue( String s, String attribute, XmlPullParser parser ) |
182 | |
throws XmlPullParserException |
183 | |
{ |
184 | 0 | if ( s != null ) |
185 | |
{ |
186 | 0 | return s.charAt( 0 ); |
187 | |
} |
188 | 0 | return 0; |
189 | |
} |
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser ) |
201 | |
throws XmlPullParserException |
202 | |
{ |
203 | 0 | return getDateValue( s, attribute, null, parser ); |
204 | |
} |
205 | |
|
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | |
|
211 | |
|
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser ) |
217 | |
throws XmlPullParserException |
218 | |
{ |
219 | 0 | if ( s != null ) |
220 | |
{ |
221 | 0 | String effectiveDateFormat = dateFormat; |
222 | 0 | if ( dateFormat == null ) |
223 | |
{ |
224 | 0 | effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"; |
225 | |
} |
226 | 0 | if ( "long".equals( effectiveDateFormat ) ) |
227 | |
{ |
228 | |
try |
229 | |
{ |
230 | 0 | return new java.util.Date( Long.parseLong( s ) ); |
231 | |
} |
232 | 0 | catch ( NumberFormatException e ) |
233 | |
{ |
234 | 0 | throw new XmlPullParserException( e.getMessage() ); |
235 | |
} |
236 | |
} |
237 | |
else |
238 | |
{ |
239 | |
try |
240 | |
{ |
241 | 0 | DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, Locale.US ); |
242 | 0 | return dateParser.parse( s ); |
243 | |
} |
244 | 0 | catch ( java.text.ParseException e ) |
245 | |
{ |
246 | 0 | throw new XmlPullParserException( e.getMessage() ); |
247 | |
} |
248 | |
} |
249 | |
} |
250 | 0 | return null; |
251 | |
} |
252 | |
|
253 | |
|
254 | |
|
255 | |
|
256 | |
|
257 | |
|
258 | |
|
259 | |
|
260 | |
|
261 | |
|
262 | |
|
263 | |
private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
264 | |
throws XmlPullParserException |
265 | |
{ |
266 | 0 | if ( s != null ) |
267 | |
{ |
268 | |
try |
269 | |
{ |
270 | 0 | return Double.valueOf( s ).doubleValue(); |
271 | |
} |
272 | 0 | catch ( NumberFormatException e ) |
273 | |
{ |
274 | 0 | if ( strict ) |
275 | |
{ |
276 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null ); |
277 | |
} |
278 | |
} |
279 | |
} |
280 | 0 | return 0; |
281 | |
} |
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
|
287 | |
|
288 | |
|
289 | |
|
290 | |
|
291 | |
|
292 | |
|
293 | |
private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
294 | |
throws XmlPullParserException |
295 | |
{ |
296 | 0 | if ( s != null ) |
297 | |
{ |
298 | |
try |
299 | |
{ |
300 | 0 | return Float.valueOf( s ).floatValue(); |
301 | |
} |
302 | 0 | catch ( NumberFormatException e ) |
303 | |
{ |
304 | 0 | if ( strict ) |
305 | |
{ |
306 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null ); |
307 | |
} |
308 | |
} |
309 | |
} |
310 | 0 | return 0; |
311 | |
} |
312 | |
|
313 | |
|
314 | |
|
315 | |
|
316 | |
|
317 | |
|
318 | |
|
319 | |
|
320 | |
|
321 | |
|
322 | |
|
323 | |
private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
324 | |
throws XmlPullParserException |
325 | |
{ |
326 | 2 | if ( s != null ) |
327 | |
{ |
328 | |
try |
329 | |
{ |
330 | 2 | return Integer.valueOf( s ).intValue(); |
331 | |
} |
332 | 0 | catch ( NumberFormatException e ) |
333 | |
{ |
334 | 0 | if ( strict ) |
335 | |
{ |
336 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, null ); |
337 | |
} |
338 | |
} |
339 | |
} |
340 | 0 | return 0; |
341 | |
} |
342 | |
|
343 | |
|
344 | |
|
345 | |
|
346 | |
|
347 | |
|
348 | |
|
349 | |
|
350 | |
|
351 | |
|
352 | |
|
353 | |
private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
354 | |
throws XmlPullParserException |
355 | |
{ |
356 | 0 | if ( s != null ) |
357 | |
{ |
358 | |
try |
359 | |
{ |
360 | 0 | return Long.valueOf( s ).longValue(); |
361 | |
} |
362 | 0 | catch ( NumberFormatException e ) |
363 | |
{ |
364 | 0 | if ( strict ) |
365 | |
{ |
366 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, null ); |
367 | |
} |
368 | |
} |
369 | |
} |
370 | 0 | return 0; |
371 | |
} |
372 | |
|
373 | |
|
374 | |
|
375 | |
|
376 | |
|
377 | |
|
378 | |
|
379 | |
|
380 | |
|
381 | |
|
382 | |
|
383 | |
private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
384 | |
throws XmlPullParserException |
385 | |
{ |
386 | 0 | if ( s == null ) |
387 | |
{ |
388 | 0 | if ( strict ) |
389 | |
{ |
390 | 0 | throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null ); |
391 | |
} |
392 | |
} |
393 | 0 | return s; |
394 | |
} |
395 | |
|
396 | |
|
397 | |
|
398 | |
|
399 | |
|
400 | |
|
401 | |
|
402 | |
|
403 | |
|
404 | |
|
405 | |
|
406 | |
private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict ) |
407 | |
throws XmlPullParserException |
408 | |
{ |
409 | 0 | if ( s != null ) |
410 | |
{ |
411 | |
try |
412 | |
{ |
413 | 0 | return Short.valueOf( s ).shortValue(); |
414 | |
} |
415 | 0 | catch ( NumberFormatException e ) |
416 | |
{ |
417 | 0 | if ( strict ) |
418 | |
{ |
419 | 0 | throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, null ); |
420 | |
} |
421 | |
} |
422 | |
} |
423 | 0 | return 0; |
424 | |
} |
425 | |
|
426 | |
|
427 | |
|
428 | |
|
429 | |
|
430 | |
|
431 | |
|
432 | |
private String getTrimmedValue( String s ) |
433 | |
{ |
434 | 14 | if ( s != null ) |
435 | |
{ |
436 | 14 | s = s.trim(); |
437 | |
} |
438 | 14 | return s; |
439 | |
} |
440 | |
|
441 | |
|
442 | |
|
443 | |
|
444 | |
|
445 | |
|
446 | |
|
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
private Activation parseActivation( String tagName, XmlPullParser parser, boolean strict ) |
452 | |
throws IOException, XmlPullParserException |
453 | |
{ |
454 | 0 | Activation activation = new Activation(); |
455 | 0 | java.util.Set parsed = new java.util.HashSet(); |
456 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
457 | |
{ |
458 | 0 | if ( checkFieldWithDuplicate( parser, "activeByDefault", null, parsed ) ) |
459 | |
{ |
460 | 0 | activation.setActiveByDefault( getBooleanValue( getTrimmedValue( parser.nextText() ), "activeByDefault", parser, "false" ) ); |
461 | |
} |
462 | 0 | else if ( checkFieldWithDuplicate( parser, "jdk", null, parsed ) ) |
463 | |
{ |
464 | 0 | activation.setJdk( getTrimmedValue( parser.nextText() ) ); |
465 | |
} |
466 | 0 | else if ( checkFieldWithDuplicate( parser, "os", null, parsed ) ) |
467 | |
{ |
468 | 0 | activation.setOs( parseActivationOS( "os", parser, strict ) ); |
469 | |
} |
470 | 0 | else if ( checkFieldWithDuplicate( parser, "property", null, parsed ) ) |
471 | |
{ |
472 | 0 | activation.setProperty( parseActivationProperty( "property", parser, strict ) ); |
473 | |
} |
474 | 0 | else if ( checkFieldWithDuplicate( parser, "file", null, parsed ) ) |
475 | |
{ |
476 | 0 | activation.setFile( parseActivationFile( "file", parser, strict ) ); |
477 | |
} |
478 | |
else |
479 | |
{ |
480 | 0 | if ( strict ) |
481 | |
{ |
482 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
483 | |
} |
484 | |
else |
485 | |
{ |
486 | |
|
487 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
488 | |
} |
489 | |
} |
490 | |
} |
491 | 0 | return activation; |
492 | |
} |
493 | |
|
494 | |
|
495 | |
|
496 | |
|
497 | |
|
498 | |
|
499 | |
|
500 | |
|
501 | |
|
502 | |
|
503 | |
|
504 | |
private ActivationFile parseActivationFile( String tagName, XmlPullParser parser, boolean strict ) |
505 | |
throws IOException, XmlPullParserException |
506 | |
{ |
507 | 0 | ActivationFile activationFile = new ActivationFile(); |
508 | 0 | java.util.Set parsed = new java.util.HashSet(); |
509 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
510 | |
{ |
511 | 0 | if ( checkFieldWithDuplicate( parser, "missing", null, parsed ) ) |
512 | |
{ |
513 | 0 | activationFile.setMissing( getTrimmedValue( parser.nextText() ) ); |
514 | |
} |
515 | 0 | else if ( checkFieldWithDuplicate( parser, "exists", null, parsed ) ) |
516 | |
{ |
517 | 0 | activationFile.setExists( getTrimmedValue( parser.nextText() ) ); |
518 | |
} |
519 | |
else |
520 | |
{ |
521 | 0 | if ( strict ) |
522 | |
{ |
523 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
524 | |
} |
525 | |
else |
526 | |
{ |
527 | |
|
528 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
529 | |
} |
530 | |
} |
531 | |
} |
532 | 0 | return activationFile; |
533 | |
} |
534 | |
|
535 | |
|
536 | |
|
537 | |
|
538 | |
|
539 | |
|
540 | |
|
541 | |
|
542 | |
|
543 | |
|
544 | |
|
545 | |
private ActivationOS parseActivationOS( String tagName, XmlPullParser parser, boolean strict ) |
546 | |
throws IOException, XmlPullParserException |
547 | |
{ |
548 | 0 | ActivationOS activationOS = new ActivationOS(); |
549 | 0 | java.util.Set parsed = new java.util.HashSet(); |
550 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
551 | |
{ |
552 | 0 | if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) |
553 | |
{ |
554 | 0 | activationOS.setName( getTrimmedValue( parser.nextText() ) ); |
555 | |
} |
556 | 0 | else if ( checkFieldWithDuplicate( parser, "family", null, parsed ) ) |
557 | |
{ |
558 | 0 | activationOS.setFamily( getTrimmedValue( parser.nextText() ) ); |
559 | |
} |
560 | 0 | else if ( checkFieldWithDuplicate( parser, "arch", null, parsed ) ) |
561 | |
{ |
562 | 0 | activationOS.setArch( getTrimmedValue( parser.nextText() ) ); |
563 | |
} |
564 | 0 | else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) ) |
565 | |
{ |
566 | 0 | activationOS.setVersion( getTrimmedValue( parser.nextText() ) ); |
567 | |
} |
568 | |
else |
569 | |
{ |
570 | 0 | if ( strict ) |
571 | |
{ |
572 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
573 | |
} |
574 | |
else |
575 | |
{ |
576 | |
|
577 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
578 | |
} |
579 | |
} |
580 | |
} |
581 | 0 | return activationOS; |
582 | |
} |
583 | |
|
584 | |
|
585 | |
|
586 | |
|
587 | |
|
588 | |
|
589 | |
|
590 | |
|
591 | |
|
592 | |
|
593 | |
|
594 | |
private ActivationProperty parseActivationProperty( String tagName, XmlPullParser parser, boolean strict ) |
595 | |
throws IOException, XmlPullParserException |
596 | |
{ |
597 | 0 | ActivationProperty activationProperty = new ActivationProperty(); |
598 | 0 | java.util.Set parsed = new java.util.HashSet(); |
599 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
600 | |
{ |
601 | 0 | if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) |
602 | |
{ |
603 | 0 | activationProperty.setName( getTrimmedValue( parser.nextText() ) ); |
604 | |
} |
605 | 0 | else if ( checkFieldWithDuplicate( parser, "value", null, parsed ) ) |
606 | |
{ |
607 | 0 | activationProperty.setValue( getTrimmedValue( parser.nextText() ) ); |
608 | |
} |
609 | |
else |
610 | |
{ |
611 | 0 | if ( strict ) |
612 | |
{ |
613 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
614 | |
} |
615 | |
else |
616 | |
{ |
617 | |
|
618 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
619 | |
} |
620 | |
} |
621 | |
} |
622 | 0 | return activationProperty; |
623 | |
} |
624 | |
|
625 | |
|
626 | |
|
627 | |
|
628 | |
|
629 | |
|
630 | |
|
631 | |
|
632 | |
|
633 | |
|
634 | |
|
635 | |
private IdentifiableBase parseIdentifiableBase( String tagName, XmlPullParser parser, boolean strict ) |
636 | |
throws IOException, XmlPullParserException |
637 | |
{ |
638 | 0 | IdentifiableBase identifiableBase = new IdentifiableBase(); |
639 | 0 | java.util.Set parsed = new java.util.HashSet(); |
640 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
641 | |
{ |
642 | 0 | if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) |
643 | |
{ |
644 | 0 | identifiableBase.setId( getTrimmedValue( parser.nextText() ) ); |
645 | |
} |
646 | |
else |
647 | |
{ |
648 | 0 | if ( strict ) |
649 | |
{ |
650 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
651 | |
} |
652 | |
else |
653 | |
{ |
654 | |
|
655 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
656 | |
} |
657 | |
} |
658 | |
} |
659 | 0 | return identifiableBase; |
660 | |
} |
661 | |
|
662 | |
|
663 | |
|
664 | |
|
665 | |
|
666 | |
|
667 | |
|
668 | |
|
669 | |
|
670 | |
|
671 | |
|
672 | |
private Mirror parseMirror( String tagName, XmlPullParser parser, boolean strict ) |
673 | |
throws IOException, XmlPullParserException |
674 | |
{ |
675 | 0 | Mirror mirror = new Mirror(); |
676 | 0 | java.util.Set parsed = new java.util.HashSet(); |
677 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
678 | |
{ |
679 | 0 | if ( checkFieldWithDuplicate( parser, "mirrorOf", null, parsed ) ) |
680 | |
{ |
681 | 0 | mirror.setMirrorOf( getTrimmedValue( parser.nextText() ) ); |
682 | |
} |
683 | 0 | else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) |
684 | |
{ |
685 | 0 | mirror.setName( getTrimmedValue( parser.nextText() ) ); |
686 | |
} |
687 | 0 | else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) ) |
688 | |
{ |
689 | 0 | mirror.setUrl( getTrimmedValue( parser.nextText() ) ); |
690 | |
} |
691 | 0 | else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) |
692 | |
{ |
693 | 0 | mirror.setId( getTrimmedValue( parser.nextText() ) ); |
694 | |
} |
695 | |
else |
696 | |
{ |
697 | 0 | if ( strict ) |
698 | |
{ |
699 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
700 | |
} |
701 | |
else |
702 | |
{ |
703 | |
|
704 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
705 | |
} |
706 | |
} |
707 | |
} |
708 | 0 | return mirror; |
709 | |
} |
710 | |
|
711 | |
|
712 | |
|
713 | |
|
714 | |
|
715 | |
|
716 | |
|
717 | |
|
718 | |
|
719 | |
|
720 | |
|
721 | |
private Profile parseProfile( String tagName, XmlPullParser parser, boolean strict ) |
722 | |
throws IOException, XmlPullParserException |
723 | |
{ |
724 | 0 | Profile profile = new Profile(); |
725 | 0 | java.util.Set parsed = new java.util.HashSet(); |
726 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
727 | |
{ |
728 | 0 | if ( checkFieldWithDuplicate( parser, "activation", null, parsed ) ) |
729 | |
{ |
730 | 0 | profile.setActivation( parseActivation( "activation", parser, strict ) ); |
731 | |
} |
732 | 0 | else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) ) |
733 | |
{ |
734 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
735 | |
{ |
736 | 0 | String key = parser.getName(); |
737 | 0 | String value = parser.nextText().trim(); |
738 | 0 | profile.addProperty( key, value ); |
739 | |
} |
740 | |
} |
741 | 0 | else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) ) |
742 | |
{ |
743 | 0 | java.util.List repositories = new java.util.ArrayList(); |
744 | 0 | profile.setRepositories( repositories ); |
745 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
746 | |
{ |
747 | 0 | if ( parser.getName().equals( "repository" ) ) |
748 | |
{ |
749 | 0 | repositories.add( parseRepository( "repository", parser, strict ) ); |
750 | |
} |
751 | 0 | else if ( strict ) |
752 | |
{ |
753 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
754 | |
} |
755 | |
else |
756 | |
{ |
757 | |
|
758 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
759 | |
} |
760 | |
} |
761 | |
} |
762 | 0 | else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) ) |
763 | |
{ |
764 | 0 | java.util.List pluginRepositories = new java.util.ArrayList(); |
765 | 0 | profile.setPluginRepositories( pluginRepositories ); |
766 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
767 | |
{ |
768 | 0 | if ( parser.getName().equals( "pluginRepository" ) ) |
769 | |
{ |
770 | 0 | pluginRepositories.add( parseRepository( "pluginRepository", parser, strict ) ); |
771 | |
} |
772 | 0 | else if ( strict ) |
773 | |
{ |
774 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
775 | |
} |
776 | |
else |
777 | |
{ |
778 | |
|
779 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
780 | |
} |
781 | |
} |
782 | |
} |
783 | 0 | else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) |
784 | |
{ |
785 | 0 | profile.setId( getTrimmedValue( parser.nextText() ) ); |
786 | |
} |
787 | |
else |
788 | |
{ |
789 | 0 | if ( strict ) |
790 | |
{ |
791 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
792 | |
} |
793 | |
else |
794 | |
{ |
795 | |
|
796 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
797 | |
} |
798 | |
} |
799 | |
} |
800 | 0 | return profile; |
801 | |
} |
802 | |
|
803 | |
|
804 | |
|
805 | |
|
806 | |
|
807 | |
|
808 | |
|
809 | |
|
810 | |
|
811 | |
|
812 | |
|
813 | |
private Proxy parseProxy( String tagName, XmlPullParser parser, boolean strict ) |
814 | |
throws IOException, XmlPullParserException |
815 | |
{ |
816 | 2 | Proxy proxy = new Proxy(); |
817 | 2 | java.util.Set parsed = new java.util.HashSet(); |
818 | 16 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
819 | |
{ |
820 | 14 | if ( checkFieldWithDuplicate( parser, "active", null, parsed ) ) |
821 | |
{ |
822 | 2 | proxy.setActive( getBooleanValue( getTrimmedValue( parser.nextText() ), "active", parser, "true" ) ); |
823 | |
} |
824 | 12 | else if ( checkFieldWithDuplicate( parser, "protocol", null, parsed ) ) |
825 | |
{ |
826 | 2 | proxy.setProtocol( getTrimmedValue( parser.nextText() ) ); |
827 | |
} |
828 | 10 | else if ( checkFieldWithDuplicate( parser, "username", null, parsed ) ) |
829 | |
{ |
830 | 2 | proxy.setUsername( getTrimmedValue( parser.nextText() ) ); |
831 | |
} |
832 | 8 | else if ( checkFieldWithDuplicate( parser, "password", null, parsed ) ) |
833 | |
{ |
834 | 2 | proxy.setPassword( getTrimmedValue( parser.nextText() ) ); |
835 | |
} |
836 | 6 | else if ( checkFieldWithDuplicate( parser, "port", null, parsed ) ) |
837 | |
{ |
838 | 2 | proxy.setPort( getIntegerValue( getTrimmedValue( parser.nextText() ), "port", parser, strict ) ); |
839 | |
} |
840 | 4 | else if ( checkFieldWithDuplicate( parser, "host", null, parsed ) ) |
841 | |
{ |
842 | 2 | proxy.setHost( getTrimmedValue( parser.nextText() ) ); |
843 | |
} |
844 | 2 | else if ( checkFieldWithDuplicate( parser, "nonProxyHosts", null, parsed ) ) |
845 | |
{ |
846 | 2 | proxy.setNonProxyHosts( getTrimmedValue( parser.nextText() ) ); |
847 | |
} |
848 | 0 | else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) |
849 | |
{ |
850 | 0 | proxy.setId( getTrimmedValue( parser.nextText() ) ); |
851 | |
} |
852 | |
else |
853 | |
{ |
854 | 0 | if ( strict ) |
855 | |
{ |
856 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
857 | |
} |
858 | |
else |
859 | |
{ |
860 | |
|
861 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
862 | |
} |
863 | |
} |
864 | |
} |
865 | 2 | return proxy; |
866 | |
} |
867 | |
|
868 | |
|
869 | |
|
870 | |
|
871 | |
|
872 | |
|
873 | |
|
874 | |
|
875 | |
|
876 | |
|
877 | |
|
878 | |
private Repository parseRepository( String tagName, XmlPullParser parser, boolean strict ) |
879 | |
throws IOException, XmlPullParserException |
880 | |
{ |
881 | 0 | Repository repository = new Repository(); |
882 | 0 | java.util.Set parsed = new java.util.HashSet(); |
883 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
884 | |
{ |
885 | 0 | if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) ) |
886 | |
{ |
887 | 0 | repository.setReleases( parseRepositoryPolicy( "releases", parser, strict ) ); |
888 | |
} |
889 | 0 | else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) ) |
890 | |
{ |
891 | 0 | repository.setSnapshots( parseRepositoryPolicy( "snapshots", parser, strict ) ); |
892 | |
} |
893 | 0 | else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) |
894 | |
{ |
895 | 0 | repository.setId( getTrimmedValue( parser.nextText() ) ); |
896 | |
} |
897 | 0 | else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) |
898 | |
{ |
899 | 0 | repository.setName( getTrimmedValue( parser.nextText() ) ); |
900 | |
} |
901 | 0 | else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) ) |
902 | |
{ |
903 | 0 | repository.setUrl( getTrimmedValue( parser.nextText() ) ); |
904 | |
} |
905 | 0 | else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) ) |
906 | |
{ |
907 | 0 | repository.setLayout( getTrimmedValue( parser.nextText() ) ); |
908 | |
} |
909 | |
else |
910 | |
{ |
911 | 0 | if ( strict ) |
912 | |
{ |
913 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
914 | |
} |
915 | |
else |
916 | |
{ |
917 | |
|
918 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
919 | |
} |
920 | |
} |
921 | |
} |
922 | 0 | return repository; |
923 | |
} |
924 | |
|
925 | |
|
926 | |
|
927 | |
|
928 | |
|
929 | |
|
930 | |
|
931 | |
|
932 | |
|
933 | |
|
934 | |
|
935 | |
private RepositoryBase parseRepositoryBase( String tagName, XmlPullParser parser, boolean strict ) |
936 | |
throws IOException, XmlPullParserException |
937 | |
{ |
938 | 0 | RepositoryBase repositoryBase = new RepositoryBase(); |
939 | 0 | java.util.Set parsed = new java.util.HashSet(); |
940 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
941 | |
{ |
942 | 0 | if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) |
943 | |
{ |
944 | 0 | repositoryBase.setId( getTrimmedValue( parser.nextText() ) ); |
945 | |
} |
946 | 0 | else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) |
947 | |
{ |
948 | 0 | repositoryBase.setName( getTrimmedValue( parser.nextText() ) ); |
949 | |
} |
950 | 0 | else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) ) |
951 | |
{ |
952 | 0 | repositoryBase.setUrl( getTrimmedValue( parser.nextText() ) ); |
953 | |
} |
954 | 0 | else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) ) |
955 | |
{ |
956 | 0 | repositoryBase.setLayout( getTrimmedValue( parser.nextText() ) ); |
957 | |
} |
958 | |
else |
959 | |
{ |
960 | 0 | if ( strict ) |
961 | |
{ |
962 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
963 | |
} |
964 | |
else |
965 | |
{ |
966 | |
|
967 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
968 | |
} |
969 | |
} |
970 | |
} |
971 | 0 | return repositoryBase; |
972 | |
} |
973 | |
|
974 | |
|
975 | |
|
976 | |
|
977 | |
|
978 | |
|
979 | |
|
980 | |
|
981 | |
|
982 | |
|
983 | |
|
984 | |
private RepositoryPolicy parseRepositoryPolicy( String tagName, XmlPullParser parser, boolean strict ) |
985 | |
throws IOException, XmlPullParserException |
986 | |
{ |
987 | 0 | RepositoryPolicy repositoryPolicy = new RepositoryPolicy(); |
988 | 0 | java.util.Set parsed = new java.util.HashSet(); |
989 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
990 | |
{ |
991 | 0 | if ( checkFieldWithDuplicate( parser, "enabled", null, parsed ) ) |
992 | |
{ |
993 | 0 | repositoryPolicy.setEnabled( getBooleanValue( getTrimmedValue( parser.nextText() ), "enabled", parser, "true" ) ); |
994 | |
} |
995 | 0 | else if ( checkFieldWithDuplicate( parser, "updatePolicy", null, parsed ) ) |
996 | |
{ |
997 | 0 | repositoryPolicy.setUpdatePolicy( getTrimmedValue( parser.nextText() ) ); |
998 | |
} |
999 | 0 | else if ( checkFieldWithDuplicate( parser, "checksumPolicy", null, parsed ) ) |
1000 | |
{ |
1001 | 0 | repositoryPolicy.setChecksumPolicy( getTrimmedValue( parser.nextText() ) ); |
1002 | |
} |
1003 | |
else |
1004 | |
{ |
1005 | 0 | if ( strict ) |
1006 | |
{ |
1007 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
1008 | |
} |
1009 | |
else |
1010 | |
{ |
1011 | |
|
1012 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
1013 | |
} |
1014 | |
} |
1015 | |
} |
1016 | 0 | return repositoryPolicy; |
1017 | |
} |
1018 | |
|
1019 | |
|
1020 | |
|
1021 | |
|
1022 | |
|
1023 | |
|
1024 | |
|
1025 | |
|
1026 | |
|
1027 | |
|
1028 | |
|
1029 | |
private Server parseServer( String tagName, XmlPullParser parser, boolean strict ) |
1030 | |
throws IOException, XmlPullParserException |
1031 | |
{ |
1032 | 0 | Server server = new Server(); |
1033 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1034 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1035 | |
{ |
1036 | 0 | if ( checkFieldWithDuplicate( parser, "username", null, parsed ) ) |
1037 | |
{ |
1038 | 0 | server.setUsername( getTrimmedValue( parser.nextText() ) ); |
1039 | |
} |
1040 | 0 | else if ( checkFieldWithDuplicate( parser, "password", null, parsed ) ) |
1041 | |
{ |
1042 | 0 | server.setPassword( getTrimmedValue( parser.nextText() ) ); |
1043 | |
} |
1044 | 0 | else if ( checkFieldWithDuplicate( parser, "privateKey", null, parsed ) ) |
1045 | |
{ |
1046 | 0 | server.setPrivateKey( getTrimmedValue( parser.nextText() ) ); |
1047 | |
} |
1048 | 0 | else if ( checkFieldWithDuplicate( parser, "passphrase", null, parsed ) ) |
1049 | |
{ |
1050 | 0 | server.setPassphrase( getTrimmedValue( parser.nextText() ) ); |
1051 | |
} |
1052 | 0 | else if ( checkFieldWithDuplicate( parser, "filePermissions", null, parsed ) ) |
1053 | |
{ |
1054 | 0 | server.setFilePermissions( getTrimmedValue( parser.nextText() ) ); |
1055 | |
} |
1056 | 0 | else if ( checkFieldWithDuplicate( parser, "directoryPermissions", null, parsed ) ) |
1057 | |
{ |
1058 | 0 | server.setDirectoryPermissions( getTrimmedValue( parser.nextText() ) ); |
1059 | |
} |
1060 | 0 | else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) ) |
1061 | |
{ |
1062 | 0 | server.setConfiguration( Xpp3DomBuilder.build( parser ) ); |
1063 | |
} |
1064 | 0 | else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) |
1065 | |
{ |
1066 | 0 | server.setId( getTrimmedValue( parser.nextText() ) ); |
1067 | |
} |
1068 | |
else |
1069 | |
{ |
1070 | 0 | if ( strict ) |
1071 | |
{ |
1072 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
1073 | |
} |
1074 | |
else |
1075 | |
{ |
1076 | |
|
1077 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
1078 | |
} |
1079 | |
} |
1080 | |
} |
1081 | 0 | return server; |
1082 | |
} |
1083 | |
|
1084 | |
|
1085 | |
|
1086 | |
|
1087 | |
|
1088 | |
|
1089 | |
|
1090 | |
|
1091 | |
|
1092 | |
|
1093 | |
|
1094 | |
private Settings parseSettings( String tagName, XmlPullParser parser, boolean strict ) |
1095 | |
throws IOException, XmlPullParserException |
1096 | |
{ |
1097 | 3 | Settings settings = new Settings(); |
1098 | 3 | java.util.Set parsed = new java.util.HashSet(); |
1099 | 3 | int eventType = parser.getEventType(); |
1100 | 3 | boolean foundRoot = false; |
1101 | 18 | while ( eventType != XmlPullParser.END_DOCUMENT ) |
1102 | |
{ |
1103 | 15 | if ( eventType == XmlPullParser.START_TAG ) |
1104 | |
{ |
1105 | 6 | if ( parser.getName().equals( tagName ) ) |
1106 | |
{ |
1107 | 3 | foundRoot = true; |
1108 | |
} |
1109 | 3 | else if ( strict && ! foundRoot ) |
1110 | |
{ |
1111 | 0 | throw new XmlPullParserException( "Expected root element '" + tagName + "' but found '" + parser.getName() + "'", parser, null ); |
1112 | |
} |
1113 | 3 | else if ( checkFieldWithDuplicate( parser, "localRepository", null, parsed ) ) |
1114 | |
{ |
1115 | 0 | settings.setLocalRepository( getTrimmedValue( parser.nextText() ) ); |
1116 | |
} |
1117 | 3 | else if ( checkFieldWithDuplicate( parser, "interactiveMode", null, parsed ) ) |
1118 | |
{ |
1119 | 0 | settings.setInteractiveMode( getBooleanValue( getTrimmedValue( parser.nextText() ), "interactiveMode", parser, "true" ) ); |
1120 | |
} |
1121 | 3 | else if ( checkFieldWithDuplicate( parser, "usePluginRegistry", null, parsed ) ) |
1122 | |
{ |
1123 | 0 | settings.setUsePluginRegistry( getBooleanValue( getTrimmedValue( parser.nextText() ), "usePluginRegistry", parser, "false" ) ); |
1124 | |
} |
1125 | 3 | else if ( checkFieldWithDuplicate( parser, "offline", null, parsed ) ) |
1126 | |
{ |
1127 | 0 | settings.setOffline( getBooleanValue( getTrimmedValue( parser.nextText() ), "offline", parser, "false" ) ); |
1128 | |
} |
1129 | 3 | else if ( checkFieldWithDuplicate( parser, "proxies", null, parsed ) ) |
1130 | |
{ |
1131 | 3 | java.util.List proxies = new java.util.ArrayList(); |
1132 | 3 | settings.setProxies( proxies ); |
1133 | 5 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1134 | |
{ |
1135 | 2 | if ( parser.getName().equals( "proxy" ) ) |
1136 | |
{ |
1137 | 2 | proxies.add( parseProxy( "proxy", parser, strict ) ); |
1138 | |
} |
1139 | 0 | else if ( strict ) |
1140 | |
{ |
1141 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
1142 | |
} |
1143 | |
else |
1144 | |
{ |
1145 | |
|
1146 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
1147 | |
} |
1148 | |
} |
1149 | |
} |
1150 | 0 | else if ( checkFieldWithDuplicate( parser, "servers", null, parsed ) ) |
1151 | |
{ |
1152 | 0 | java.util.List servers = new java.util.ArrayList(); |
1153 | 0 | settings.setServers( servers ); |
1154 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1155 | |
{ |
1156 | 0 | if ( parser.getName().equals( "server" ) ) |
1157 | |
{ |
1158 | 0 | servers.add( parseServer( "server", parser, strict ) ); |
1159 | |
} |
1160 | 0 | else if ( strict ) |
1161 | |
{ |
1162 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
1163 | |
} |
1164 | |
else |
1165 | |
{ |
1166 | |
|
1167 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
1168 | |
} |
1169 | |
} |
1170 | |
} |
1171 | 0 | else if ( checkFieldWithDuplicate( parser, "mirrors", null, parsed ) ) |
1172 | |
{ |
1173 | 0 | java.util.List mirrors = new java.util.ArrayList(); |
1174 | 0 | settings.setMirrors( mirrors ); |
1175 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1176 | |
{ |
1177 | 0 | if ( parser.getName().equals( "mirror" ) ) |
1178 | |
{ |
1179 | 0 | mirrors.add( parseMirror( "mirror", parser, strict ) ); |
1180 | |
} |
1181 | 0 | else if ( strict ) |
1182 | |
{ |
1183 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
1184 | |
} |
1185 | |
else |
1186 | |
{ |
1187 | |
|
1188 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
1189 | |
} |
1190 | |
} |
1191 | |
} |
1192 | 0 | else if ( checkFieldWithDuplicate( parser, "profiles", null, parsed ) ) |
1193 | |
{ |
1194 | 0 | java.util.List profiles = new java.util.ArrayList(); |
1195 | 0 | settings.setProfiles( profiles ); |
1196 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1197 | |
{ |
1198 | 0 | if ( parser.getName().equals( "profile" ) ) |
1199 | |
{ |
1200 | 0 | profiles.add( parseProfile( "profile", parser, strict ) ); |
1201 | |
} |
1202 | 0 | else if ( strict ) |
1203 | |
{ |
1204 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
1205 | |
} |
1206 | |
else |
1207 | |
{ |
1208 | |
|
1209 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
1210 | |
} |
1211 | |
} |
1212 | |
} |
1213 | 0 | else if ( checkFieldWithDuplicate( parser, "activeProfiles", null, parsed ) ) |
1214 | |
{ |
1215 | 0 | java.util.List activeProfiles = new java.util.ArrayList(); |
1216 | 0 | settings.setActiveProfiles( activeProfiles ); |
1217 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1218 | |
{ |
1219 | 0 | if ( parser.getName().equals( "activeProfile" ) ) |
1220 | |
{ |
1221 | 0 | activeProfiles.add( getTrimmedValue( parser.nextText() ) ); |
1222 | |
} |
1223 | 0 | else if ( strict ) |
1224 | |
{ |
1225 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
1226 | |
} |
1227 | |
else |
1228 | |
{ |
1229 | |
|
1230 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
1231 | |
} |
1232 | |
} |
1233 | |
} |
1234 | 0 | else if ( checkFieldWithDuplicate( parser, "pluginGroups", null, parsed ) ) |
1235 | |
{ |
1236 | 0 | java.util.List pluginGroups = new java.util.ArrayList(); |
1237 | 0 | settings.setPluginGroups( pluginGroups ); |
1238 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1239 | |
{ |
1240 | 0 | if ( parser.getName().equals( "pluginGroup" ) ) |
1241 | |
{ |
1242 | 0 | pluginGroups.add( getTrimmedValue( parser.nextText() ) ); |
1243 | |
} |
1244 | 0 | else if ( strict ) |
1245 | |
{ |
1246 | 0 | throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null ); |
1247 | |
} |
1248 | |
else |
1249 | |
{ |
1250 | |
|
1251 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
1252 | |
} |
1253 | |
} |
1254 | |
} |
1255 | 0 | else if ( strict ) |
1256 | |
{ |
1257 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
1258 | |
} |
1259 | |
} |
1260 | 15 | eventType = parser.next(); |
1261 | |
} |
1262 | 3 | return settings; |
1263 | |
} |
1264 | |
|
1265 | |
|
1266 | |
|
1267 | |
|
1268 | |
|
1269 | |
|
1270 | |
|
1271 | |
|
1272 | |
|
1273 | |
|
1274 | |
|
1275 | |
private TrackableBase parseTrackableBase( String tagName, XmlPullParser parser, boolean strict ) |
1276 | |
throws IOException, XmlPullParserException |
1277 | |
{ |
1278 | 0 | TrackableBase trackableBase = new TrackableBase(); |
1279 | 0 | java.util.Set parsed = new java.util.HashSet(); |
1280 | 0 | while ( parser.nextTag() == XmlPullParser.START_TAG ) |
1281 | |
{ |
1282 | 0 | if ( strict ) |
1283 | |
{ |
1284 | 0 | throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); |
1285 | |
} |
1286 | |
else |
1287 | |
{ |
1288 | |
|
1289 | 0 | while ( parser.next() != XmlPullParser.END_TAG ) {} |
1290 | |
} |
1291 | |
} |
1292 | 0 | return trackableBase; |
1293 | |
} |
1294 | |
|
1295 | |
|
1296 | |
|
1297 | |
|
1298 | |
|
1299 | |
|
1300 | |
|
1301 | |
|
1302 | |
|
1303 | |
|
1304 | |
public Settings read( Reader reader, boolean strict ) |
1305 | |
throws IOException, XmlPullParserException |
1306 | |
{ |
1307 | 3 | XmlPullParser parser = new MXParser(); |
1308 | |
|
1309 | 3 | parser.setInput( reader ); |
1310 | |
|
1311 | 3 | if ( addDefaultEntities ) |
1312 | |
{ |
1313 | |
|
1314 | |
|
1315 | |
|
1316 | |
|
1317 | 3 | parser.defineEntityReplacementText( "nbsp", "\u00a0" ); |
1318 | 3 | parser.defineEntityReplacementText( "iexcl", "\u00a1" ); |
1319 | 3 | parser.defineEntityReplacementText( "cent", "\u00a2" ); |
1320 | 3 | parser.defineEntityReplacementText( "pound", "\u00a3" ); |
1321 | 3 | parser.defineEntityReplacementText( "curren", "\u00a4" ); |
1322 | 3 | parser.defineEntityReplacementText( "yen", "\u00a5" ); |
1323 | 3 | parser.defineEntityReplacementText( "brvbar", "\u00a6" ); |
1324 | 3 | parser.defineEntityReplacementText( "sect", "\u00a7" ); |
1325 | 3 | parser.defineEntityReplacementText( "uml", "\u00a8" ); |
1326 | 3 | parser.defineEntityReplacementText( "copy", "\u00a9" ); |
1327 | 3 | parser.defineEntityReplacementText( "ordf", "\u00aa" ); |
1328 | 3 | parser.defineEntityReplacementText( "laquo", "\u00ab" ); |
1329 | 3 | parser.defineEntityReplacementText( "not", "\u00ac" ); |
1330 | 3 | parser.defineEntityReplacementText( "shy", "\u00ad" ); |
1331 | 3 | parser.defineEntityReplacementText( "reg", "\u00ae" ); |
1332 | 3 | parser.defineEntityReplacementText( "macr", "\u00af" ); |
1333 | 3 | parser.defineEntityReplacementText( "deg", "\u00b0" ); |
1334 | 3 | parser.defineEntityReplacementText( "plusmn", "\u00b1" ); |
1335 | 3 | parser.defineEntityReplacementText( "sup2", "\u00b2" ); |
1336 | 3 | parser.defineEntityReplacementText( "sup3", "\u00b3" ); |
1337 | 3 | parser.defineEntityReplacementText( "acute", "\u00b4" ); |
1338 | 3 | parser.defineEntityReplacementText( "micro", "\u00b5" ); |
1339 | 3 | parser.defineEntityReplacementText( "para", "\u00b6" ); |
1340 | 3 | parser.defineEntityReplacementText( "middot", "\u00b7" ); |
1341 | 3 | parser.defineEntityReplacementText( "cedil", "\u00b8" ); |
1342 | 3 | parser.defineEntityReplacementText( "sup1", "\u00b9" ); |
1343 | 3 | parser.defineEntityReplacementText( "ordm", "\u00ba" ); |
1344 | 3 | parser.defineEntityReplacementText( "raquo", "\u00bb" ); |
1345 | 3 | parser.defineEntityReplacementText( "frac14", "\u00bc" ); |
1346 | 3 | parser.defineEntityReplacementText( "frac12", "\u00bd" ); |
1347 | 3 | parser.defineEntityReplacementText( "frac34", "\u00be" ); |
1348 | 3 | parser.defineEntityReplacementText( "iquest", "\u00bf" ); |
1349 | 3 | parser.defineEntityReplacementText( "Agrave", "\u00c0" ); |
1350 | 3 | parser.defineEntityReplacementText( "Aacute", "\u00c1" ); |
1351 | 3 | parser.defineEntityReplacementText( "Acirc", "\u00c2" ); |
1352 | 3 | parser.defineEntityReplacementText( "Atilde", "\u00c3" ); |
1353 | 3 | parser.defineEntityReplacementText( "Auml", "\u00c4" ); |
1354 | 3 | parser.defineEntityReplacementText( "Aring", "\u00c5" ); |
1355 | 3 | parser.defineEntityReplacementText( "AElig", "\u00c6" ); |
1356 | 3 | parser.defineEntityReplacementText( "Ccedil", "\u00c7" ); |
1357 | 3 | parser.defineEntityReplacementText( "Egrave", "\u00c8" ); |
1358 | 3 | parser.defineEntityReplacementText( "Eacute", "\u00c9" ); |
1359 | 3 | parser.defineEntityReplacementText( "Ecirc", "\u00ca" ); |
1360 | 3 | parser.defineEntityReplacementText( "Euml", "\u00cb" ); |
1361 | 3 | parser.defineEntityReplacementText( "Igrave", "\u00cc" ); |
1362 | 3 | parser.defineEntityReplacementText( "Iacute", "\u00cd" ); |
1363 | 3 | parser.defineEntityReplacementText( "Icirc", "\u00ce" ); |
1364 | 3 | parser.defineEntityReplacementText( "Iuml", "\u00cf" ); |
1365 | 3 | parser.defineEntityReplacementText( "ETH", "\u00d0" ); |
1366 | 3 | parser.defineEntityReplacementText( "Ntilde", "\u00d1" ); |
1367 | 3 | parser.defineEntityReplacementText( "Ograve", "\u00d2" ); |
1368 | 3 | parser.defineEntityReplacementText( "Oacute", "\u00d3" ); |
1369 | 3 | parser.defineEntityReplacementText( "Ocirc", "\u00d4" ); |
1370 | 3 | parser.defineEntityReplacementText( "Otilde", "\u00d5" ); |
1371 | 3 | parser.defineEntityReplacementText( "Ouml", "\u00d6" ); |
1372 | 3 | parser.defineEntityReplacementText( "times", "\u00d7" ); |
1373 | 3 | parser.defineEntityReplacementText( "Oslash", "\u00d8" ); |
1374 | 3 | parser.defineEntityReplacementText( "Ugrave", "\u00d9" ); |
1375 | 3 | parser.defineEntityReplacementText( "Uacute", "\u00da" ); |
1376 | 3 | parser.defineEntityReplacementText( "Ucirc", "\u00db" ); |
1377 | 3 | parser.defineEntityReplacementText( "Uuml", "\u00dc" ); |
1378 | 3 | parser.defineEntityReplacementText( "Yacute", "\u00dd" ); |
1379 | 3 | parser.defineEntityReplacementText( "THORN", "\u00de" ); |
1380 | 3 | parser.defineEntityReplacementText( "szlig", "\u00df" ); |
1381 | 3 | parser.defineEntityReplacementText( "agrave", "\u00e0" ); |
1382 | 3 | parser.defineEntityReplacementText( "aacute", "\u00e1" ); |
1383 | 3 | parser.defineEntityReplacementText( "acirc", "\u00e2" ); |
1384 | 3 | parser.defineEntityReplacementText( "atilde", "\u00e3" ); |
1385 | 3 | parser.defineEntityReplacementText( "auml", "\u00e4" ); |
1386 | 3 | parser.defineEntityReplacementText( "aring", "\u00e5" ); |
1387 | 3 | parser.defineEntityReplacementText( "aelig", "\u00e6" ); |
1388 | 3 | parser.defineEntityReplacementText( "ccedil", "\u00e7" ); |
1389 | 3 | parser.defineEntityReplacementText( "egrave", "\u00e8" ); |
1390 | 3 | parser.defineEntityReplacementText( "eacute", "\u00e9" ); |
1391 | 3 | parser.defineEntityReplacementText( "ecirc", "\u00ea" ); |
1392 | 3 | parser.defineEntityReplacementText( "euml", "\u00eb" ); |
1393 | 3 | parser.defineEntityReplacementText( "igrave", "\u00ec" ); |
1394 | 3 | parser.defineEntityReplacementText( "iacute", "\u00ed" ); |
1395 | 3 | parser.defineEntityReplacementText( "icirc", "\u00ee" ); |
1396 | 3 | parser.defineEntityReplacementText( "iuml", "\u00ef" ); |
1397 | 3 | parser.defineEntityReplacementText( "eth", "\u00f0" ); |
1398 | 3 | parser.defineEntityReplacementText( "ntilde", "\u00f1" ); |
1399 | 3 | parser.defineEntityReplacementText( "ograve", "\u00f2" ); |
1400 | 3 | parser.defineEntityReplacementText( "oacute", "\u00f3" ); |
1401 | 3 | parser.defineEntityReplacementText( "ocirc", "\u00f4" ); |
1402 | 3 | parser.defineEntityReplacementText( "otilde", "\u00f5" ); |
1403 | 3 | parser.defineEntityReplacementText( "ouml", "\u00f6" ); |
1404 | 3 | parser.defineEntityReplacementText( "divide", "\u00f7" ); |
1405 | 3 | parser.defineEntityReplacementText( "oslash", "\u00f8" ); |
1406 | 3 | parser.defineEntityReplacementText( "ugrave", "\u00f9" ); |
1407 | 3 | parser.defineEntityReplacementText( "uacute", "\u00fa" ); |
1408 | 3 | parser.defineEntityReplacementText( "ucirc", "\u00fb" ); |
1409 | 3 | parser.defineEntityReplacementText( "uuml", "\u00fc" ); |
1410 | 3 | parser.defineEntityReplacementText( "yacute", "\u00fd" ); |
1411 | 3 | parser.defineEntityReplacementText( "thorn", "\u00fe" ); |
1412 | 3 | parser.defineEntityReplacementText( "yuml", "\u00ff" ); |
1413 | |
|
1414 | |
|
1415 | |
|
1416 | |
|
1417 | |
|
1418 | 3 | parser.defineEntityReplacementText( "OElig", "\u0152" ); |
1419 | 3 | parser.defineEntityReplacementText( "oelig", "\u0153" ); |
1420 | 3 | parser.defineEntityReplacementText( "Scaron", "\u0160" ); |
1421 | 3 | parser.defineEntityReplacementText( "scaron", "\u0161" ); |
1422 | 3 | parser.defineEntityReplacementText( "Yuml", "\u0178" ); |
1423 | 3 | parser.defineEntityReplacementText( "circ", "\u02c6" ); |
1424 | 3 | parser.defineEntityReplacementText( "tilde", "\u02dc" ); |
1425 | 3 | parser.defineEntityReplacementText( "ensp", "\u2002" ); |
1426 | 3 | parser.defineEntityReplacementText( "emsp", "\u2003" ); |
1427 | 3 | parser.defineEntityReplacementText( "thinsp", "\u2009" ); |
1428 | 3 | parser.defineEntityReplacementText( "zwnj", "\u200c" ); |
1429 | 3 | parser.defineEntityReplacementText( "zwj", "\u200d" ); |
1430 | 3 | parser.defineEntityReplacementText( "lrm", "\u200e" ); |
1431 | 3 | parser.defineEntityReplacementText( "rlm", "\u200f" ); |
1432 | 3 | parser.defineEntityReplacementText( "ndash", "\u2013" ); |
1433 | 3 | parser.defineEntityReplacementText( "mdash", "\u2014" ); |
1434 | 3 | parser.defineEntityReplacementText( "lsquo", "\u2018" ); |
1435 | 3 | parser.defineEntityReplacementText( "rsquo", "\u2019" ); |
1436 | 3 | parser.defineEntityReplacementText( "sbquo", "\u201a" ); |
1437 | 3 | parser.defineEntityReplacementText( "ldquo", "\u201c" ); |
1438 | 3 | parser.defineEntityReplacementText( "rdquo", "\u201d" ); |
1439 | 3 | parser.defineEntityReplacementText( "bdquo", "\u201e" ); |
1440 | 3 | parser.defineEntityReplacementText( "dagger", "\u2020" ); |
1441 | 3 | parser.defineEntityReplacementText( "Dagger", "\u2021" ); |
1442 | 3 | parser.defineEntityReplacementText( "permil", "\u2030" ); |
1443 | 3 | parser.defineEntityReplacementText( "lsaquo", "\u2039" ); |
1444 | 3 | parser.defineEntityReplacementText( "rsaquo", "\u203a" ); |
1445 | 3 | parser.defineEntityReplacementText( "euro", "\u20ac" ); |
1446 | |
|
1447 | |
|
1448 | |
|
1449 | |
|
1450 | |
|
1451 | 3 | parser.defineEntityReplacementText( "fnof", "\u0192" ); |
1452 | 3 | parser.defineEntityReplacementText( "Alpha", "\u0391" ); |
1453 | 3 | parser.defineEntityReplacementText( "Beta", "\u0392" ); |
1454 | 3 | parser.defineEntityReplacementText( "Gamma", "\u0393" ); |
1455 | 3 | parser.defineEntityReplacementText( "Delta", "\u0394" ); |
1456 | 3 | parser.defineEntityReplacementText( "Epsilon", "\u0395" ); |
1457 | 3 | parser.defineEntityReplacementText( "Zeta", "\u0396" ); |
1458 | 3 | parser.defineEntityReplacementText( "Eta", "\u0397" ); |
1459 | 3 | parser.defineEntityReplacementText( "Theta", "\u0398" ); |
1460 | 3 | parser.defineEntityReplacementText( "Iota", "\u0399" ); |
1461 | 3 | parser.defineEntityReplacementText( "Kappa", "\u039a" ); |
1462 | 3 | parser.defineEntityReplacementText( "Lambda", "\u039b" ); |
1463 | 3 | parser.defineEntityReplacementText( "Mu", "\u039c" ); |
1464 | 3 | parser.defineEntityReplacementText( "Nu", "\u039d" ); |
1465 | 3 | parser.defineEntityReplacementText( "Xi", "\u039e" ); |
1466 | 3 | parser.defineEntityReplacementText( "Omicron", "\u039f" ); |
1467 | 3 | parser.defineEntityReplacementText( "Pi", "\u03a0" ); |
1468 | 3 | parser.defineEntityReplacementText( "Rho", "\u03a1" ); |
1469 | 3 | parser.defineEntityReplacementText( "Sigma", "\u03a3" ); |
1470 | 3 | parser.defineEntityReplacementText( "Tau", "\u03a4" ); |
1471 | 3 | parser.defineEntityReplacementText( "Upsilon", "\u03a5" ); |
1472 | 3 | parser.defineEntityReplacementText( "Phi", "\u03a6" ); |
1473 | 3 | parser.defineEntityReplacementText( "Chi", "\u03a7" ); |
1474 | 3 | parser.defineEntityReplacementText( "Psi", "\u03a8" ); |
1475 | 3 | parser.defineEntityReplacementText( "Omega", "\u03a9" ); |
1476 | 3 | parser.defineEntityReplacementText( "alpha", "\u03b1" ); |
1477 | 3 | parser.defineEntityReplacementText( "beta", "\u03b2" ); |
1478 | 3 | parser.defineEntityReplacementText( "gamma", "\u03b3" ); |
1479 | 3 | parser.defineEntityReplacementText( "delta", "\u03b4" ); |
1480 | 3 | parser.defineEntityReplacementText( "epsilon", "\u03b5" ); |
1481 | 3 | parser.defineEntityReplacementText( "zeta", "\u03b6" ); |
1482 | 3 | parser.defineEntityReplacementText( "eta", "\u03b7" ); |
1483 | 3 | parser.defineEntityReplacementText( "theta", "\u03b8" ); |
1484 | 3 | parser.defineEntityReplacementText( "iota", "\u03b9" ); |
1485 | 3 | parser.defineEntityReplacementText( "kappa", "\u03ba" ); |
1486 | 3 | parser.defineEntityReplacementText( "lambda", "\u03bb" ); |
1487 | 3 | parser.defineEntityReplacementText( "mu", "\u03bc" ); |
1488 | 3 | parser.defineEntityReplacementText( "nu", "\u03bd" ); |
1489 | 3 | parser.defineEntityReplacementText( "xi", "\u03be" ); |
1490 | 3 | parser.defineEntityReplacementText( "omicron", "\u03bf" ); |
1491 | 3 | parser.defineEntityReplacementText( "pi", "\u03c0" ); |
1492 | 3 | parser.defineEntityReplacementText( "rho", "\u03c1" ); |
1493 | 3 | parser.defineEntityReplacementText( "sigmaf", "\u03c2" ); |
1494 | 3 | parser.defineEntityReplacementText( "sigma", "\u03c3" ); |
1495 | 3 | parser.defineEntityReplacementText( "tau", "\u03c4" ); |
1496 | 3 | parser.defineEntityReplacementText( "upsilon", "\u03c5" ); |
1497 | 3 | parser.defineEntityReplacementText( "phi", "\u03c6" ); |
1498 | 3 | parser.defineEntityReplacementText( "chi", "\u03c7" ); |
1499 | 3 | parser.defineEntityReplacementText( "psi", "\u03c8" ); |
1500 | 3 | parser.defineEntityReplacementText( "omega", "\u03c9" ); |
1501 | 3 | parser.defineEntityReplacementText( "thetasym", "\u03d1" ); |
1502 | 3 | parser.defineEntityReplacementText( "upsih", "\u03d2" ); |
1503 | 3 | parser.defineEntityReplacementText( "piv", "\u03d6" ); |
1504 | 3 | parser.defineEntityReplacementText( "bull", "\u2022" ); |
1505 | 3 | parser.defineEntityReplacementText( "hellip", "\u2026" ); |
1506 | 3 | parser.defineEntityReplacementText( "prime", "\u2032" ); |
1507 | 3 | parser.defineEntityReplacementText( "Prime", "\u2033" ); |
1508 | 3 | parser.defineEntityReplacementText( "oline", "\u203e" ); |
1509 | 3 | parser.defineEntityReplacementText( "frasl", "\u2044" ); |
1510 | 3 | parser.defineEntityReplacementText( "weierp", "\u2118" ); |
1511 | 3 | parser.defineEntityReplacementText( "image", "\u2111" ); |
1512 | 3 | parser.defineEntityReplacementText( "real", "\u211c" ); |
1513 | 3 | parser.defineEntityReplacementText( "trade", "\u2122" ); |
1514 | 3 | parser.defineEntityReplacementText( "alefsym", "\u2135" ); |
1515 | 3 | parser.defineEntityReplacementText( "larr", "\u2190" ); |
1516 | 3 | parser.defineEntityReplacementText( "uarr", "\u2191" ); |
1517 | 3 | parser.defineEntityReplacementText( "rarr", "\u2192" ); |
1518 | 3 | parser.defineEntityReplacementText( "darr", "\u2193" ); |
1519 | 3 | parser.defineEntityReplacementText( "harr", "\u2194" ); |
1520 | 3 | parser.defineEntityReplacementText( "crarr", "\u21b5" ); |
1521 | 3 | parser.defineEntityReplacementText( "lArr", "\u21d0" ); |
1522 | 3 | parser.defineEntityReplacementText( "uArr", "\u21d1" ); |
1523 | 3 | parser.defineEntityReplacementText( "rArr", "\u21d2" ); |
1524 | 3 | parser.defineEntityReplacementText( "dArr", "\u21d3" ); |
1525 | 3 | parser.defineEntityReplacementText( "hArr", "\u21d4" ); |
1526 | 3 | parser.defineEntityReplacementText( "forall", "\u2200" ); |
1527 | 3 | parser.defineEntityReplacementText( "part", "\u2202" ); |
1528 | 3 | parser.defineEntityReplacementText( "exist", "\u2203" ); |
1529 | 3 | parser.defineEntityReplacementText( "empty", "\u2205" ); |
1530 | 3 | parser.defineEntityReplacementText( "nabla", "\u2207" ); |
1531 | 3 | parser.defineEntityReplacementText( "isin", "\u2208" ); |
1532 | 3 | parser.defineEntityReplacementText( "notin", "\u2209" ); |
1533 | 3 | parser.defineEntityReplacementText( "ni", "\u220b" ); |
1534 | 3 | parser.defineEntityReplacementText( "prod", "\u220f" ); |
1535 | 3 | parser.defineEntityReplacementText( "sum", "\u2211" ); |
1536 | 3 | parser.defineEntityReplacementText( "minus", "\u2212" ); |
1537 | 3 | parser.defineEntityReplacementText( "lowast", "\u2217" ); |
1538 | 3 | parser.defineEntityReplacementText( "radic", "\u221a" ); |
1539 | 3 | parser.defineEntityReplacementText( "prop", "\u221d" ); |
1540 | 3 | parser.defineEntityReplacementText( "infin", "\u221e" ); |
1541 | 3 | parser.defineEntityReplacementText( "ang", "\u2220" ); |
1542 | 3 | parser.defineEntityReplacementText( "and", "\u2227" ); |
1543 | 3 | parser.defineEntityReplacementText( "or", "\u2228" ); |
1544 | 3 | parser.defineEntityReplacementText( "cap", "\u2229" ); |
1545 | 3 | parser.defineEntityReplacementText( "cup", "\u222a" ); |
1546 | 3 | parser.defineEntityReplacementText( "int", "\u222b" ); |
1547 | 3 | parser.defineEntityReplacementText( "there4", "\u2234" ); |
1548 | 3 | parser.defineEntityReplacementText( "sim", "\u223c" ); |
1549 | 3 | parser.defineEntityReplacementText( "cong", "\u2245" ); |
1550 | 3 | parser.defineEntityReplacementText( "asymp", "\u2248" ); |
1551 | 3 | parser.defineEntityReplacementText( "ne", "\u2260" ); |
1552 | 3 | parser.defineEntityReplacementText( "equiv", "\u2261" ); |
1553 | 3 | parser.defineEntityReplacementText( "le", "\u2264" ); |
1554 | 3 | parser.defineEntityReplacementText( "ge", "\u2265" ); |
1555 | 3 | parser.defineEntityReplacementText( "sub", "\u2282" ); |
1556 | 3 | parser.defineEntityReplacementText( "sup", "\u2283" ); |
1557 | 3 | parser.defineEntityReplacementText( "nsub", "\u2284" ); |
1558 | 3 | parser.defineEntityReplacementText( "sube", "\u2286" ); |
1559 | 3 | parser.defineEntityReplacementText( "supe", "\u2287" ); |
1560 | 3 | parser.defineEntityReplacementText( "oplus", "\u2295" ); |
1561 | 3 | parser.defineEntityReplacementText( "otimes", "\u2297" ); |
1562 | 3 | parser.defineEntityReplacementText( "perp", "\u22a5" ); |
1563 | 3 | parser.defineEntityReplacementText( "sdot", "\u22c5" ); |
1564 | 3 | parser.defineEntityReplacementText( "lceil", "\u2308" ); |
1565 | 3 | parser.defineEntityReplacementText( "rceil", "\u2309" ); |
1566 | 3 | parser.defineEntityReplacementText( "lfloor", "\u230a" ); |
1567 | 3 | parser.defineEntityReplacementText( "rfloor", "\u230b" ); |
1568 | 3 | parser.defineEntityReplacementText( "lang", "\u2329" ); |
1569 | 3 | parser.defineEntityReplacementText( "rang", "\u232a" ); |
1570 | 3 | parser.defineEntityReplacementText( "loz", "\u25ca" ); |
1571 | 3 | parser.defineEntityReplacementText( "spades", "\u2660" ); |
1572 | 3 | parser.defineEntityReplacementText( "clubs", "\u2663" ); |
1573 | 3 | parser.defineEntityReplacementText( "hearts", "\u2665" ); |
1574 | 3 | parser.defineEntityReplacementText( "diams", "\u2666" ); |
1575 | |
|
1576 | |
} |
1577 | |
|
1578 | 3 | parser.next(); |
1579 | 3 | return parseSettings( "settings", parser, strict ); |
1580 | |
} |
1581 | |
|
1582 | |
|
1583 | |
|
1584 | |
|
1585 | |
|
1586 | |
|
1587 | |
|
1588 | |
|
1589 | |
|
1590 | |
public Settings read( Reader reader ) |
1591 | |
throws IOException, XmlPullParserException |
1592 | |
{ |
1593 | 0 | return read( reader, true ); |
1594 | |
} |
1595 | |
|
1596 | |
|
1597 | |
|
1598 | |
|
1599 | |
|
1600 | |
|
1601 | |
|
1602 | |
|
1603 | |
|
1604 | |
|
1605 | |
public Settings read( InputStream in, boolean strict ) |
1606 | |
throws IOException, XmlPullParserException |
1607 | |
{ |
1608 | 0 | Reader reader = ReaderFactory.newXmlReader( in ); |
1609 | |
|
1610 | 0 | return read( reader, strict ); |
1611 | |
} |
1612 | |
|
1613 | |
|
1614 | |
|
1615 | |
|
1616 | |
|
1617 | |
|
1618 | |
|
1619 | |
|
1620 | |
|
1621 | |
public Settings read( InputStream in ) |
1622 | |
throws IOException, XmlPullParserException |
1623 | |
{ |
1624 | 0 | Reader reader = ReaderFactory.newXmlReader( in ); |
1625 | |
|
1626 | 0 | return read( reader ); |
1627 | |
} |
1628 | |
|
1629 | |
|
1630 | |
|
1631 | |
|
1632 | |
|
1633 | |
|
1634 | |
public void setAddDefaultEntities( boolean addDefaultEntities ) |
1635 | |
{ |
1636 | 0 | this.addDefaultEntities = addDefaultEntities; |
1637 | 0 | } |
1638 | |
|
1639 | |
|
1640 | |
} |