1
2
3
4
5
6
7
8 package org.apache.maven.model.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.model.Activation;
20 import org.apache.maven.model.ActivationFile;
21 import org.apache.maven.model.ActivationOS;
22 import org.apache.maven.model.ActivationProperty;
23 import org.apache.maven.model.Build;
24 import org.apache.maven.model.BuildBase;
25 import org.apache.maven.model.CiManagement;
26 import org.apache.maven.model.ConfigurationContainer;
27 import org.apache.maven.model.Contributor;
28 import org.apache.maven.model.Dependency;
29 import org.apache.maven.model.DependencyManagement;
30 import org.apache.maven.model.DeploymentRepository;
31 import org.apache.maven.model.Developer;
32 import org.apache.maven.model.DistributionManagement;
33 import org.apache.maven.model.Exclusion;
34 import org.apache.maven.model.Extension;
35 import org.apache.maven.model.FileSet;
36 import org.apache.maven.model.IssueManagement;
37 import org.apache.maven.model.License;
38 import org.apache.maven.model.MailingList;
39 import org.apache.maven.model.Model;
40 import org.apache.maven.model.ModelBase;
41 import org.apache.maven.model.Notifier;
42 import org.apache.maven.model.Organization;
43 import org.apache.maven.model.Parent;
44 import org.apache.maven.model.PatternSet;
45 import org.apache.maven.model.Plugin;
46 import org.apache.maven.model.PluginConfiguration;
47 import org.apache.maven.model.PluginContainer;
48 import org.apache.maven.model.PluginExecution;
49 import org.apache.maven.model.PluginManagement;
50 import org.apache.maven.model.Prerequisites;
51 import org.apache.maven.model.Profile;
52 import org.apache.maven.model.Relocation;
53 import org.apache.maven.model.ReportPlugin;
54 import org.apache.maven.model.ReportSet;
55 import org.apache.maven.model.Reporting;
56 import org.apache.maven.model.Repository;
57 import org.apache.maven.model.RepositoryBase;
58 import org.apache.maven.model.RepositoryPolicy;
59 import org.apache.maven.model.Resource;
60 import org.apache.maven.model.Scm;
61 import org.apache.maven.model.Site;
62 import org.codehaus.plexus.util.ReaderFactory;
63 import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
64 import org.codehaus.plexus.util.xml.pull.MXParser;
65 import org.codehaus.plexus.util.xml.pull.XmlPullParser;
66 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
67
68
69
70
71
72
73 @SuppressWarnings( "all" )
74 public class MavenXpp3Reader
75 {
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 private boolean addDefaultEntities = true;
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108 private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed )
109 throws XmlPullParserException
110 {
111 if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
112 {
113 return false;
114 }
115 if ( !parsed.add( tagName ) )
116 {
117 throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
118 }
119 return true;
120 }
121
122
123
124
125
126
127
128
129
130
131
132 private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict )
133 throws XmlPullParserException, IOException
134 {
135
136 if ( strict )
137 {
138 throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null );
139 }
140 }
141
142
143
144
145
146
147
148
149
150 private void checkUnknownElement( XmlPullParser parser, boolean strict )
151 throws XmlPullParserException, IOException
152 {
153 if ( strict )
154 {
155 throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
156 }
157
158 for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; )
159 {
160 int eventType = parser.next();
161 if ( eventType == XmlPullParser.START_TAG )
162 {
163 unrecognizedTagCount++;
164 }
165 else if ( eventType == XmlPullParser.END_TAG )
166 {
167 unrecognizedTagCount--;
168 }
169 }
170 }
171
172
173
174
175
176
177 public boolean getAddDefaultEntities()
178 {
179 return addDefaultEntities;
180 }
181
182
183
184
185
186
187
188
189
190
191 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
192 throws XmlPullParserException
193 {
194 return getBooleanValue( s, attribute, parser, null );
195 }
196
197
198
199
200
201
202
203
204
205
206
207 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
208 throws XmlPullParserException
209 {
210 if ( s != null && s.length() != 0 )
211 {
212 return Boolean.valueOf( s ).booleanValue();
213 }
214 if ( defaultValue != null )
215 {
216 return Boolean.valueOf( defaultValue ).booleanValue();
217 }
218 return false;
219 }
220
221
222
223
224
225
226
227
228
229
230
231 private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
232 throws XmlPullParserException
233 {
234 if ( s != null )
235 {
236 try
237 {
238 return Byte.valueOf( s ).byteValue();
239 }
240 catch ( NumberFormatException nfe )
241 {
242 if ( strict )
243 {
244 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe );
245 }
246 }
247 }
248 return 0;
249 }
250
251
252
253
254
255
256
257
258
259
260 private char getCharacterValue( String s, String attribute, XmlPullParser parser )
261 throws XmlPullParserException
262 {
263 if ( s != null )
264 {
265 return s.charAt( 0 );
266 }
267 return 0;
268 }
269
270
271
272
273
274
275
276
277
278
279 private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
280 throws XmlPullParserException
281 {
282 return getDateValue( s, attribute, null, parser );
283 }
284
285
286
287
288
289
290
291
292
293
294
295 private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
296 throws XmlPullParserException
297 {
298 if ( s != null )
299 {
300 String effectiveDateFormat = dateFormat;
301 if ( dateFormat == null )
302 {
303 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
304 }
305 if ( "long".equals( effectiveDateFormat ) )
306 {
307 try
308 {
309 return new java.util.Date( Long.parseLong( s ) );
310 }
311 catch ( NumberFormatException e )
312 {
313 throw new XmlPullParserException( e.getMessage(), parser, e );
314 }
315 }
316 else
317 {
318 try
319 {
320 DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, Locale.US );
321 return dateParser.parse( s );
322 }
323 catch ( java.text.ParseException e )
324 {
325 throw new XmlPullParserException( e.getMessage(), parser, e );
326 }
327 }
328 }
329 return null;
330 }
331
332
333
334
335
336
337
338
339
340
341
342 private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
343 throws XmlPullParserException
344 {
345 if ( s != null )
346 {
347 try
348 {
349 return Double.valueOf( s ).doubleValue();
350 }
351 catch ( NumberFormatException nfe )
352 {
353 if ( strict )
354 {
355 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
356 }
357 }
358 }
359 return 0;
360 }
361
362
363
364
365
366
367
368
369
370
371
372 private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
373 throws XmlPullParserException
374 {
375 if ( s != null )
376 {
377 try
378 {
379 return Float.valueOf( s ).floatValue();
380 }
381 catch ( NumberFormatException nfe )
382 {
383 if ( strict )
384 {
385 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
386 }
387 }
388 }
389 return 0;
390 }
391
392
393
394
395
396
397
398
399
400
401
402 private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
403 throws XmlPullParserException
404 {
405 if ( s != null )
406 {
407 try
408 {
409 return Integer.valueOf( s ).intValue();
410 }
411 catch ( NumberFormatException nfe )
412 {
413 if ( strict )
414 {
415 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe );
416 }
417 }
418 }
419 return 0;
420 }
421
422
423
424
425
426
427
428
429
430
431
432 private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
433 throws XmlPullParserException
434 {
435 if ( s != null )
436 {
437 try
438 {
439 return Long.valueOf( s ).longValue();
440 }
441 catch ( NumberFormatException nfe )
442 {
443 if ( strict )
444 {
445 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe );
446 }
447 }
448 }
449 return 0;
450 }
451
452
453
454
455
456
457
458
459
460
461
462 private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
463 throws XmlPullParserException
464 {
465 if ( s == null )
466 {
467 if ( strict )
468 {
469 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
470 }
471 }
472 return s;
473 }
474
475
476
477
478
479
480
481
482
483
484
485 private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
486 throws XmlPullParserException
487 {
488 if ( s != null )
489 {
490 try
491 {
492 return Short.valueOf( s ).shortValue();
493 }
494 catch ( NumberFormatException nfe )
495 {
496 if ( strict )
497 {
498 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe );
499 }
500 }
501 }
502 return 0;
503 }
504
505
506
507
508
509
510
511 private String getTrimmedValue( String s )
512 {
513 if ( s != null )
514 {
515 s = s.trim();
516 }
517 return s;
518 }
519
520
521
522
523
524
525
526 private void initParser( XmlPullParser parser )
527 throws XmlPullParserException
528 {
529 if ( addDefaultEntities )
530 {
531
532
533
534
535 parser.defineEntityReplacementText( "nbsp", "\u00a0" );
536 parser.defineEntityReplacementText( "iexcl", "\u00a1" );
537 parser.defineEntityReplacementText( "cent", "\u00a2" );
538 parser.defineEntityReplacementText( "pound", "\u00a3" );
539 parser.defineEntityReplacementText( "curren", "\u00a4" );
540 parser.defineEntityReplacementText( "yen", "\u00a5" );
541 parser.defineEntityReplacementText( "brvbar", "\u00a6" );
542 parser.defineEntityReplacementText( "sect", "\u00a7" );
543 parser.defineEntityReplacementText( "uml", "\u00a8" );
544 parser.defineEntityReplacementText( "copy", "\u00a9" );
545 parser.defineEntityReplacementText( "ordf", "\u00aa" );
546 parser.defineEntityReplacementText( "laquo", "\u00ab" );
547 parser.defineEntityReplacementText( "not", "\u00ac" );
548 parser.defineEntityReplacementText( "shy", "\u00ad" );
549 parser.defineEntityReplacementText( "reg", "\u00ae" );
550 parser.defineEntityReplacementText( "macr", "\u00af" );
551 parser.defineEntityReplacementText( "deg", "\u00b0" );
552 parser.defineEntityReplacementText( "plusmn", "\u00b1" );
553 parser.defineEntityReplacementText( "sup2", "\u00b2" );
554 parser.defineEntityReplacementText( "sup3", "\u00b3" );
555 parser.defineEntityReplacementText( "acute", "\u00b4" );
556 parser.defineEntityReplacementText( "micro", "\u00b5" );
557 parser.defineEntityReplacementText( "para", "\u00b6" );
558 parser.defineEntityReplacementText( "middot", "\u00b7" );
559 parser.defineEntityReplacementText( "cedil", "\u00b8" );
560 parser.defineEntityReplacementText( "sup1", "\u00b9" );
561 parser.defineEntityReplacementText( "ordm", "\u00ba" );
562 parser.defineEntityReplacementText( "raquo", "\u00bb" );
563 parser.defineEntityReplacementText( "frac14", "\u00bc" );
564 parser.defineEntityReplacementText( "frac12", "\u00bd" );
565 parser.defineEntityReplacementText( "frac34", "\u00be" );
566 parser.defineEntityReplacementText( "iquest", "\u00bf" );
567 parser.defineEntityReplacementText( "Agrave", "\u00c0" );
568 parser.defineEntityReplacementText( "Aacute", "\u00c1" );
569 parser.defineEntityReplacementText( "Acirc", "\u00c2" );
570 parser.defineEntityReplacementText( "Atilde", "\u00c3" );
571 parser.defineEntityReplacementText( "Auml", "\u00c4" );
572 parser.defineEntityReplacementText( "Aring", "\u00c5" );
573 parser.defineEntityReplacementText( "AElig", "\u00c6" );
574 parser.defineEntityReplacementText( "Ccedil", "\u00c7" );
575 parser.defineEntityReplacementText( "Egrave", "\u00c8" );
576 parser.defineEntityReplacementText( "Eacute", "\u00c9" );
577 parser.defineEntityReplacementText( "Ecirc", "\u00ca" );
578 parser.defineEntityReplacementText( "Euml", "\u00cb" );
579 parser.defineEntityReplacementText( "Igrave", "\u00cc" );
580 parser.defineEntityReplacementText( "Iacute", "\u00cd" );
581 parser.defineEntityReplacementText( "Icirc", "\u00ce" );
582 parser.defineEntityReplacementText( "Iuml", "\u00cf" );
583 parser.defineEntityReplacementText( "ETH", "\u00d0" );
584 parser.defineEntityReplacementText( "Ntilde", "\u00d1" );
585 parser.defineEntityReplacementText( "Ograve", "\u00d2" );
586 parser.defineEntityReplacementText( "Oacute", "\u00d3" );
587 parser.defineEntityReplacementText( "Ocirc", "\u00d4" );
588 parser.defineEntityReplacementText( "Otilde", "\u00d5" );
589 parser.defineEntityReplacementText( "Ouml", "\u00d6" );
590 parser.defineEntityReplacementText( "times", "\u00d7" );
591 parser.defineEntityReplacementText( "Oslash", "\u00d8" );
592 parser.defineEntityReplacementText( "Ugrave", "\u00d9" );
593 parser.defineEntityReplacementText( "Uacute", "\u00da" );
594 parser.defineEntityReplacementText( "Ucirc", "\u00db" );
595 parser.defineEntityReplacementText( "Uuml", "\u00dc" );
596 parser.defineEntityReplacementText( "Yacute", "\u00dd" );
597 parser.defineEntityReplacementText( "THORN", "\u00de" );
598 parser.defineEntityReplacementText( "szlig", "\u00df" );
599 parser.defineEntityReplacementText( "agrave", "\u00e0" );
600 parser.defineEntityReplacementText( "aacute", "\u00e1" );
601 parser.defineEntityReplacementText( "acirc", "\u00e2" );
602 parser.defineEntityReplacementText( "atilde", "\u00e3" );
603 parser.defineEntityReplacementText( "auml", "\u00e4" );
604 parser.defineEntityReplacementText( "aring", "\u00e5" );
605 parser.defineEntityReplacementText( "aelig", "\u00e6" );
606 parser.defineEntityReplacementText( "ccedil", "\u00e7" );
607 parser.defineEntityReplacementText( "egrave", "\u00e8" );
608 parser.defineEntityReplacementText( "eacute", "\u00e9" );
609 parser.defineEntityReplacementText( "ecirc", "\u00ea" );
610 parser.defineEntityReplacementText( "euml", "\u00eb" );
611 parser.defineEntityReplacementText( "igrave", "\u00ec" );
612 parser.defineEntityReplacementText( "iacute", "\u00ed" );
613 parser.defineEntityReplacementText( "icirc", "\u00ee" );
614 parser.defineEntityReplacementText( "iuml", "\u00ef" );
615 parser.defineEntityReplacementText( "eth", "\u00f0" );
616 parser.defineEntityReplacementText( "ntilde", "\u00f1" );
617 parser.defineEntityReplacementText( "ograve", "\u00f2" );
618 parser.defineEntityReplacementText( "oacute", "\u00f3" );
619 parser.defineEntityReplacementText( "ocirc", "\u00f4" );
620 parser.defineEntityReplacementText( "otilde", "\u00f5" );
621 parser.defineEntityReplacementText( "ouml", "\u00f6" );
622 parser.defineEntityReplacementText( "divide", "\u00f7" );
623 parser.defineEntityReplacementText( "oslash", "\u00f8" );
624 parser.defineEntityReplacementText( "ugrave", "\u00f9" );
625 parser.defineEntityReplacementText( "uacute", "\u00fa" );
626 parser.defineEntityReplacementText( "ucirc", "\u00fb" );
627 parser.defineEntityReplacementText( "uuml", "\u00fc" );
628 parser.defineEntityReplacementText( "yacute", "\u00fd" );
629 parser.defineEntityReplacementText( "thorn", "\u00fe" );
630 parser.defineEntityReplacementText( "yuml", "\u00ff" );
631
632
633
634
635
636 parser.defineEntityReplacementText( "OElig", "\u0152" );
637 parser.defineEntityReplacementText( "oelig", "\u0153" );
638 parser.defineEntityReplacementText( "Scaron", "\u0160" );
639 parser.defineEntityReplacementText( "scaron", "\u0161" );
640 parser.defineEntityReplacementText( "Yuml", "\u0178" );
641 parser.defineEntityReplacementText( "circ", "\u02c6" );
642 parser.defineEntityReplacementText( "tilde", "\u02dc" );
643 parser.defineEntityReplacementText( "ensp", "\u2002" );
644 parser.defineEntityReplacementText( "emsp", "\u2003" );
645 parser.defineEntityReplacementText( "thinsp", "\u2009" );
646 parser.defineEntityReplacementText( "zwnj", "\u200c" );
647 parser.defineEntityReplacementText( "zwj", "\u200d" );
648 parser.defineEntityReplacementText( "lrm", "\u200e" );
649 parser.defineEntityReplacementText( "rlm", "\u200f" );
650 parser.defineEntityReplacementText( "ndash", "\u2013" );
651 parser.defineEntityReplacementText( "mdash", "\u2014" );
652 parser.defineEntityReplacementText( "lsquo", "\u2018" );
653 parser.defineEntityReplacementText( "rsquo", "\u2019" );
654 parser.defineEntityReplacementText( "sbquo", "\u201a" );
655 parser.defineEntityReplacementText( "ldquo", "\u201c" );
656 parser.defineEntityReplacementText( "rdquo", "\u201d" );
657 parser.defineEntityReplacementText( "bdquo", "\u201e" );
658 parser.defineEntityReplacementText( "dagger", "\u2020" );
659 parser.defineEntityReplacementText( "Dagger", "\u2021" );
660 parser.defineEntityReplacementText( "permil", "\u2030" );
661 parser.defineEntityReplacementText( "lsaquo", "\u2039" );
662 parser.defineEntityReplacementText( "rsaquo", "\u203a" );
663 parser.defineEntityReplacementText( "euro", "\u20ac" );
664
665
666
667
668
669 parser.defineEntityReplacementText( "fnof", "\u0192" );
670 parser.defineEntityReplacementText( "Alpha", "\u0391" );
671 parser.defineEntityReplacementText( "Beta", "\u0392" );
672 parser.defineEntityReplacementText( "Gamma", "\u0393" );
673 parser.defineEntityReplacementText( "Delta", "\u0394" );
674 parser.defineEntityReplacementText( "Epsilon", "\u0395" );
675 parser.defineEntityReplacementText( "Zeta", "\u0396" );
676 parser.defineEntityReplacementText( "Eta", "\u0397" );
677 parser.defineEntityReplacementText( "Theta", "\u0398" );
678 parser.defineEntityReplacementText( "Iota", "\u0399" );
679 parser.defineEntityReplacementText( "Kappa", "\u039a" );
680 parser.defineEntityReplacementText( "Lambda", "\u039b" );
681 parser.defineEntityReplacementText( "Mu", "\u039c" );
682 parser.defineEntityReplacementText( "Nu", "\u039d" );
683 parser.defineEntityReplacementText( "Xi", "\u039e" );
684 parser.defineEntityReplacementText( "Omicron", "\u039f" );
685 parser.defineEntityReplacementText( "Pi", "\u03a0" );
686 parser.defineEntityReplacementText( "Rho", "\u03a1" );
687 parser.defineEntityReplacementText( "Sigma", "\u03a3" );
688 parser.defineEntityReplacementText( "Tau", "\u03a4" );
689 parser.defineEntityReplacementText( "Upsilon", "\u03a5" );
690 parser.defineEntityReplacementText( "Phi", "\u03a6" );
691 parser.defineEntityReplacementText( "Chi", "\u03a7" );
692 parser.defineEntityReplacementText( "Psi", "\u03a8" );
693 parser.defineEntityReplacementText( "Omega", "\u03a9" );
694 parser.defineEntityReplacementText( "alpha", "\u03b1" );
695 parser.defineEntityReplacementText( "beta", "\u03b2" );
696 parser.defineEntityReplacementText( "gamma", "\u03b3" );
697 parser.defineEntityReplacementText( "delta", "\u03b4" );
698 parser.defineEntityReplacementText( "epsilon", "\u03b5" );
699 parser.defineEntityReplacementText( "zeta", "\u03b6" );
700 parser.defineEntityReplacementText( "eta", "\u03b7" );
701 parser.defineEntityReplacementText( "theta", "\u03b8" );
702 parser.defineEntityReplacementText( "iota", "\u03b9" );
703 parser.defineEntityReplacementText( "kappa", "\u03ba" );
704 parser.defineEntityReplacementText( "lambda", "\u03bb" );
705 parser.defineEntityReplacementText( "mu", "\u03bc" );
706 parser.defineEntityReplacementText( "nu", "\u03bd" );
707 parser.defineEntityReplacementText( "xi", "\u03be" );
708 parser.defineEntityReplacementText( "omicron", "\u03bf" );
709 parser.defineEntityReplacementText( "pi", "\u03c0" );
710 parser.defineEntityReplacementText( "rho", "\u03c1" );
711 parser.defineEntityReplacementText( "sigmaf", "\u03c2" );
712 parser.defineEntityReplacementText( "sigma", "\u03c3" );
713 parser.defineEntityReplacementText( "tau", "\u03c4" );
714 parser.defineEntityReplacementText( "upsilon", "\u03c5" );
715 parser.defineEntityReplacementText( "phi", "\u03c6" );
716 parser.defineEntityReplacementText( "chi", "\u03c7" );
717 parser.defineEntityReplacementText( "psi", "\u03c8" );
718 parser.defineEntityReplacementText( "omega", "\u03c9" );
719 parser.defineEntityReplacementText( "thetasym", "\u03d1" );
720 parser.defineEntityReplacementText( "upsih", "\u03d2" );
721 parser.defineEntityReplacementText( "piv", "\u03d6" );
722 parser.defineEntityReplacementText( "bull", "\u2022" );
723 parser.defineEntityReplacementText( "hellip", "\u2026" );
724 parser.defineEntityReplacementText( "prime", "\u2032" );
725 parser.defineEntityReplacementText( "Prime", "\u2033" );
726 parser.defineEntityReplacementText( "oline", "\u203e" );
727 parser.defineEntityReplacementText( "frasl", "\u2044" );
728 parser.defineEntityReplacementText( "weierp", "\u2118" );
729 parser.defineEntityReplacementText( "image", "\u2111" );
730 parser.defineEntityReplacementText( "real", "\u211c" );
731 parser.defineEntityReplacementText( "trade", "\u2122" );
732 parser.defineEntityReplacementText( "alefsym", "\u2135" );
733 parser.defineEntityReplacementText( "larr", "\u2190" );
734 parser.defineEntityReplacementText( "uarr", "\u2191" );
735 parser.defineEntityReplacementText( "rarr", "\u2192" );
736 parser.defineEntityReplacementText( "darr", "\u2193" );
737 parser.defineEntityReplacementText( "harr", "\u2194" );
738 parser.defineEntityReplacementText( "crarr", "\u21b5" );
739 parser.defineEntityReplacementText( "lArr", "\u21d0" );
740 parser.defineEntityReplacementText( "uArr", "\u21d1" );
741 parser.defineEntityReplacementText( "rArr", "\u21d2" );
742 parser.defineEntityReplacementText( "dArr", "\u21d3" );
743 parser.defineEntityReplacementText( "hArr", "\u21d4" );
744 parser.defineEntityReplacementText( "forall", "\u2200" );
745 parser.defineEntityReplacementText( "part", "\u2202" );
746 parser.defineEntityReplacementText( "exist", "\u2203" );
747 parser.defineEntityReplacementText( "empty", "\u2205" );
748 parser.defineEntityReplacementText( "nabla", "\u2207" );
749 parser.defineEntityReplacementText( "isin", "\u2208" );
750 parser.defineEntityReplacementText( "notin", "\u2209" );
751 parser.defineEntityReplacementText( "ni", "\u220b" );
752 parser.defineEntityReplacementText( "prod", "\u220f" );
753 parser.defineEntityReplacementText( "sum", "\u2211" );
754 parser.defineEntityReplacementText( "minus", "\u2212" );
755 parser.defineEntityReplacementText( "lowast", "\u2217" );
756 parser.defineEntityReplacementText( "radic", "\u221a" );
757 parser.defineEntityReplacementText( "prop", "\u221d" );
758 parser.defineEntityReplacementText( "infin", "\u221e" );
759 parser.defineEntityReplacementText( "ang", "\u2220" );
760 parser.defineEntityReplacementText( "and", "\u2227" );
761 parser.defineEntityReplacementText( "or", "\u2228" );
762 parser.defineEntityReplacementText( "cap", "\u2229" );
763 parser.defineEntityReplacementText( "cup", "\u222a" );
764 parser.defineEntityReplacementText( "int", "\u222b" );
765 parser.defineEntityReplacementText( "there4", "\u2234" );
766 parser.defineEntityReplacementText( "sim", "\u223c" );
767 parser.defineEntityReplacementText( "cong", "\u2245" );
768 parser.defineEntityReplacementText( "asymp", "\u2248" );
769 parser.defineEntityReplacementText( "ne", "\u2260" );
770 parser.defineEntityReplacementText( "equiv", "\u2261" );
771 parser.defineEntityReplacementText( "le", "\u2264" );
772 parser.defineEntityReplacementText( "ge", "\u2265" );
773 parser.defineEntityReplacementText( "sub", "\u2282" );
774 parser.defineEntityReplacementText( "sup", "\u2283" );
775 parser.defineEntityReplacementText( "nsub", "\u2284" );
776 parser.defineEntityReplacementText( "sube", "\u2286" );
777 parser.defineEntityReplacementText( "supe", "\u2287" );
778 parser.defineEntityReplacementText( "oplus", "\u2295" );
779 parser.defineEntityReplacementText( "otimes", "\u2297" );
780 parser.defineEntityReplacementText( "perp", "\u22a5" );
781 parser.defineEntityReplacementText( "sdot", "\u22c5" );
782 parser.defineEntityReplacementText( "lceil", "\u2308" );
783 parser.defineEntityReplacementText( "rceil", "\u2309" );
784 parser.defineEntityReplacementText( "lfloor", "\u230a" );
785 parser.defineEntityReplacementText( "rfloor", "\u230b" );
786 parser.defineEntityReplacementText( "lang", "\u2329" );
787 parser.defineEntityReplacementText( "rang", "\u232a" );
788 parser.defineEntityReplacementText( "loz", "\u25ca" );
789 parser.defineEntityReplacementText( "spades", "\u2660" );
790 parser.defineEntityReplacementText( "clubs", "\u2663" );
791 parser.defineEntityReplacementText( "hearts", "\u2665" );
792 parser.defineEntityReplacementText( "diams", "\u2666" );
793
794 }
795 }
796
797
798
799
800
801
802
803
804
805 private int nextTag( XmlPullParser parser )
806 throws IOException, XmlPullParserException
807 {
808 int eventType = parser.next();
809 if ( eventType == XmlPullParser.TEXT )
810 {
811 eventType = parser.next();
812 }
813 if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG )
814 {
815 throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null );
816 }
817 return eventType;
818 }
819
820
821
822
823
824
825
826
827
828
829 private Activation parseActivation( XmlPullParser parser, boolean strict )
830 throws IOException, XmlPullParserException
831 {
832 String tagName = parser.getName();
833 Activation activation = new Activation();
834 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
835 {
836 String name = parser.getAttributeName( i );
837 String value = parser.getAttributeValue( i );
838
839 if ( name.indexOf( ':' ) >= 0 )
840 {
841
842 }
843 else
844 {
845 checkUnknownAttribute( parser, name, tagName, strict );
846 }
847 }
848 java.util.Set parsed = new java.util.HashSet();
849 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
850 {
851 if ( checkFieldWithDuplicate( parser, "activeByDefault", null, parsed ) )
852 {
853 activation.setActiveByDefault( getBooleanValue( getTrimmedValue( parser.nextText() ), "activeByDefault", parser, "false" ) );
854 }
855 else if ( checkFieldWithDuplicate( parser, "jdk", null, parsed ) )
856 {
857 activation.setJdk( getTrimmedValue( parser.nextText() ) );
858 }
859 else if ( checkFieldWithDuplicate( parser, "os", null, parsed ) )
860 {
861 activation.setOs( parseActivationOS( parser, strict ) );
862 }
863 else if ( checkFieldWithDuplicate( parser, "property", null, parsed ) )
864 {
865 activation.setProperty( parseActivationProperty( parser, strict ) );
866 }
867 else if ( checkFieldWithDuplicate( parser, "file", null, parsed ) )
868 {
869 activation.setFile( parseActivationFile( parser, strict ) );
870 }
871 else
872 {
873 checkUnknownElement( parser, strict );
874 }
875 }
876 return activation;
877 }
878
879
880
881
882
883
884
885
886
887
888 private ActivationFile parseActivationFile( XmlPullParser parser, boolean strict )
889 throws IOException, XmlPullParserException
890 {
891 String tagName = parser.getName();
892 ActivationFile activationFile = new ActivationFile();
893 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
894 {
895 String name = parser.getAttributeName( i );
896 String value = parser.getAttributeValue( i );
897
898 if ( name.indexOf( ':' ) >= 0 )
899 {
900
901 }
902 else
903 {
904 checkUnknownAttribute( parser, name, tagName, strict );
905 }
906 }
907 java.util.Set parsed = new java.util.HashSet();
908 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
909 {
910 if ( checkFieldWithDuplicate( parser, "missing", null, parsed ) )
911 {
912 activationFile.setMissing( getTrimmedValue( parser.nextText() ) );
913 }
914 else if ( checkFieldWithDuplicate( parser, "exists", null, parsed ) )
915 {
916 activationFile.setExists( getTrimmedValue( parser.nextText() ) );
917 }
918 else
919 {
920 checkUnknownElement( parser, strict );
921 }
922 }
923 return activationFile;
924 }
925
926
927
928
929
930
931
932
933
934
935 private ActivationOS parseActivationOS( XmlPullParser parser, boolean strict )
936 throws IOException, XmlPullParserException
937 {
938 String tagName = parser.getName();
939 ActivationOS activationOS = new ActivationOS();
940 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
941 {
942 String name = parser.getAttributeName( i );
943 String value = parser.getAttributeValue( i );
944
945 if ( name.indexOf( ':' ) >= 0 )
946 {
947
948 }
949 else
950 {
951 checkUnknownAttribute( parser, name, tagName, strict );
952 }
953 }
954 java.util.Set parsed = new java.util.HashSet();
955 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
956 {
957 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
958 {
959 activationOS.setName( getTrimmedValue( parser.nextText() ) );
960 }
961 else if ( checkFieldWithDuplicate( parser, "family", null, parsed ) )
962 {
963 activationOS.setFamily( getTrimmedValue( parser.nextText() ) );
964 }
965 else if ( checkFieldWithDuplicate( parser, "arch", null, parsed ) )
966 {
967 activationOS.setArch( getTrimmedValue( parser.nextText() ) );
968 }
969 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
970 {
971 activationOS.setVersion( getTrimmedValue( parser.nextText() ) );
972 }
973 else
974 {
975 checkUnknownElement( parser, strict );
976 }
977 }
978 return activationOS;
979 }
980
981
982
983
984
985
986
987
988
989
990 private ActivationProperty parseActivationProperty( XmlPullParser parser, boolean strict )
991 throws IOException, XmlPullParserException
992 {
993 String tagName = parser.getName();
994 ActivationProperty activationProperty = new ActivationProperty();
995 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
996 {
997 String name = parser.getAttributeName( i );
998 String value = parser.getAttributeValue( i );
999
1000 if ( name.indexOf( ':' ) >= 0 )
1001 {
1002
1003 }
1004 else
1005 {
1006 checkUnknownAttribute( parser, name, tagName, strict );
1007 }
1008 }
1009 java.util.Set parsed = new java.util.HashSet();
1010 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1011 {
1012 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1013 {
1014 activationProperty.setName( getTrimmedValue( parser.nextText() ) );
1015 }
1016 else if ( checkFieldWithDuplicate( parser, "value", null, parsed ) )
1017 {
1018 activationProperty.setValue( getTrimmedValue( parser.nextText() ) );
1019 }
1020 else
1021 {
1022 checkUnknownElement( parser, strict );
1023 }
1024 }
1025 return activationProperty;
1026 }
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037 private Build parseBuild( XmlPullParser parser, boolean strict )
1038 throws IOException, XmlPullParserException
1039 {
1040 String tagName = parser.getName();
1041 Build build = new Build();
1042 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1043 {
1044 String name = parser.getAttributeName( i );
1045 String value = parser.getAttributeValue( i );
1046
1047 if ( name.indexOf( ':' ) >= 0 )
1048 {
1049
1050 }
1051 else
1052 {
1053 checkUnknownAttribute( parser, name, tagName, strict );
1054 }
1055 }
1056 java.util.Set parsed = new java.util.HashSet();
1057 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1058 {
1059 if ( checkFieldWithDuplicate( parser, "sourceDirectory", null, parsed ) )
1060 {
1061 build.setSourceDirectory( getTrimmedValue( parser.nextText() ) );
1062 }
1063 else if ( checkFieldWithDuplicate( parser, "scriptSourceDirectory", null, parsed ) )
1064 {
1065 build.setScriptSourceDirectory( getTrimmedValue( parser.nextText() ) );
1066 }
1067 else if ( checkFieldWithDuplicate( parser, "testSourceDirectory", null, parsed ) )
1068 {
1069 build.setTestSourceDirectory( getTrimmedValue( parser.nextText() ) );
1070 }
1071 else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1072 {
1073 build.setOutputDirectory( getTrimmedValue( parser.nextText() ) );
1074 }
1075 else if ( checkFieldWithDuplicate( parser, "testOutputDirectory", null, parsed ) )
1076 {
1077 build.setTestOutputDirectory( getTrimmedValue( parser.nextText() ) );
1078 }
1079 else if ( checkFieldWithDuplicate( parser, "extensions", null, parsed ) )
1080 {
1081 java.util.List extensions = new java.util.ArrayList
1082 build.setExtensions( extensions );
1083 while ( parser.nextTag() == XmlPullParser.START_TAG )
1084 {
1085 if ( "extension".equals( parser.getName() ) )
1086 {
1087 extensions.add( parseExtension( parser, strict ) );
1088 }
1089 else
1090 {
1091 checkUnknownElement( parser, strict );
1092 }
1093 }
1094 }
1095 else if ( checkFieldWithDuplicate( parser, "defaultGoal", null, parsed ) )
1096 {
1097 build.setDefaultGoal( getTrimmedValue( parser.nextText() ) );
1098 }
1099 else if ( checkFieldWithDuplicate( parser, "resources", null, parsed ) )
1100 {
1101 java.util.List resources = new java.util.ArrayList
1102 build.setResources( resources );
1103 while ( parser.nextTag() == XmlPullParser.START_TAG )
1104 {
1105 if ( "resource".equals( parser.getName() ) )
1106 {
1107 resources.add( parseResource( parser, strict ) );
1108 }
1109 else
1110 {
1111 checkUnknownElement( parser, strict );
1112 }
1113 }
1114 }
1115 else if ( checkFieldWithDuplicate( parser, "testResources", null, parsed ) )
1116 {
1117 java.util.List testResources = new java.util.ArrayList
1118 build.setTestResources( testResources );
1119 while ( parser.nextTag() == XmlPullParser.START_TAG )
1120 {
1121 if ( "testResource".equals( parser.getName() ) )
1122 {
1123 testResources.add( parseResource( parser, strict ) );
1124 }
1125 else
1126 {
1127 checkUnknownElement( parser, strict );
1128 }
1129 }
1130 }
1131 else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1132 {
1133 build.setDirectory( getTrimmedValue( parser.nextText() ) );
1134 }
1135 else if ( checkFieldWithDuplicate( parser, "finalName", null, parsed ) )
1136 {
1137 build.setFinalName( getTrimmedValue( parser.nextText() ) );
1138 }
1139 else if ( checkFieldWithDuplicate( parser, "filters", null, parsed ) )
1140 {
1141 java.util.List filters = new java.util.ArrayList
1142 build.setFilters( filters );
1143 while ( parser.nextTag() == XmlPullParser.START_TAG )
1144 {
1145 if ( "filter".equals( parser.getName() ) )
1146 {
1147 filters.add( getTrimmedValue( parser.nextText() ) );
1148 }
1149 else
1150 {
1151 checkUnknownElement( parser, strict );
1152 }
1153 }
1154 }
1155 else if ( checkFieldWithDuplicate( parser, "pluginManagement", null, parsed ) )
1156 {
1157 build.setPluginManagement( parsePluginManagement( parser, strict ) );
1158 }
1159 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
1160 {
1161 java.util.List plugins = new java.util.ArrayList
1162 build.setPlugins( plugins );
1163 while ( parser.nextTag() == XmlPullParser.START_TAG )
1164 {
1165 if ( "plugin".equals( parser.getName() ) )
1166 {
1167 plugins.add( parsePlugin( parser, strict ) );
1168 }
1169 else
1170 {
1171 checkUnknownElement( parser, strict );
1172 }
1173 }
1174 }
1175 else
1176 {
1177 checkUnknownElement( parser, strict );
1178 }
1179 }
1180 return build;
1181 }
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192 private BuildBase parseBuildBase( XmlPullParser parser, boolean strict )
1193 throws IOException, XmlPullParserException
1194 {
1195 String tagName = parser.getName();
1196 BuildBase buildBase = new BuildBase();
1197 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1198 {
1199 String name = parser.getAttributeName( i );
1200 String value = parser.getAttributeValue( i );
1201
1202 if ( name.indexOf( ':' ) >= 0 )
1203 {
1204
1205 }
1206 else
1207 {
1208 checkUnknownAttribute( parser, name, tagName, strict );
1209 }
1210 }
1211 java.util.Set parsed = new java.util.HashSet();
1212 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1213 {
1214 if ( checkFieldWithDuplicate( parser, "defaultGoal", null, parsed ) )
1215 {
1216 buildBase.setDefaultGoal( getTrimmedValue( parser.nextText() ) );
1217 }
1218 else if ( checkFieldWithDuplicate( parser, "resources", null, parsed ) )
1219 {
1220 java.util.List resources = new java.util.ArrayList
1221 buildBase.setResources( resources );
1222 while ( parser.nextTag() == XmlPullParser.START_TAG )
1223 {
1224 if ( "resource".equals( parser.getName() ) )
1225 {
1226 resources.add( parseResource( parser, strict ) );
1227 }
1228 else
1229 {
1230 checkUnknownElement( parser, strict );
1231 }
1232 }
1233 }
1234 else if ( checkFieldWithDuplicate( parser, "testResources", null, parsed ) )
1235 {
1236 java.util.List testResources = new java.util.ArrayList
1237 buildBase.setTestResources( testResources );
1238 while ( parser.nextTag() == XmlPullParser.START_TAG )
1239 {
1240 if ( "testResource".equals( parser.getName() ) )
1241 {
1242 testResources.add( parseResource( parser, strict ) );
1243 }
1244 else
1245 {
1246 checkUnknownElement( parser, strict );
1247 }
1248 }
1249 }
1250 else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1251 {
1252 buildBase.setDirectory( getTrimmedValue( parser.nextText() ) );
1253 }
1254 else if ( checkFieldWithDuplicate( parser, "finalName", null, parsed ) )
1255 {
1256 buildBase.setFinalName( getTrimmedValue( parser.nextText() ) );
1257 }
1258 else if ( checkFieldWithDuplicate( parser, "filters", null, parsed ) )
1259 {
1260 java.util.List filters = new java.util.ArrayList
1261 buildBase.setFilters( filters );
1262 while ( parser.nextTag() == XmlPullParser.START_TAG )
1263 {
1264 if ( "filter".equals( parser.getName() ) )
1265 {
1266 filters.add( getTrimmedValue( parser.nextText() ) );
1267 }
1268 else
1269 {
1270 checkUnknownElement( parser, strict );
1271 }
1272 }
1273 }
1274 else if ( checkFieldWithDuplicate( parser, "pluginManagement", null, parsed ) )
1275 {
1276 buildBase.setPluginManagement( parsePluginManagement( parser, strict ) );
1277 }
1278 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
1279 {
1280 java.util.List plugins = new java.util.ArrayList
1281 buildBase.setPlugins( plugins );
1282 while ( parser.nextTag() == XmlPullParser.START_TAG )
1283 {
1284 if ( "plugin".equals( parser.getName() ) )
1285 {
1286 plugins.add( parsePlugin( parser, strict ) );
1287 }
1288 else
1289 {
1290 checkUnknownElement( parser, strict );
1291 }
1292 }
1293 }
1294 else
1295 {
1296 checkUnknownElement( parser, strict );
1297 }
1298 }
1299 return buildBase;
1300 }
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311 private CiManagement parseCiManagement( XmlPullParser parser, boolean strict )
1312 throws IOException, XmlPullParserException
1313 {
1314 String tagName = parser.getName();
1315 CiManagement ciManagement = new CiManagement();
1316 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1317 {
1318 String name = parser.getAttributeName( i );
1319 String value = parser.getAttributeValue( i );
1320
1321 if ( name.indexOf( ':' ) >= 0 )
1322 {
1323
1324 }
1325 else
1326 {
1327 checkUnknownAttribute( parser, name, tagName, strict );
1328 }
1329 }
1330 java.util.Set parsed = new java.util.HashSet();
1331 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1332 {
1333 if ( checkFieldWithDuplicate( parser, "system", null, parsed ) )
1334 {
1335 ciManagement.setSystem( getTrimmedValue( parser.nextText() ) );
1336 }
1337 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1338 {
1339 ciManagement.setUrl( getTrimmedValue( parser.nextText() ) );
1340 }
1341 else if ( checkFieldWithDuplicate( parser, "notifiers", null, parsed ) )
1342 {
1343 java.util.List notifiers = new java.util.ArrayList
1344 ciManagement.setNotifiers( notifiers );
1345 while ( parser.nextTag() == XmlPullParser.START_TAG )
1346 {
1347 if ( "notifier".equals( parser.getName() ) )
1348 {
1349 notifiers.add( parseNotifier( parser, strict ) );
1350 }
1351 else
1352 {
1353 checkUnknownElement( parser, strict );
1354 }
1355 }
1356 }
1357 else
1358 {
1359 checkUnknownElement( parser, strict );
1360 }
1361 }
1362 return ciManagement;
1363 }
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374 private ConfigurationContainer parseConfigurationContainer( XmlPullParser parser, boolean strict )
1375 throws IOException, XmlPullParserException
1376 {
1377 String tagName = parser.getName();
1378 ConfigurationContainer configurationContainer = new ConfigurationContainer();
1379 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1380 {
1381 String name = parser.getAttributeName( i );
1382 String value = parser.getAttributeValue( i );
1383
1384 if ( name.indexOf( ':' ) >= 0 )
1385 {
1386
1387 }
1388 else
1389 {
1390 checkUnknownAttribute( parser, name, tagName, strict );
1391 }
1392 }
1393 java.util.Set parsed = new java.util.HashSet();
1394 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1395 {
1396 if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
1397 {
1398 configurationContainer.setInherited( getTrimmedValue( parser.nextText() ) );
1399 }
1400 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
1401 {
1402 configurationContainer.setConfiguration( Xpp3DomBuilder.build( parser ) );
1403 }
1404 else
1405 {
1406 checkUnknownElement( parser, strict );
1407 }
1408 }
1409 return configurationContainer;
1410 }
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421 private Contributor parseContributor( XmlPullParser parser, boolean strict )
1422 throws IOException, XmlPullParserException
1423 {
1424 String tagName = parser.getName();
1425 Contributor contributor = new Contributor();
1426 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1427 {
1428 String name = parser.getAttributeName( i );
1429 String value = parser.getAttributeValue( i );
1430
1431 if ( name.indexOf( ':' ) >= 0 )
1432 {
1433
1434 }
1435 else
1436 {
1437 checkUnknownAttribute( parser, name, tagName, strict );
1438 }
1439 }
1440 java.util.Set parsed = new java.util.HashSet();
1441 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1442 {
1443 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1444 {
1445 contributor.setName( getTrimmedValue( parser.nextText() ) );
1446 }
1447 else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
1448 {
1449 contributor.setEmail( getTrimmedValue( parser.nextText() ) );
1450 }
1451 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1452 {
1453 contributor.setUrl( getTrimmedValue( parser.nextText() ) );
1454 }
1455 else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
1456 {
1457 contributor.setOrganization( getTrimmedValue( parser.nextText() ) );
1458 }
1459 else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
1460 {
1461 contributor.setOrganizationUrl( getTrimmedValue( parser.nextText() ) );
1462 }
1463 else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
1464 {
1465 java.util.List roles = new java.util.ArrayList
1466 contributor.setRoles( roles );
1467 while ( parser.nextTag() == XmlPullParser.START_TAG )
1468 {
1469 if ( "role".equals( parser.getName() ) )
1470 {
1471 roles.add( getTrimmedValue( parser.nextText() ) );
1472 }
1473 else
1474 {
1475 checkUnknownElement( parser, strict );
1476 }
1477 }
1478 }
1479 else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
1480 {
1481 contributor.setTimezone( getTrimmedValue( parser.nextText() ) );
1482 }
1483 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
1484 {
1485 while ( parser.nextTag() == XmlPullParser.START_TAG )
1486 {
1487 String key = parser.getName();
1488 String value = parser.nextText().trim();
1489 contributor.addProperty( key, value );
1490 }
1491 }
1492 else
1493 {
1494 checkUnknownElement( parser, strict );
1495 }
1496 }
1497 return contributor;
1498 }
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509 private Dependency parseDependency( XmlPullParser parser, boolean strict )
1510 throws IOException, XmlPullParserException
1511 {
1512 String tagName = parser.getName();
1513 Dependency dependency = new Dependency();
1514 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1515 {
1516 String name = parser.getAttributeName( i );
1517 String value = parser.getAttributeValue( i );
1518
1519 if ( name.indexOf( ':' ) >= 0 )
1520 {
1521
1522 }
1523 else
1524 {
1525 checkUnknownAttribute( parser, name, tagName, strict );
1526 }
1527 }
1528 java.util.Set parsed = new java.util.HashSet();
1529 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1530 {
1531 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
1532 {
1533 dependency.setGroupId( getTrimmedValue( parser.nextText() ) );
1534 }
1535 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
1536 {
1537 dependency.setArtifactId( getTrimmedValue( parser.nextText() ) );
1538 }
1539 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
1540 {
1541 dependency.setVersion( getTrimmedValue( parser.nextText() ) );
1542 }
1543 else if ( checkFieldWithDuplicate( parser, "type", null, parsed ) )
1544 {
1545 dependency.setType( getTrimmedValue( parser.nextText() ) );
1546 }
1547 else if ( checkFieldWithDuplicate( parser, "classifier", null, parsed ) )
1548 {
1549 dependency.setClassifier( getTrimmedValue( parser.nextText() ) );
1550 }
1551 else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) )
1552 {
1553 dependency.setScope( getTrimmedValue( parser.nextText() ) );
1554 }
1555 else if ( checkFieldWithDuplicate( parser, "systemPath", null, parsed ) )
1556 {
1557 dependency.setSystemPath( getTrimmedValue( parser.nextText() ) );
1558 }
1559 else if ( checkFieldWithDuplicate( parser, "exclusions", null, parsed ) )
1560 {
1561 java.util.List exclusions = new java.util.ArrayList
1562 dependency.setExclusions( exclusions );
1563 while ( parser.nextTag() == XmlPullParser.START_TAG )
1564 {
1565 if ( "exclusion".equals( parser.getName() ) )
1566 {
1567 exclusions.add( parseExclusion( parser, strict ) );
1568 }
1569 else
1570 {
1571 checkUnknownElement( parser, strict );
1572 }
1573 }
1574 }
1575 else if ( checkFieldWithDuplicate( parser, "optional", null, parsed ) )
1576 {
1577 dependency.setOptional( getTrimmedValue( parser.nextText() ) );
1578 }
1579 else
1580 {
1581 checkUnknownElement( parser, strict );
1582 }
1583 }
1584 return dependency;
1585 }
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596 private DependencyManagement parseDependencyManagement( XmlPullParser parser, boolean strict )
1597 throws IOException, XmlPullParserException
1598 {
1599 String tagName = parser.getName();
1600 DependencyManagement dependencyManagement = new DependencyManagement();
1601 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1602 {
1603 String name = parser.getAttributeName( i );
1604 String value = parser.getAttributeValue( i );
1605
1606 if ( name.indexOf( ':' ) >= 0 )
1607 {
1608
1609 }
1610 else
1611 {
1612 checkUnknownAttribute( parser, name, tagName, strict );
1613 }
1614 }
1615 java.util.Set parsed = new java.util.HashSet();
1616 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1617 {
1618 if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
1619 {
1620 java.util.List dependencies = new java.util.ArrayList
1621 dependencyManagement.setDependencies( dependencies );
1622 while ( parser.nextTag() == XmlPullParser.START_TAG )
1623 {
1624 if ( "dependency".equals( parser.getName() ) )
1625 {
1626 dependencies.add( parseDependency( parser, strict ) );
1627 }
1628 else
1629 {
1630 checkUnknownElement( parser, strict );
1631 }
1632 }
1633 }
1634 else
1635 {
1636 checkUnknownElement( parser, strict );
1637 }
1638 }
1639 return dependencyManagement;
1640 }
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651 private DeploymentRepository parseDeploymentRepository( XmlPullParser parser, boolean strict )
1652 throws IOException, XmlPullParserException
1653 {
1654 String tagName = parser.getName();
1655 DeploymentRepository deploymentRepository = new DeploymentRepository();
1656 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1657 {
1658 String name = parser.getAttributeName( i );
1659 String value = parser.getAttributeValue( i );
1660
1661 if ( name.indexOf( ':' ) >= 0 )
1662 {
1663
1664 }
1665 else
1666 {
1667 checkUnknownAttribute( parser, name, tagName, strict );
1668 }
1669 }
1670 java.util.Set parsed = new java.util.HashSet();
1671 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1672 {
1673 if ( checkFieldWithDuplicate( parser, "uniqueVersion", null, parsed ) )
1674 {
1675 deploymentRepository.setUniqueVersion( getBooleanValue( getTrimmedValue( parser.nextText() ), "uniqueVersion", parser, "true" ) );
1676 }
1677 else if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) )
1678 {
1679 deploymentRepository.setReleases( parseRepositoryPolicy( parser, strict ) );
1680 }
1681 else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) )
1682 {
1683 deploymentRepository.setSnapshots( parseRepositoryPolicy( parser, strict ) );
1684 }
1685 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1686 {
1687 deploymentRepository.setId( getTrimmedValue( parser.nextText() ) );
1688 }
1689 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1690 {
1691 deploymentRepository.setName( getTrimmedValue( parser.nextText() ) );
1692 }
1693 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1694 {
1695 deploymentRepository.setUrl( getTrimmedValue( parser.nextText() ) );
1696 }
1697 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
1698 {
1699 deploymentRepository.setLayout( getTrimmedValue( parser.nextText() ) );
1700 }
1701 else
1702 {
1703 checkUnknownElement( parser, strict );
1704 }
1705 }
1706 return deploymentRepository;
1707 }
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718 private Developer parseDeveloper( XmlPullParser parser, boolean strict )
1719 throws IOException, XmlPullParserException
1720 {
1721 String tagName = parser.getName();
1722 Developer developer = new Developer();
1723 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1724 {
1725 String name = parser.getAttributeName( i );
1726 String value = parser.getAttributeValue( i );
1727
1728 if ( name.indexOf( ':' ) >= 0 )
1729 {
1730
1731 }
1732 else
1733 {
1734 checkUnknownAttribute( parser, name, tagName, strict );
1735 }
1736 }
1737 java.util.Set parsed = new java.util.HashSet();
1738 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1739 {
1740 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1741 {
1742 developer.setId( getTrimmedValue( parser.nextText() ) );
1743 }
1744 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1745 {
1746 developer.setName( getTrimmedValue( parser.nextText() ) );
1747 }
1748 else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
1749 {
1750 developer.setEmail( getTrimmedValue( parser.nextText() ) );
1751 }
1752 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1753 {
1754 developer.setUrl( getTrimmedValue( parser.nextText() ) );
1755 }
1756 else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
1757 {
1758 developer.setOrganization( getTrimmedValue( parser.nextText() ) );
1759 }
1760 else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
1761 {
1762 developer.setOrganizationUrl( getTrimmedValue( parser.nextText() ) );
1763 }
1764 else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
1765 {
1766 java.util.List roles = new java.util.ArrayList
1767 developer.setRoles( roles );
1768 while ( parser.nextTag() == XmlPullParser.START_TAG )
1769 {
1770 if ( "role".equals( parser.getName() ) )
1771 {
1772 roles.add( getTrimmedValue( parser.nextText() ) );
1773 }
1774 else
1775 {
1776 checkUnknownElement( parser, strict );
1777 }
1778 }
1779 }
1780 else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
1781 {
1782 developer.setTimezone( getTrimmedValue( parser.nextText() ) );
1783 }
1784 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
1785 {
1786 while ( parser.nextTag() == XmlPullParser.START_TAG )
1787 {
1788 String key = parser.getName();
1789 String value = parser.nextText().trim();
1790 developer.addProperty( key, value );
1791 }
1792 }
1793 else
1794 {
1795 checkUnknownElement( parser, strict );
1796 }
1797 }
1798 return developer;
1799 }
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810 private DistributionManagement parseDistributionManagement( XmlPullParser parser, boolean strict )
1811 throws IOException, XmlPullParserException
1812 {
1813 String tagName = parser.getName();
1814 DistributionManagement distributionManagement = new DistributionManagement();
1815 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1816 {
1817 String name = parser.getAttributeName( i );
1818 String value = parser.getAttributeValue( i );
1819
1820 if ( name.indexOf( ':' ) >= 0 )
1821 {
1822
1823 }
1824 else
1825 {
1826 checkUnknownAttribute( parser, name, tagName, strict );
1827 }
1828 }
1829 java.util.Set parsed = new java.util.HashSet();
1830 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1831 {
1832 if ( checkFieldWithDuplicate( parser, "repository", null, parsed ) )
1833 {
1834 distributionManagement.setRepository( parseDeploymentRepository( parser, strict ) );
1835 }
1836 else if ( checkFieldWithDuplicate( parser, "snapshotRepository", null, parsed ) )
1837 {
1838 distributionManagement.setSnapshotRepository( parseDeploymentRepository( parser, strict ) );
1839 }
1840 else if ( checkFieldWithDuplicate( parser, "site", null, parsed ) )
1841 {
1842 distributionManagement.setSite( parseSite( parser, strict ) );
1843 }
1844 else if ( checkFieldWithDuplicate( parser, "downloadUrl", null, parsed ) )
1845 {
1846 distributionManagement.setDownloadUrl( getTrimmedValue( parser.nextText() ) );
1847 }
1848 else if ( checkFieldWithDuplicate( parser, "relocation", null, parsed ) )
1849 {
1850 distributionManagement.setRelocation( parseRelocation( parser, strict ) );
1851 }
1852 else if ( checkFieldWithDuplicate( parser, "status", null, parsed ) )
1853 {
1854 distributionManagement.setStatus( getTrimmedValue( parser.nextText() ) );
1855 }
1856 else
1857 {
1858 checkUnknownElement( parser, strict );
1859 }
1860 }
1861 return distributionManagement;
1862 }
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873 private Exclusion parseExclusion( XmlPullParser parser, boolean strict )
1874 throws IOException, XmlPullParserException
1875 {
1876 String tagName = parser.getName();
1877 Exclusion exclusion = new Exclusion();
1878 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1879 {
1880 String name = parser.getAttributeName( i );
1881 String value = parser.getAttributeValue( i );
1882
1883 if ( name.indexOf( ':' ) >= 0 )
1884 {
1885
1886 }
1887 else
1888 {
1889 checkUnknownAttribute( parser, name, tagName, strict );
1890 }
1891 }
1892 java.util.Set parsed = new java.util.HashSet();
1893 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1894 {
1895 if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
1896 {
1897 exclusion.setArtifactId( getTrimmedValue( parser.nextText() ) );
1898 }
1899 else if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
1900 {
1901 exclusion.setGroupId( getTrimmedValue( parser.nextText() ) );
1902 }
1903 else
1904 {
1905 checkUnknownElement( parser, strict );
1906 }
1907 }
1908 return exclusion;
1909 }
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920 private Extension parseExtension( XmlPullParser parser, boolean strict )
1921 throws IOException, XmlPullParserException
1922 {
1923 String tagName = parser.getName();
1924 Extension extension = new Extension();
1925 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1926 {
1927 String name = parser.getAttributeName( i );
1928 String value = parser.getAttributeValue( i );
1929
1930 if ( name.indexOf( ':' ) >= 0 )
1931 {
1932
1933 }
1934 else
1935 {
1936 checkUnknownAttribute( parser, name, tagName, strict );
1937 }
1938 }
1939 java.util.Set parsed = new java.util.HashSet();
1940 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1941 {
1942 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
1943 {
1944 extension.setGroupId( getTrimmedValue( parser.nextText() ) );
1945 }
1946 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
1947 {
1948 extension.setArtifactId( getTrimmedValue( parser.nextText() ) );
1949 }
1950 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
1951 {
1952 extension.setVersion( getTrimmedValue( parser.nextText() ) );
1953 }
1954 else
1955 {
1956 checkUnknownElement( parser, strict );
1957 }
1958 }
1959 return extension;
1960 }
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971 private FileSet parseFileSet( XmlPullParser parser, boolean strict )
1972 throws IOException, XmlPullParserException
1973 {
1974 String tagName = parser.getName();
1975 FileSet fileSet = new FileSet();
1976 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1977 {
1978 String name = parser.getAttributeName( i );
1979 String value = parser.getAttributeValue( i );
1980
1981 if ( name.indexOf( ':' ) >= 0 )
1982 {
1983
1984 }
1985 else
1986 {
1987 checkUnknownAttribute( parser, name, tagName, strict );
1988 }
1989 }
1990 java.util.Set parsed = new java.util.HashSet();
1991 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1992 {
1993 if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1994 {
1995 fileSet.setDirectory( getTrimmedValue( parser.nextText() ) );
1996 }
1997 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1998 {
1999 java.util.List includes = new java.util.ArrayList
2000 fileSet.setIncludes( includes );
2001 while ( parser.nextTag() == XmlPullParser.START_TAG )
2002 {
2003 if ( "include".equals( parser.getName() ) )
2004 {
2005 includes.add( getTrimmedValue( parser.nextText() ) );
2006 }
2007 else
2008 {
2009 checkUnknownElement( parser, strict );
2010 }
2011 }
2012 }
2013 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
2014 {
2015 java.util.List excludes = new java.util.ArrayList
2016 fileSet.setExcludes( excludes );
2017 while ( parser.nextTag() == XmlPullParser.START_TAG )
2018 {
2019 if ( "exclude".equals( parser.getName() ) )
2020 {
2021 excludes.add( getTrimmedValue( parser.nextText() ) );
2022 }
2023 else
2024 {
2025 checkUnknownElement( parser, strict );
2026 }
2027 }
2028 }
2029 else
2030 {
2031 checkUnknownElement( parser, strict );
2032 }
2033 }
2034 return fileSet;
2035 }
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046 private IssueManagement parseIssueManagement( XmlPullParser parser, boolean strict )
2047 throws IOException, XmlPullParserException
2048 {
2049 String tagName = parser.getName();
2050 IssueManagement issueManagement = new IssueManagement();
2051 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2052 {
2053 String name = parser.getAttributeName( i );
2054 String value = parser.getAttributeValue( i );
2055
2056 if ( name.indexOf( ':' ) >= 0 )
2057 {
2058
2059 }
2060 else
2061 {
2062 checkUnknownAttribute( parser, name, tagName, strict );
2063 }
2064 }
2065 java.util.Set parsed = new java.util.HashSet();
2066 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2067 {
2068 if ( checkFieldWithDuplicate( parser, "system", null, parsed ) )
2069 {
2070 issueManagement.setSystem( getTrimmedValue( parser.nextText() ) );
2071 }
2072 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2073 {
2074 issueManagement.setUrl( getTrimmedValue( parser.nextText() ) );
2075 }
2076 else
2077 {
2078 checkUnknownElement( parser, strict );
2079 }
2080 }
2081 return issueManagement;
2082 }
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093 private License parseLicense( XmlPullParser parser, boolean strict )
2094 throws IOException, XmlPullParserException
2095 {
2096 String tagName = parser.getName();
2097 License license = new License();
2098 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2099 {
2100 String name = parser.getAttributeName( i );
2101 String value = parser.getAttributeValue( i );
2102
2103 if ( name.indexOf( ':' ) >= 0 )
2104 {
2105
2106 }
2107 else
2108 {
2109 checkUnknownAttribute( parser, name, tagName, strict );
2110 }
2111 }
2112 java.util.Set parsed = new java.util.HashSet();
2113 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2114 {
2115 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2116 {
2117 license.setName( getTrimmedValue( parser.nextText() ) );
2118 }
2119 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2120 {
2121 license.setUrl( getTrimmedValue( parser.nextText() ) );
2122 }
2123 else if ( checkFieldWithDuplicate( parser, "distribution", null, parsed ) )
2124 {
2125 license.setDistribution( getTrimmedValue( parser.nextText() ) );
2126 }
2127 else if ( checkFieldWithDuplicate( parser, "comments", null, parsed ) )
2128 {
2129 license.setComments( getTrimmedValue( parser.nextText() ) );
2130 }
2131 else
2132 {
2133 checkUnknownElement( parser, strict );
2134 }
2135 }
2136 return license;
2137 }
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148 private MailingList parseMailingList( XmlPullParser parser, boolean strict )
2149 throws IOException, XmlPullParserException
2150 {
2151 String tagName = parser.getName();
2152 MailingList mailingList = new MailingList();
2153 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2154 {
2155 String name = parser.getAttributeName( i );
2156 String value = parser.getAttributeValue( i );
2157
2158 if ( name.indexOf( ':' ) >= 0 )
2159 {
2160
2161 }
2162 else
2163 {
2164 checkUnknownAttribute( parser, name, tagName, strict );
2165 }
2166 }
2167 java.util.Set parsed = new java.util.HashSet();
2168 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2169 {
2170 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2171 {
2172 mailingList.setName( getTrimmedValue( parser.nextText() ) );
2173 }
2174 else if ( checkFieldWithDuplicate( parser, "subscribe", null, parsed ) )
2175 {
2176 mailingList.setSubscribe( getTrimmedValue( parser.nextText() ) );
2177 }
2178 else if ( checkFieldWithDuplicate( parser, "unsubscribe", null, parsed ) )
2179 {
2180 mailingList.setUnsubscribe( getTrimmedValue( parser.nextText() ) );
2181 }
2182 else if ( checkFieldWithDuplicate( parser, "post", null, parsed ) )
2183 {
2184 mailingList.setPost( getTrimmedValue( parser.nextText() ) );
2185 }
2186 else if ( checkFieldWithDuplicate( parser, "archive", null, parsed ) )
2187 {
2188 mailingList.setArchive( getTrimmedValue( parser.nextText() ) );
2189 }
2190 else if ( checkFieldWithDuplicate( parser, "otherArchives", null, parsed ) )
2191 {
2192 java.util.List otherArchives = new java.util.ArrayList
2193 mailingList.setOtherArchives( otherArchives );
2194 while ( parser.nextTag() == XmlPullParser.START_TAG )
2195 {
2196 if ( "otherArchive".equals( parser.getName() ) )
2197 {
2198 otherArchives.add( getTrimmedValue( parser.nextText() ) );
2199 }
2200 else
2201 {
2202 checkUnknownElement( parser, strict );
2203 }
2204 }
2205 }
2206 else
2207 {
2208 checkUnknownElement( parser, strict );
2209 }
2210 }
2211 return mailingList;
2212 }
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223 private Model parseModel( XmlPullParser parser, boolean strict )
2224 throws IOException, XmlPullParserException
2225 {
2226 String tagName = parser.getName();
2227 Model model = new Model();
2228 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2229 {
2230 String name = parser.getAttributeName( i );
2231 String value = parser.getAttributeValue( i );
2232
2233 if ( name.indexOf( ':' ) >= 0 )
2234 {
2235
2236 }
2237 else if ( "xmlns".equals( name ) )
2238 {
2239
2240 }
2241 else
2242 {
2243 checkUnknownAttribute( parser, name, tagName, strict );
2244 }
2245 }
2246 java.util.Set parsed = new java.util.HashSet();
2247 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2248 {
2249 if ( checkFieldWithDuplicate( parser, "modelVersion", null, parsed ) )
2250 {
2251 model.setModelVersion( getTrimmedValue( parser.nextText() ) );
2252 }
2253 else if ( checkFieldWithDuplicate( parser, "parent", null, parsed ) )
2254 {
2255 model.setParent( parseParent( parser, strict ) );
2256 }
2257 else if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2258 {
2259 model.setGroupId( getTrimmedValue( parser.nextText() ) );
2260 }
2261 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2262 {
2263 model.setArtifactId( getTrimmedValue( parser.nextText() ) );
2264 }
2265 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2266 {
2267 model.setVersion( getTrimmedValue( parser.nextText() ) );
2268 }
2269 else if ( checkFieldWithDuplicate( parser, "packaging", null, parsed ) )
2270 {
2271 model.setPackaging( getTrimmedValue( parser.nextText() ) );
2272 }
2273 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2274 {
2275 model.setName( getTrimmedValue( parser.nextText() ) );
2276 }
2277 else if ( checkFieldWithDuplicate( parser, "description", null, parsed ) )
2278 {
2279 model.setDescription( getTrimmedValue( parser.nextText() ) );
2280 }
2281 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2282 {
2283 model.setUrl( getTrimmedValue( parser.nextText() ) );
2284 }
2285 else if ( checkFieldWithDuplicate( parser, "inceptionYear", null, parsed ) )
2286 {
2287 model.setInceptionYear( getTrimmedValue( parser.nextText() ) );
2288 }
2289 else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
2290 {
2291 model.setOrganization( parseOrganization( parser, strict ) );
2292 }
2293 else if ( checkFieldWithDuplicate( parser, "licenses", null, parsed ) )
2294 {
2295 java.util.List licenses = new java.util.ArrayList
2296 model.setLicenses( licenses );
2297 while ( parser.nextTag() == XmlPullParser.START_TAG )
2298 {
2299 if ( "license".equals( parser.getName() ) )
2300 {
2301 licenses.add( parseLicense( parser, strict ) );
2302 }
2303 else
2304 {
2305 checkUnknownElement( parser, strict );
2306 }
2307 }
2308 }
2309 else if ( checkFieldWithDuplicate( parser, "developers", null, parsed ) )
2310 {
2311 java.util.List developers = new java.util.ArrayList
2312 model.setDevelopers( developers );
2313 while ( parser.nextTag() == XmlPullParser.START_TAG )
2314 {
2315 if ( "developer".equals( parser.getName() ) )
2316 {
2317 developers.add( parseDeveloper( parser, strict ) );
2318 }
2319 else
2320 {
2321 checkUnknownElement( parser, strict );
2322 }
2323 }
2324 }
2325 else if ( checkFieldWithDuplicate( parser, "contributors", null, parsed ) )
2326 {
2327 java.util.List contributors = new java.util.ArrayList
2328 model.setContributors( contributors );
2329 while ( parser.nextTag() == XmlPullParser.START_TAG )
2330 {
2331 if ( "contributor".equals( parser.getName() ) )
2332 {
2333 contributors.add( parseContributor( parser, strict ) );
2334 }
2335 else
2336 {
2337 checkUnknownElement( parser, strict );
2338 }
2339 }
2340 }
2341 else if ( checkFieldWithDuplicate( parser, "mailingLists", null, parsed ) )
2342 {
2343 java.util.List mailingLists = new java.util.ArrayList
2344 model.setMailingLists( mailingLists );
2345 while ( parser.nextTag() == XmlPullParser.START_TAG )
2346 {
2347 if ( "mailingList".equals( parser.getName() ) )
2348 {
2349 mailingLists.add( parseMailingList( parser, strict ) );
2350 }
2351 else
2352 {
2353 checkUnknownElement( parser, strict );
2354 }
2355 }
2356 }
2357 else if ( checkFieldWithDuplicate( parser, "prerequisites", null, parsed ) )
2358 {
2359 model.setPrerequisites( parsePrerequisites( parser, strict ) );
2360 }
2361 else if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
2362 {
2363 java.util.List modules = new java.util.ArrayList
2364 model.setModules( modules );
2365 while ( parser.nextTag() == XmlPullParser.START_TAG )
2366 {
2367 if ( "module".equals( parser.getName() ) )
2368 {
2369 modules.add( getTrimmedValue( parser.nextText() ) );
2370 }
2371 else
2372 {
2373 checkUnknownElement( parser, strict );
2374 }
2375 }
2376 }
2377 else if ( checkFieldWithDuplicate( parser, "scm", null, parsed ) )
2378 {
2379 model.setScm( parseScm( parser, strict ) );
2380 }
2381 else if ( checkFieldWithDuplicate( parser, "issueManagement", null, parsed ) )
2382 {
2383 model.setIssueManagement( parseIssueManagement( parser, strict ) );
2384 }
2385 else if ( checkFieldWithDuplicate( parser, "ciManagement", null, parsed ) )
2386 {
2387 model.setCiManagement( parseCiManagement( parser, strict ) );
2388 }
2389 else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
2390 {
2391 model.setDistributionManagement( parseDistributionManagement( parser, strict ) );
2392 }
2393 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
2394 {
2395 while ( parser.nextTag() == XmlPullParser.START_TAG )
2396 {
2397 String key = parser.getName();
2398 String value = parser.nextText().trim();
2399 model.addProperty( key, value );
2400 }
2401 }
2402 else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
2403 {
2404 model.setDependencyManagement( parseDependencyManagement( parser, strict ) );
2405 }
2406 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
2407 {
2408 java.util.List dependencies = new java.util.ArrayList
2409 model.setDependencies( dependencies );
2410 while ( parser.nextTag() == XmlPullParser.START_TAG )
2411 {
2412 if ( "dependency".equals( parser.getName() ) )
2413 {
2414 dependencies.add( parseDependency( parser, strict ) );
2415 }
2416 else
2417 {
2418 checkUnknownElement( parser, strict );
2419 }
2420 }
2421 }
2422 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
2423 {
2424 java.util.List repositories = new java.util.ArrayList
2425 model.setRepositories( repositories );
2426 while ( parser.nextTag() == XmlPullParser.START_TAG )
2427 {
2428 if ( "repository".equals( parser.getName() ) )
2429 {
2430 repositories.add( parseRepository( parser, strict ) );
2431 }
2432 else
2433 {
2434 checkUnknownElement( parser, strict );
2435 }
2436 }
2437 }
2438 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
2439 {
2440 java.util.List pluginRepositories = new java.util.ArrayList
2441 model.setPluginRepositories( pluginRepositories );
2442 while ( parser.nextTag() == XmlPullParser.START_TAG )
2443 {
2444 if ( "pluginRepository".equals( parser.getName() ) )
2445 {
2446 pluginRepositories.add( parseRepository( parser, strict ) );
2447 }
2448 else
2449 {
2450 checkUnknownElement( parser, strict );
2451 }
2452 }
2453 }
2454 else if ( checkFieldWithDuplicate( parser, "build", null, parsed ) )
2455 {
2456 model.setBuild( parseBuild( parser, strict ) );
2457 }
2458 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
2459 {
2460 model.setReports( Xpp3DomBuilder.build( parser ) );
2461 }
2462 else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
2463 {
2464 model.setReporting( parseReporting( parser, strict ) );
2465 }
2466 else if ( checkFieldWithDuplicate( parser, "profiles", null, parsed ) )
2467 {
2468 java.util.List profiles = new java.util.ArrayList
2469 model.setProfiles( profiles );
2470 while ( parser.nextTag() == XmlPullParser.START_TAG )
2471 {
2472 if ( "profile".equals( parser.getName() ) )
2473 {
2474 profiles.add( parseProfile( parser, strict ) );
2475 }
2476 else
2477 {
2478 checkUnknownElement( parser, strict );
2479 }
2480 }
2481 }
2482 else
2483 {
2484 checkUnknownElement( parser, strict );
2485 }
2486 }
2487 return model;
2488 }
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499 private ModelBase parseModelBase( XmlPullParser parser, boolean strict )
2500 throws IOException, XmlPullParserException
2501 {
2502 String tagName = parser.getName();
2503 ModelBase modelBase = new ModelBase();
2504 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2505 {
2506 String name = parser.getAttributeName( i );
2507 String value = parser.getAttributeValue( i );
2508
2509 if ( name.indexOf( ':' ) >= 0 )
2510 {
2511
2512 }
2513 else
2514 {
2515 checkUnknownAttribute( parser, name, tagName, strict );
2516 }
2517 }
2518 java.util.Set parsed = new java.util.HashSet();
2519 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2520 {
2521 if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
2522 {
2523 java.util.List modules = new java.util.ArrayList
2524 modelBase.setModules( modules );
2525 while ( parser.nextTag() == XmlPullParser.START_TAG )
2526 {
2527 if ( "module".equals( parser.getName() ) )
2528 {
2529 modules.add( getTrimmedValue( parser.nextText() ) );
2530 }
2531 else
2532 {
2533 checkUnknownElement( parser, strict );
2534 }
2535 }
2536 }
2537 else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
2538 {
2539 modelBase.setDistributionManagement( parseDistributionManagement( parser, strict ) );
2540 }
2541 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
2542 {
2543 while ( parser.nextTag() == XmlPullParser.START_TAG )
2544 {
2545 String key = parser.getName();
2546 String value = parser.nextText().trim();
2547 modelBase.addProperty( key, value );
2548 }
2549 }
2550 else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
2551 {
2552 modelBase.setDependencyManagement( parseDependencyManagement( parser, strict ) );
2553 }
2554 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
2555 {
2556 java.util.List dependencies = new java.util.ArrayList
2557 modelBase.setDependencies( dependencies );
2558 while ( parser.nextTag() == XmlPullParser.START_TAG )
2559 {
2560 if ( "dependency".equals( parser.getName() ) )
2561 {
2562 dependencies.add( parseDependency( parser, strict ) );
2563 }
2564 else
2565 {
2566 checkUnknownElement( parser, strict );
2567 }
2568 }
2569 }
2570 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
2571 {
2572 java.util.List repositories = new java.util.ArrayList
2573 modelBase.setRepositories( repositories );
2574 while ( parser.nextTag() == XmlPullParser.START_TAG )
2575 {
2576 if ( "repository".equals( parser.getName() ) )
2577 {
2578 repositories.add( parseRepository( parser, strict ) );
2579 }
2580 else
2581 {
2582 checkUnknownElement( parser, strict );
2583 }
2584 }
2585 }
2586 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
2587 {
2588 java.util.List pluginRepositories = new java.util.ArrayList
2589 modelBase.setPluginRepositories( pluginRepositories );
2590 while ( parser.nextTag() == XmlPullParser.START_TAG )
2591 {
2592 if ( "pluginRepository".equals( parser.getName() ) )
2593 {
2594 pluginRepositories.add( parseRepository( parser, strict ) );
2595 }
2596 else
2597 {
2598 checkUnknownElement( parser, strict );
2599 }
2600 }
2601 }
2602 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
2603 {
2604 modelBase.setReports( Xpp3DomBuilder.build( parser ) );
2605 }
2606 else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
2607 {
2608 modelBase.setReporting( parseReporting( parser, strict ) );
2609 }
2610 else
2611 {
2612 checkUnknownElement( parser, strict );
2613 }
2614 }
2615 return modelBase;
2616 }
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627 private Notifier parseNotifier( XmlPullParser parser, boolean strict )
2628 throws IOException, XmlPullParserException
2629 {
2630 String tagName = parser.getName();
2631 Notifier notifier = new Notifier();
2632 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2633 {
2634 String name = parser.getAttributeName( i );
2635 String value = parser.getAttributeValue( i );
2636
2637 if ( name.indexOf( ':' ) >= 0 )
2638 {
2639
2640 }
2641 else
2642 {
2643 checkUnknownAttribute( parser, name, tagName, strict );
2644 }
2645 }
2646 java.util.Set parsed = new java.util.HashSet();
2647 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2648 {
2649 if ( checkFieldWithDuplicate( parser, "type", null, parsed ) )
2650 {
2651 notifier.setType( getTrimmedValue( parser.nextText() ) );
2652 }
2653 else if ( checkFieldWithDuplicate( parser, "sendOnError", null, parsed ) )
2654 {
2655 notifier.setSendOnError( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnError", parser, "true" ) );
2656 }
2657 else if ( checkFieldWithDuplicate( parser, "sendOnFailure", null, parsed ) )
2658 {
2659 notifier.setSendOnFailure( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnFailure", parser, "true" ) );
2660 }
2661 else if ( checkFieldWithDuplicate( parser, "sendOnSuccess", null, parsed ) )
2662 {
2663 notifier.setSendOnSuccess( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnSuccess", parser, "true" ) );
2664 }
2665 else if ( checkFieldWithDuplicate( parser, "sendOnWarning", null, parsed ) )
2666 {
2667 notifier.setSendOnWarning( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnWarning", parser, "true" ) );
2668 }
2669 else if ( checkFieldWithDuplicate( parser, "address", null, parsed ) )
2670 {
2671 notifier.setAddress( getTrimmedValue( parser.nextText() ) );
2672 }
2673 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
2674 {
2675 while ( parser.nextTag() == XmlPullParser.START_TAG )
2676 {
2677 String key = parser.getName();
2678 String value = parser.nextText().trim();
2679 notifier.addConfiguration( key, value );
2680 }
2681 }
2682 else
2683 {
2684 checkUnknownElement( parser, strict );
2685 }
2686 }
2687 return notifier;
2688 }
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699 private Organization parseOrganization( XmlPullParser parser, boolean strict )
2700 throws IOException, XmlPullParserException
2701 {
2702 String tagName = parser.getName();
2703 Organization organization = new Organization();
2704 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2705 {
2706 String name = parser.getAttributeName( i );
2707 String value = parser.getAttributeValue( i );
2708
2709 if ( name.indexOf( ':' ) >= 0 )
2710 {
2711
2712 }
2713 else
2714 {
2715 checkUnknownAttribute( parser, name, tagName, strict );
2716 }
2717 }
2718 java.util.Set parsed = new java.util.HashSet();
2719 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2720 {
2721 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2722 {
2723 organization.setName( getTrimmedValue( parser.nextText() ) );
2724 }
2725 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2726 {
2727 organization.setUrl( getTrimmedValue( parser.nextText() ) );
2728 }
2729 else
2730 {
2731 checkUnknownElement( parser, strict );
2732 }
2733 }
2734 return organization;
2735 }
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746 private Parent parseParent( XmlPullParser parser, boolean strict )
2747 throws IOException, XmlPullParserException
2748 {
2749 String tagName = parser.getName();
2750 Parent parent = new Parent();
2751 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2752 {
2753 String name = parser.getAttributeName( i );
2754 String value = parser.getAttributeValue( i );
2755
2756 if ( name.indexOf( ':' ) >= 0 )
2757 {
2758
2759 }
2760 else
2761 {
2762 checkUnknownAttribute( parser, name, tagName, strict );
2763 }
2764 }
2765 java.util.Set parsed = new java.util.HashSet();
2766 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2767 {
2768 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2769 {
2770 parent.setGroupId( getTrimmedValue( parser.nextText() ) );
2771 }
2772 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2773 {
2774 parent.setArtifactId( getTrimmedValue( parser.nextText() ) );
2775 }
2776 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2777 {
2778 parent.setVersion( getTrimmedValue( parser.nextText() ) );
2779 }
2780 else if ( checkFieldWithDuplicate( parser, "relativePath", null, parsed ) )
2781 {
2782 parent.setRelativePath( getTrimmedValue( parser.nextText() ) );
2783 }
2784 else
2785 {
2786 checkUnknownElement( parser, strict );
2787 }
2788 }
2789 return parent;
2790 }
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801 private PatternSet parsePatternSet( XmlPullParser parser, boolean strict )
2802 throws IOException, XmlPullParserException
2803 {
2804 String tagName = parser.getName();
2805 PatternSet patternSet = new PatternSet();
2806 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2807 {
2808 String name = parser.getAttributeName( i );
2809 String value = parser.getAttributeValue( i );
2810
2811 if ( name.indexOf( ':' ) >= 0 )
2812 {
2813
2814 }
2815 else
2816 {
2817 checkUnknownAttribute( parser, name, tagName, strict );
2818 }
2819 }
2820 java.util.Set parsed = new java.util.HashSet();
2821 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2822 {
2823 if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
2824 {
2825 java.util.List includes = new java.util.ArrayList
2826 patternSet.setIncludes( includes );
2827 while ( parser.nextTag() == XmlPullParser.START_TAG )
2828 {
2829 if ( "include".equals( parser.getName() ) )
2830 {
2831 includes.add( getTrimmedValue( parser.nextText() ) );
2832 }
2833 else
2834 {
2835 checkUnknownElement( parser, strict );
2836 }
2837 }
2838 }
2839 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
2840 {
2841 java.util.List excludes = new java.util.ArrayList
2842 patternSet.setExcludes( excludes );
2843 while ( parser.nextTag() == XmlPullParser.START_TAG )
2844 {
2845 if ( "exclude".equals( parser.getName() ) )
2846 {
2847 excludes.add( getTrimmedValue( parser.nextText() ) );
2848 }
2849 else
2850 {
2851 checkUnknownElement( parser, strict );
2852 }
2853 }
2854 }
2855 else
2856 {
2857 checkUnknownElement( parser, strict );
2858 }
2859 }
2860 return patternSet;
2861 }
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872 private Plugin parsePlugin( XmlPullParser parser, boolean strict )
2873 throws IOException, XmlPullParserException
2874 {
2875 String tagName = parser.getName();
2876 Plugin plugin = new Plugin();
2877 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2878 {
2879 String name = parser.getAttributeName( i );
2880 String value = parser.getAttributeValue( i );
2881
2882 if ( name.indexOf( ':' ) >= 0 )
2883 {
2884
2885 }
2886 else
2887 {
2888 checkUnknownAttribute( parser, name, tagName, strict );
2889 }
2890 }
2891 java.util.Set parsed = new java.util.HashSet();
2892 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2893 {
2894 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2895 {
2896 plugin.setGroupId( getTrimmedValue( parser.nextText() ) );
2897 }
2898 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2899 {
2900 plugin.setArtifactId( getTrimmedValue( parser.nextText() ) );
2901 }
2902 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2903 {
2904 plugin.setVersion( getTrimmedValue( parser.nextText() ) );
2905 }
2906 else if ( checkFieldWithDuplicate( parser, "extensions", null, parsed ) )
2907 {
2908 plugin.setExtensions( getTrimmedValue( parser.nextText() ) );
2909 }
2910 else if ( checkFieldWithDuplicate( parser, "executions", null, parsed ) )
2911 {
2912 java.util.List executions = new java.util.ArrayList
2913 plugin.setExecutions( executions );
2914 while ( parser.nextTag() == XmlPullParser.START_TAG )
2915 {
2916 if ( "execution".equals( parser.getName() ) )
2917 {
2918 executions.add( parsePluginExecution( parser, strict ) );
2919 }
2920 else
2921 {
2922 checkUnknownElement( parser, strict );
2923 }
2924 }
2925 }
2926 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
2927 {
2928 java.util.List dependencies = new java.util.ArrayList
2929 plugin.setDependencies( dependencies );
2930 while ( parser.nextTag() == XmlPullParser.START_TAG )
2931 {
2932 if ( "dependency".equals( parser.getName() ) )
2933 {
2934 dependencies.add( parseDependency( parser, strict ) );
2935 }
2936 else
2937 {
2938 checkUnknownElement( parser, strict );
2939 }
2940 }
2941 }
2942 else if ( checkFieldWithDuplicate( parser, "goals", null, parsed ) )
2943 {
2944 plugin.setGoals( Xpp3DomBuilder.build( parser ) );
2945 }
2946 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
2947 {
2948 plugin.setInherited( getTrimmedValue( parser.nextText() ) );
2949 }
2950 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
2951 {
2952 plugin.setConfiguration( Xpp3DomBuilder.build( parser ) );
2953 }
2954 else
2955 {
2956 checkUnknownElement( parser, strict );
2957 }
2958 }
2959 return plugin;
2960 }
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971 private PluginConfiguration parsePluginConfiguration( XmlPullParser parser, boolean strict )
2972 throws IOException, XmlPullParserException
2973 {
2974 String tagName = parser.getName();
2975 PluginConfiguration pluginConfiguration = new PluginConfiguration();
2976 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2977 {
2978 String name = parser.getAttributeName( i );
2979 String value = parser.getAttributeValue( i );
2980
2981 if ( name.indexOf( ':' ) >= 0 )
2982 {
2983
2984 }
2985 else
2986 {
2987 checkUnknownAttribute( parser, name, tagName, strict );
2988 }
2989 }
2990 java.util.Set parsed = new java.util.HashSet();
2991 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2992 {
2993 if ( checkFieldWithDuplicate( parser, "pluginManagement", null, parsed ) )
2994 {
2995 pluginConfiguration.setPluginManagement( parsePluginManagement( parser, strict ) );
2996 }
2997 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
2998 {
2999 java.util.List plugins = new java.util.ArrayList
3000 pluginConfiguration.setPlugins( plugins );
3001 while ( parser.nextTag() == XmlPullParser.START_TAG )
3002 {
3003 if ( "plugin".equals( parser.getName() ) )
3004 {
3005 plugins.add( parsePlugin( parser, strict ) );
3006 }
3007 else
3008 {
3009 checkUnknownElement( parser, strict );
3010 }
3011 }
3012 }
3013 else
3014 {
3015 checkUnknownElement( parser, strict );
3016 }
3017 }
3018 return pluginConfiguration;
3019 }
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030 private PluginContainer parsePluginContainer( XmlPullParser parser, boolean strict )
3031 throws IOException, XmlPullParserException
3032 {
3033 String tagName = parser.getName();
3034 PluginContainer pluginContainer = new PluginContainer();
3035 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3036 {
3037 String name = parser.getAttributeName( i );
3038 String value = parser.getAttributeValue( i );
3039
3040 if ( name.indexOf( ':' ) >= 0 )
3041 {
3042
3043 }
3044 else
3045 {
3046 checkUnknownAttribute( parser, name, tagName, strict );
3047 }
3048 }
3049 java.util.Set parsed = new java.util.HashSet();
3050 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3051 {
3052 if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3053 {
3054 java.util.List plugins = new java.util.ArrayList
3055 pluginContainer.setPlugins( plugins );
3056 while ( parser.nextTag() == XmlPullParser.START_TAG )
3057 {
3058 if ( "plugin".equals( parser.getName() ) )
3059 {
3060 plugins.add( parsePlugin( parser, strict ) );
3061 }
3062 else
3063 {
3064 checkUnknownElement( parser, strict );
3065 }
3066 }
3067 }
3068 else
3069 {
3070 checkUnknownElement( parser, strict );
3071 }
3072 }
3073 return pluginContainer;
3074 }
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085 private PluginExecution parsePluginExecution( XmlPullParser parser, boolean strict )
3086 throws IOException, XmlPullParserException
3087 {
3088 String tagName = parser.getName();
3089 PluginExecution pluginExecution = new PluginExecution();
3090 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3091 {
3092 String name = parser.getAttributeName( i );
3093 String value = parser.getAttributeValue( i );
3094
3095 if ( name.indexOf( ':' ) >= 0 )
3096 {
3097
3098 }
3099 else
3100 {
3101 checkUnknownAttribute( parser, name, tagName, strict );
3102 }
3103 }
3104 java.util.Set parsed = new java.util.HashSet();
3105 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3106 {
3107 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3108 {
3109 pluginExecution.setId( getTrimmedValue( parser.nextText() ) );
3110 }
3111 else if ( checkFieldWithDuplicate( parser, "phase", null, parsed ) )
3112 {
3113 pluginExecution.setPhase( getTrimmedValue( parser.nextText() ) );
3114 }
3115 else if ( checkFieldWithDuplicate( parser, "goals", null, parsed ) )
3116 {
3117 java.util.List goals = new java.util.ArrayList
3118 pluginExecution.setGoals( goals );
3119 while ( parser.nextTag() == XmlPullParser.START_TAG )
3120 {
3121 if ( "goal".equals( parser.getName() ) )
3122 {
3123 goals.add( getTrimmedValue( parser.nextText() ) );
3124 }
3125 else
3126 {
3127 checkUnknownElement( parser, strict );
3128 }
3129 }
3130 }
3131 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3132 {
3133 pluginExecution.setInherited( getTrimmedValue( parser.nextText() ) );
3134 }
3135 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3136 {
3137 pluginExecution.setConfiguration( Xpp3DomBuilder.build( parser ) );
3138 }
3139 else
3140 {
3141 checkUnknownElement( parser, strict );
3142 }
3143 }
3144 return pluginExecution;
3145 }
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156 private PluginManagement parsePluginManagement( XmlPullParser parser, boolean strict )
3157 throws IOException, XmlPullParserException
3158 {
3159 String tagName = parser.getName();
3160 PluginManagement pluginManagement = new PluginManagement();
3161 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3162 {
3163 String name = parser.getAttributeName( i );
3164 String value = parser.getAttributeValue( i );
3165
3166 if ( name.indexOf( ':' ) >= 0 )
3167 {
3168
3169 }
3170 else
3171 {
3172 checkUnknownAttribute( parser, name, tagName, strict );
3173 }
3174 }
3175 java.util.Set parsed = new java.util.HashSet();
3176 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3177 {
3178 if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3179 {
3180 java.util.List plugins = new java.util.ArrayList
3181 pluginManagement.setPlugins( plugins );
3182 while ( parser.nextTag() == XmlPullParser.START_TAG )
3183 {
3184 if ( "plugin".equals( parser.getName() ) )
3185 {
3186 plugins.add( parsePlugin( parser, strict ) );
3187 }
3188 else
3189 {
3190 checkUnknownElement( parser, strict );
3191 }
3192 }
3193 }
3194 else
3195 {
3196 checkUnknownElement( parser, strict );
3197 }
3198 }
3199 return pluginManagement;
3200 }
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211 private Prerequisites parsePrerequisites( XmlPullParser parser, boolean strict )
3212 throws IOException, XmlPullParserException
3213 {
3214 String tagName = parser.getName();
3215 Prerequisites prerequisites = new Prerequisites();
3216 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3217 {
3218 String name = parser.getAttributeName( i );
3219 String value = parser.getAttributeValue( i );
3220
3221 if ( name.indexOf( ':' ) >= 0 )
3222 {
3223
3224 }
3225 else
3226 {
3227 checkUnknownAttribute( parser, name, tagName, strict );
3228 }
3229 }
3230 java.util.Set parsed = new java.util.HashSet();
3231 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3232 {
3233 if ( checkFieldWithDuplicate( parser, "maven", null, parsed ) )
3234 {
3235 prerequisites.setMaven( getTrimmedValue( parser.nextText() ) );
3236 }
3237 else
3238 {
3239 checkUnknownElement( parser, strict );
3240 }
3241 }
3242 return prerequisites;
3243 }
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254 private Profile parseProfile( XmlPullParser parser, boolean strict )
3255 throws IOException, XmlPullParserException
3256 {
3257 String tagName = parser.getName();
3258 Profile profile = new Profile();
3259 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3260 {
3261 String name = parser.getAttributeName( i );
3262 String value = parser.getAttributeValue( i );
3263
3264 if ( name.indexOf( ':' ) >= 0 )
3265 {
3266
3267 }
3268 else
3269 {
3270 checkUnknownAttribute( parser, name, tagName, strict );
3271 }
3272 }
3273 java.util.Set parsed = new java.util.HashSet();
3274 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3275 {
3276 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3277 {
3278 profile.setId( getTrimmedValue( parser.nextText() ) );
3279 }
3280 else if ( checkFieldWithDuplicate( parser, "activation", null, parsed ) )
3281 {
3282 profile.setActivation( parseActivation( parser, strict ) );
3283 }
3284 else if ( checkFieldWithDuplicate( parser, "build", null, parsed ) )
3285 {
3286 profile.setBuild( parseBuildBase( parser, strict ) );
3287 }
3288 else if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
3289 {
3290 java.util.List modules = new java.util.ArrayList
3291 profile.setModules( modules );
3292 while ( parser.nextTag() == XmlPullParser.START_TAG )
3293 {
3294 if ( "module".equals( parser.getName() ) )
3295 {
3296 modules.add( getTrimmedValue( parser.nextText() ) );
3297 }
3298 else
3299 {
3300 checkUnknownElement( parser, strict );
3301 }
3302 }
3303 }
3304 else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
3305 {
3306 profile.setDistributionManagement( parseDistributionManagement( parser, strict ) );
3307 }
3308 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
3309 {
3310 while ( parser.nextTag() == XmlPullParser.START_TAG )
3311 {
3312 String key = parser.getName();
3313 String value = parser.nextText().trim();
3314 profile.addProperty( key, value );
3315 }
3316 }
3317 else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
3318 {
3319 profile.setDependencyManagement( parseDependencyManagement( parser, strict ) );
3320 }
3321 else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
3322 {
3323 java.util.List dependencies = new java.util.ArrayList
3324 profile.setDependencies( dependencies );
3325 while ( parser.nextTag() == XmlPullParser.START_TAG )
3326 {
3327 if ( "dependency".equals( parser.getName() ) )
3328 {
3329 dependencies.add( parseDependency( parser, strict ) );
3330 }
3331 else
3332 {
3333 checkUnknownElement( parser, strict );
3334 }
3335 }
3336 }
3337 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
3338 {
3339 java.util.List repositories = new java.util.ArrayList
3340 profile.setRepositories( repositories );
3341 while ( parser.nextTag() == XmlPullParser.START_TAG )
3342 {
3343 if ( "repository".equals( parser.getName() ) )
3344 {
3345 repositories.add( parseRepository( parser, strict ) );
3346 }
3347 else
3348 {
3349 checkUnknownElement( parser, strict );
3350 }
3351 }
3352 }
3353 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
3354 {
3355 java.util.List pluginRepositories = new java.util.ArrayList
3356 profile.setPluginRepositories( pluginRepositories );
3357 while ( parser.nextTag() == XmlPullParser.START_TAG )
3358 {
3359 if ( "pluginRepository".equals( parser.getName() ) )
3360 {
3361 pluginRepositories.add( parseRepository( parser, strict ) );
3362 }
3363 else
3364 {
3365 checkUnknownElement( parser, strict );
3366 }
3367 }
3368 }
3369 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
3370 {
3371 profile.setReports( Xpp3DomBuilder.build( parser ) );
3372 }
3373 else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
3374 {
3375 profile.setReporting( parseReporting( parser, strict ) );
3376 }
3377 else
3378 {
3379 checkUnknownElement( parser, strict );
3380 }
3381 }
3382 return profile;
3383 }
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394 private Relocation parseRelocation( XmlPullParser parser, boolean strict )
3395 throws IOException, XmlPullParserException
3396 {
3397 String tagName = parser.getName();
3398 Relocation relocation = new Relocation();
3399 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3400 {
3401 String name = parser.getAttributeName( i );
3402 String value = parser.getAttributeValue( i );
3403
3404 if ( name.indexOf( ':' ) >= 0 )
3405 {
3406
3407 }
3408 else
3409 {
3410 checkUnknownAttribute( parser, name, tagName, strict );
3411 }
3412 }
3413 java.util.Set parsed = new java.util.HashSet();
3414 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3415 {
3416 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
3417 {
3418 relocation.setGroupId( getTrimmedValue( parser.nextText() ) );
3419 }
3420 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
3421 {
3422 relocation.setArtifactId( getTrimmedValue( parser.nextText() ) );
3423 }
3424 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
3425 {
3426 relocation.setVersion( getTrimmedValue( parser.nextText() ) );
3427 }
3428 else if ( checkFieldWithDuplicate( parser, "message", null, parsed ) )
3429 {
3430 relocation.setMessage( getTrimmedValue( parser.nextText() ) );
3431 }
3432 else
3433 {
3434 checkUnknownElement( parser, strict );
3435 }
3436 }
3437 return relocation;
3438 }
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449 private ReportPlugin parseReportPlugin( XmlPullParser parser, boolean strict )
3450 throws IOException, XmlPullParserException
3451 {
3452 String tagName = parser.getName();
3453 ReportPlugin reportPlugin = new ReportPlugin();
3454 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3455 {
3456 String name = parser.getAttributeName( i );
3457 String value = parser.getAttributeValue( i );
3458
3459 if ( name.indexOf( ':' ) >= 0 )
3460 {
3461
3462 }
3463 else
3464 {
3465 checkUnknownAttribute( parser, name, tagName, strict );
3466 }
3467 }
3468 java.util.Set parsed = new java.util.HashSet();
3469 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3470 {
3471 if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
3472 {
3473 reportPlugin.setGroupId( getTrimmedValue( parser.nextText() ) );
3474 }
3475 else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
3476 {
3477 reportPlugin.setArtifactId( getTrimmedValue( parser.nextText() ) );
3478 }
3479 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
3480 {
3481 reportPlugin.setVersion( getTrimmedValue( parser.nextText() ) );
3482 }
3483 else if ( checkFieldWithDuplicate( parser, "reportSets", null, parsed ) )
3484 {
3485 java.util.List reportSets = new java.util.ArrayList
3486 reportPlugin.setReportSets( reportSets );
3487 while ( parser.nextTag() == XmlPullParser.START_TAG )
3488 {
3489 if ( "reportSet".equals( parser.getName() ) )
3490 {
3491 reportSets.add( parseReportSet( parser, strict ) );
3492 }
3493 else
3494 {
3495 checkUnknownElement( parser, strict );
3496 }
3497 }
3498 }
3499 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3500 {
3501 reportPlugin.setInherited( getTrimmedValue( parser.nextText() ) );
3502 }
3503 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3504 {
3505 reportPlugin.setConfiguration( Xpp3DomBuilder.build( parser ) );
3506 }
3507 else
3508 {
3509 checkUnknownElement( parser, strict );
3510 }
3511 }
3512 return reportPlugin;
3513 }
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524 private ReportSet parseReportSet( XmlPullParser parser, boolean strict )
3525 throws IOException, XmlPullParserException
3526 {
3527 String tagName = parser.getName();
3528 ReportSet reportSet = new ReportSet();
3529 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3530 {
3531 String name = parser.getAttributeName( i );
3532 String value = parser.getAttributeValue( i );
3533
3534 if ( name.indexOf( ':' ) >= 0 )
3535 {
3536
3537 }
3538 else
3539 {
3540 checkUnknownAttribute( parser, name, tagName, strict );
3541 }
3542 }
3543 java.util.Set parsed = new java.util.HashSet();
3544 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3545 {
3546 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3547 {
3548 reportSet.setId( getTrimmedValue( parser.nextText() ) );
3549 }
3550 else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
3551 {
3552 java.util.List reports = new java.util.ArrayList
3553 reportSet.setReports( reports );
3554 while ( parser.nextTag() == XmlPullParser.START_TAG )
3555 {
3556 if ( "report".equals( parser.getName() ) )
3557 {
3558 reports.add( getTrimmedValue( parser.nextText() ) );
3559 }
3560 else
3561 {
3562 checkUnknownElement( parser, strict );
3563 }
3564 }
3565 }
3566 else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3567 {
3568 reportSet.setInherited( getTrimmedValue( parser.nextText() ) );
3569 }
3570 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3571 {
3572 reportSet.setConfiguration( Xpp3DomBuilder.build( parser ) );
3573 }
3574 else
3575 {
3576 checkUnknownElement( parser, strict );
3577 }
3578 }
3579 return reportSet;
3580 }
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591 private Reporting parseReporting( XmlPullParser parser, boolean strict )
3592 throws IOException, XmlPullParserException
3593 {
3594 String tagName = parser.getName();
3595 Reporting reporting = new Reporting();
3596 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3597 {
3598 String name = parser.getAttributeName( i );
3599 String value = parser.getAttributeValue( i );
3600
3601 if ( name.indexOf( ':' ) >= 0 )
3602 {
3603
3604 }
3605 else
3606 {
3607 checkUnknownAttribute( parser, name, tagName, strict );
3608 }
3609 }
3610 java.util.Set parsed = new java.util.HashSet();
3611 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3612 {
3613 if ( checkFieldWithDuplicate( parser, "excludeDefaults", null, parsed ) )
3614 {
3615 reporting.setExcludeDefaults( getTrimmedValue( parser.nextText() ) );
3616 }
3617 else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
3618 {
3619 reporting.setOutputDirectory( getTrimmedValue( parser.nextText() ) );
3620 }
3621 else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3622 {
3623 java.util.List plugins = new java.util.ArrayList
3624 reporting.setPlugins( plugins );
3625 while ( parser.nextTag() == XmlPullParser.START_TAG )
3626 {
3627 if ( "plugin".equals( parser.getName() ) )
3628 {
3629 plugins.add( parseReportPlugin( parser, strict ) );
3630 }
3631 else
3632 {
3633 checkUnknownElement( parser, strict );
3634 }
3635 }
3636 }
3637 else
3638 {
3639 checkUnknownElement( parser, strict );
3640 }
3641 }
3642 return reporting;
3643 }
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654 private Repository parseRepository( XmlPullParser parser, boolean strict )
3655 throws IOException, XmlPullParserException
3656 {
3657 String tagName = parser.getName();
3658 Repository repository = new Repository();
3659 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3660 {
3661 String name = parser.getAttributeName( i );
3662 String value = parser.getAttributeValue( i );
3663
3664 if ( name.indexOf( ':' ) >= 0 )
3665 {
3666
3667 }
3668 else
3669 {
3670 checkUnknownAttribute( parser, name, tagName, strict );
3671 }
3672 }
3673 java.util.Set parsed = new java.util.HashSet();
3674 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3675 {
3676 if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) )
3677 {
3678 repository.setReleases( parseRepositoryPolicy( parser, strict ) );
3679 }
3680 else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) )
3681 {
3682 repository.setSnapshots( parseRepositoryPolicy( parser, strict ) );
3683 }
3684 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3685 {
3686 repository.setId( getTrimmedValue( parser.nextText() ) );
3687 }
3688 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
3689 {
3690 repository.setName( getTrimmedValue( parser.nextText() ) );
3691 }
3692 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
3693 {
3694 repository.setUrl( getTrimmedValue( parser.nextText() ) );
3695 }
3696 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
3697 {
3698 repository.setLayout( getTrimmedValue( parser.nextText() ) );
3699 }
3700 else
3701 {
3702 checkUnknownElement( parser, strict );
3703 }
3704 }
3705 return repository;
3706 }
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717 private RepositoryBase parseRepositoryBase( XmlPullParser parser, boolean strict )
3718 throws IOException, XmlPullParserException
3719 {
3720 String tagName = parser.getName();
3721 RepositoryBase repositoryBase = new RepositoryBase();
3722 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3723 {
3724 String name = parser.getAttributeName( i );
3725 String value = parser.getAttributeValue( i );
3726
3727 if ( name.indexOf( ':' ) >= 0 )
3728 {
3729
3730 }
3731 else
3732 {
3733 checkUnknownAttribute( parser, name, tagName, strict );
3734 }
3735 }
3736 java.util.Set parsed = new java.util.HashSet();
3737 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3738 {
3739 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3740 {
3741 repositoryBase.setId( getTrimmedValue( parser.nextText() ) );
3742 }
3743 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
3744 {
3745 repositoryBase.setName( getTrimmedValue( parser.nextText() ) );
3746 }
3747 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
3748 {
3749 repositoryBase.setUrl( getTrimmedValue( parser.nextText() ) );
3750 }
3751 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
3752 {
3753 repositoryBase.setLayout( getTrimmedValue( parser.nextText() ) );
3754 }
3755 else
3756 {
3757 checkUnknownElement( parser, strict );
3758 }
3759 }
3760 return repositoryBase;
3761 }
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772 private RepositoryPolicy parseRepositoryPolicy( XmlPullParser parser, boolean strict )
3773 throws IOException, XmlPullParserException
3774 {
3775 String tagName = parser.getName();
3776 RepositoryPolicy repositoryPolicy = new RepositoryPolicy();
3777 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3778 {
3779 String name = parser.getAttributeName( i );
3780 String value = parser.getAttributeValue( i );
3781
3782 if ( name.indexOf( ':' ) >= 0 )
3783 {
3784
3785 }
3786 else
3787 {
3788 checkUnknownAttribute( parser, name, tagName, strict );
3789 }
3790 }
3791 java.util.Set parsed = new java.util.HashSet();
3792 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3793 {
3794 if ( checkFieldWithDuplicate( parser, "enabled", null, parsed ) )
3795 {
3796 repositoryPolicy.setEnabled( getTrimmedValue( parser.nextText() ) );
3797 }
3798 else if ( checkFieldWithDuplicate( parser, "updatePolicy", null, parsed ) )
3799 {
3800 repositoryPolicy.setUpdatePolicy( getTrimmedValue( parser.nextText() ) );
3801 }
3802 else if ( checkFieldWithDuplicate( parser, "checksumPolicy", null, parsed ) )
3803 {
3804 repositoryPolicy.setChecksumPolicy( getTrimmedValue( parser.nextText() ) );
3805 }
3806 else
3807 {
3808 checkUnknownElement( parser, strict );
3809 }
3810 }
3811 return repositoryPolicy;
3812 }
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823 private Resource parseResource( XmlPullParser parser, boolean strict )
3824 throws IOException, XmlPullParserException
3825 {
3826 String tagName = parser.getName();
3827 Resource resource = new Resource();
3828 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3829 {
3830 String name = parser.getAttributeName( i );
3831 String value = parser.getAttributeValue( i );
3832
3833 if ( name.indexOf( ':' ) >= 0 )
3834 {
3835
3836 }
3837 else
3838 {
3839 checkUnknownAttribute( parser, name, tagName, strict );
3840 }
3841 }
3842 java.util.Set parsed = new java.util.HashSet();
3843 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3844 {
3845 if ( checkFieldWithDuplicate( parser, "targetPath", null, parsed ) )
3846 {
3847 resource.setTargetPath( getTrimmedValue( parser.nextText() ) );
3848 }
3849 else if ( checkFieldWithDuplicate( parser, "filtering", null, parsed ) )
3850 {
3851 resource.setFiltering( getTrimmedValue( parser.nextText() ) );
3852 }
3853 else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
3854 {
3855 resource.setDirectory( getTrimmedValue( parser.nextText() ) );
3856 }
3857 else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
3858 {
3859 java.util.List includes = new java.util.ArrayList
3860 resource.setIncludes( includes );
3861 while ( parser.nextTag() == XmlPullParser.START_TAG )
3862 {
3863 if ( "include".equals( parser.getName() ) )
3864 {
3865 includes.add( getTrimmedValue( parser.nextText() ) );
3866 }
3867 else
3868 {
3869 checkUnknownElement( parser, strict );
3870 }
3871 }
3872 }
3873 else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
3874 {
3875 java.util.List excludes = new java.util.ArrayList
3876 resource.setExcludes( excludes );
3877 while ( parser.nextTag() == XmlPullParser.START_TAG )
3878 {
3879 if ( "exclude".equals( parser.getName() ) )
3880 {
3881 excludes.add( getTrimmedValue( parser.nextText() ) );
3882 }
3883 else
3884 {
3885 checkUnknownElement( parser, strict );
3886 }
3887 }
3888 }
3889 else
3890 {
3891 checkUnknownElement( parser, strict );
3892 }
3893 }
3894 return resource;
3895 }
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906 private Scm parseScm( XmlPullParser parser, boolean strict )
3907 throws IOException, XmlPullParserException
3908 {
3909 String tagName = parser.getName();
3910 Scm scm = new Scm();
3911 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3912 {
3913 String name = parser.getAttributeName( i );
3914 String value = parser.getAttributeValue( i );
3915
3916 if ( name.indexOf( ':' ) >= 0 )
3917 {
3918
3919 }
3920 else
3921 {
3922 checkUnknownAttribute( parser, name, tagName, strict );
3923 }
3924 }
3925 java.util.Set parsed = new java.util.HashSet();
3926 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3927 {
3928 if ( checkFieldWithDuplicate( parser, "connection", null, parsed ) )
3929 {
3930 scm.setConnection( getTrimmedValue( parser.nextText() ) );
3931 }
3932 else if ( checkFieldWithDuplicate( parser, "developerConnection", null, parsed ) )
3933 {
3934 scm.setDeveloperConnection( getTrimmedValue( parser.nextText() ) );
3935 }
3936 else if ( checkFieldWithDuplicate( parser, "tag", null, parsed ) )
3937 {
3938 scm.setTag( getTrimmedValue( parser.nextText() ) );
3939 }
3940 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
3941 {
3942 scm.setUrl( getTrimmedValue( parser.nextText() ) );
3943 }
3944 else
3945 {
3946 checkUnknownElement( parser, strict );
3947 }
3948 }
3949 return scm;
3950 }
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961 private Site parseSite( XmlPullParser parser, boolean strict )
3962 throws IOException, XmlPullParserException
3963 {
3964 String tagName = parser.getName();
3965 Site site = new Site();
3966 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3967 {
3968 String name = parser.getAttributeName( i );
3969 String value = parser.getAttributeValue( i );
3970
3971 if ( name.indexOf( ':' ) >= 0 )
3972 {
3973
3974 }
3975 else
3976 {
3977 checkUnknownAttribute( parser, name, tagName, strict );
3978 }
3979 }
3980 java.util.Set parsed = new java.util.HashSet();
3981 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3982 {
3983 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3984 {
3985 site.setId( getTrimmedValue( parser.nextText() ) );
3986 }
3987 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
3988 {
3989 site.setName( getTrimmedValue( parser.nextText() ) );
3990 }
3991 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
3992 {
3993 site.setUrl( getTrimmedValue( parser.nextText() ) );
3994 }
3995 else
3996 {
3997 checkUnknownElement( parser, strict );
3998 }
3999 }
4000 return site;
4001 }
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012 public Model read( Reader reader, boolean strict )
4013 throws IOException, XmlPullParserException
4014 {
4015 XmlPullParser parser = new MXParser();
4016
4017 parser.setInput( reader );
4018
4019 initParser( parser );
4020
4021 return read( parser, strict );
4022 }
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032 public Model read( Reader reader )
4033 throws IOException, XmlPullParserException
4034 {
4035 return read( reader, true );
4036 }
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047 public Model read( InputStream in, boolean strict )
4048 throws IOException, XmlPullParserException
4049 {
4050 return read( ReaderFactory.newXmlReader( in ), strict );
4051 }
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061 public Model read( InputStream in )
4062 throws IOException, XmlPullParserException
4063 {
4064 return read( ReaderFactory.newXmlReader( in ) );
4065 }
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076 private Model read( XmlPullParser parser, boolean strict )
4077 throws IOException, XmlPullParserException
4078 {
4079 int eventType = parser.getEventType();
4080 while ( eventType != XmlPullParser.END_DOCUMENT )
4081 {
4082 if ( eventType == XmlPullParser.START_TAG )
4083 {
4084 if ( strict && ! "project".equals( parser.getName() ) )
4085 {
4086 throw new XmlPullParserException( "Expected root element 'project' but found '" + parser.getName() + "'", parser, null );
4087 }
4088 Model model = parseModel( parser, strict );
4089 model.setModelEncoding( parser.getInputEncoding() );
4090 return model;
4091 }
4092 eventType = parser.next();
4093 }
4094 throw new XmlPullParserException( "Expected root element 'project' but found no element at all: invalid XML document", parser, null );
4095 }
4096
4097
4098
4099
4100
4101
4102 public void setAddDefaultEntities( boolean addDefaultEntities )
4103 {
4104 this.addDefaultEntities = addDefaultEntities;
4105 }
4106
4107 }