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