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