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