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