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