View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 2.0.0,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.plugins.assembly.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.plugins.assembly.model.Component;
17  import org.apache.maven.plugins.assembly.model.ContainerDescriptorHandlerConfig;
18  import org.apache.maven.plugins.assembly.model.DependencySet;
19  import org.apache.maven.plugins.assembly.model.FileItem;
20  import org.apache.maven.plugins.assembly.model.FileSet;
21  import org.apache.maven.plugins.assembly.model.GroupVersionAlignment;
22  import org.apache.maven.plugins.assembly.model.ModuleBinaries;
23  import org.apache.maven.plugins.assembly.model.ModuleSet;
24  import org.apache.maven.plugins.assembly.model.ModuleSources;
25  import org.apache.maven.plugins.assembly.model.Repository;
26  import org.apache.maven.plugins.assembly.model.UnpackOptions;
27  import org.codehaus.plexus.util.ReaderFactory;
28  import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
29  import org.codehaus.plexus.util.xml.pull.MXParser;
30  import org.codehaus.plexus.util.xml.pull.XmlPullParser;
31  import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
32  
33  /**
34   * Class ComponentXpp3Reader.
35   * 
36   * @version $Revision$ $Date$
37   */
38  @SuppressWarnings( "all" )
39  public class ComponentXpp3Reader
40  {
41  
42        //--------------------------/
43       //- Class/Member Variables -/
44      //--------------------------/
45  
46      /**
47       * If set the parser will be loaded with all single characters
48       * from the XHTML specification.
49       * The entities used:
50       * <ul>
51       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li>
52       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li>
53       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li>
54       * </ul>
55       */
56      private boolean addDefaultEntities = true;
57  
58      /**
59       * Field contentTransformer.
60       */
61      public final ContentTransformer contentTransformer;
62  
63  
64        //----------------/
65       //- Constructors -/
66      //----------------/
67  
68      public ComponentXpp3Reader()
69      {
70          this( new ContentTransformer()
71          {
72              public String transform( String source, String fieldName )
73              {
74                  return source;
75              }
76          } );
77      } //-- org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Reader()
78  
79      public ComponentXpp3Reader(ContentTransformer contentTransformer)
80      {
81          this.contentTransformer = contentTransformer;
82      } //-- org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Reader(ContentTransformer)
83  
84  
85        //-----------/
86       //- Methods -/
87      //-----------/
88  
89      /**
90       * Method checkFieldWithDuplicate.
91       * 
92       * @param parser a parser object.
93       * @param parsed a parsed object.
94       * @param alias a alias object.
95       * @param tagName a tagName object.
96       * @throws XmlPullParserException XmlPullParserException if
97       * any.
98       * @return boolean
99       */
100     private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed )
101         throws XmlPullParserException
102     {
103         if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
104         {
105             return false;
106         }
107         if ( !parsed.add( tagName ) )
108         {
109             throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
110         }
111         return true;
112     } //-- boolean checkFieldWithDuplicate( XmlPullParser, String, String, java.util.Set )
113 
114     /**
115      * Method checkUnknownAttribute.
116      * 
117      * @param parser a parser object.
118      * @param strict a strict object.
119      * @param tagName a tagName object.
120      * @param attribute a attribute object.
121      * @throws XmlPullParserException XmlPullParserException if
122      * any.
123      * @throws IOException IOException if any.
124      */
125     private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict )
126         throws XmlPullParserException, IOException
127     {
128         // strictXmlAttributes = true for model: if strict == true, not only elements are checked but attributes too
129         if ( strict )
130         {
131             throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null );
132         }
133     } //-- void checkUnknownAttribute( XmlPullParser, String, String, boolean )
134 
135     /**
136      * Method checkUnknownElement.
137      * 
138      * @param parser a parser object.
139      * @param strict a strict object.
140      * @throws XmlPullParserException XmlPullParserException if
141      * any.
142      * @throws IOException IOException if any.
143      */
144     private void checkUnknownElement( XmlPullParser parser, boolean strict )
145         throws XmlPullParserException, IOException
146     {
147         if ( strict )
148         {
149             throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
150         }
151 
152         for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; )
153         {
154             int eventType = parser.next();
155             if ( eventType == XmlPullParser.START_TAG )
156             {
157                 unrecognizedTagCount++;
158             }
159             else if ( eventType == XmlPullParser.END_TAG )
160             {
161                 unrecognizedTagCount--;
162             }
163         }
164     } //-- void checkUnknownElement( XmlPullParser, boolean )
165 
166     /**
167      * Returns the state of the "add default entities" flag.
168      * 
169      * @return boolean
170      */
171     public boolean getAddDefaultEntities()
172     {
173         return addDefaultEntities;
174     } //-- boolean getAddDefaultEntities()
175 
176     /**
177      * Method getBooleanValue.
178      * 
179      * @param s a s object.
180      * @param parser a parser object.
181      * @param attribute a attribute object.
182      * @throws XmlPullParserException XmlPullParserException if
183      * any.
184      * @return boolean
185      */
186     private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
187         throws XmlPullParserException
188     {
189         return getBooleanValue( s, attribute, parser, null );
190     } //-- boolean getBooleanValue( String, String, XmlPullParser )
191 
192     /**
193      * Method getBooleanValue.
194      * 
195      * @param s a s object.
196      * @param defaultValue a defaultValue object.
197      * @param parser a parser object.
198      * @param attribute a attribute object.
199      * @throws XmlPullParserException XmlPullParserException if
200      * any.
201      * @return boolean
202      */
203     private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
204         throws XmlPullParserException
205     {
206         if ( s != null && s.length() != 0 )
207         {
208             return Boolean.valueOf( s ).booleanValue();
209         }
210         if ( defaultValue != null )
211         {
212             return Boolean.valueOf( defaultValue ).booleanValue();
213         }
214         return false;
215     } //-- boolean getBooleanValue( String, String, XmlPullParser, String )
216 
217     /**
218      * Method getByteValue.
219      * 
220      * @param s a s object.
221      * @param strict a strict object.
222      * @param parser a parser object.
223      * @param attribute a attribute object.
224      * @throws XmlPullParserException XmlPullParserException if
225      * any.
226      * @return byte
227      */
228     private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
229         throws XmlPullParserException
230     {
231         if ( s != null )
232         {
233             try
234             {
235                 return Byte.valueOf( s ).byteValue();
236             }
237             catch ( NumberFormatException nfe )
238             {
239                 if ( strict )
240                 {
241                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe );
242                 }
243             }
244         }
245         return 0;
246     } //-- byte getByteValue( String, String, XmlPullParser, boolean )
247 
248     /**
249      * Method getCharacterValue.
250      * 
251      * @param s a s object.
252      * @param parser a parser object.
253      * @param attribute a attribute object.
254      * @throws XmlPullParserException XmlPullParserException if
255      * any.
256      * @return char
257      */
258     private char getCharacterValue( String s, String attribute, XmlPullParser parser )
259         throws XmlPullParserException
260     {
261         if ( s != null )
262         {
263             return s.charAt( 0 );
264         }
265         return 0;
266     } //-- char getCharacterValue( String, String, XmlPullParser )
267 
268     /**
269      * Method getDateValue.
270      * 
271      * @param s a s object.
272      * @param parser a parser object.
273      * @param attribute a attribute object.
274      * @throws XmlPullParserException XmlPullParserException if
275      * any.
276      * @return Date
277      */
278     private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
279         throws XmlPullParserException
280     {
281         return getDateValue( s, attribute, null, parser );
282     } //-- java.util.Date getDateValue( String, String, XmlPullParser )
283 
284     /**
285      * Method getDateValue.
286      * 
287      * @param s a s object.
288      * @param parser a parser object.
289      * @param dateFormat a dateFormat object.
290      * @param attribute a attribute object.
291      * @throws XmlPullParserException XmlPullParserException if
292      * any.
293      * @return Date
294      */
295     private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
296         throws XmlPullParserException
297     {
298         if ( s != null )
299         {
300             String effectiveDateFormat = dateFormat;
301             if ( dateFormat == null )
302             {
303                 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
304             }
305             if ( "long".equals( effectiveDateFormat ) )
306             {
307                 try
308                 {
309                     return new java.util.Date( Long.parseLong( s ) );
310                 }
311                 catch ( NumberFormatException e )
312                 {
313                     throw new XmlPullParserException( e.getMessage(), parser, e );
314                 }
315             }
316             else
317             {
318                 try
319                 {
320                     DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, java.util.Locale.US );
321                     return dateParser.parse( s );
322                 }
323                 catch ( java.text.ParseException e )
324                 {
325                     throw new XmlPullParserException( e.getMessage(), parser, e );
326                 }
327             }
328         }
329         return null;
330     } //-- java.util.Date getDateValue( String, String, String, XmlPullParser )
331 
332     /**
333      * Method getDoubleValue.
334      * 
335      * @param s a s object.
336      * @param strict a strict object.
337      * @param parser a parser object.
338      * @param attribute a attribute object.
339      * @throws XmlPullParserException XmlPullParserException if
340      * any.
341      * @return double
342      */
343     private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
344         throws XmlPullParserException
345     {
346         if ( s != null )
347         {
348             try
349             {
350                 return Double.valueOf( s ).doubleValue();
351             }
352             catch ( NumberFormatException nfe )
353             {
354                 if ( strict )
355                 {
356                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
357                 }
358             }
359         }
360         return 0;
361     } //-- double getDoubleValue( String, String, XmlPullParser, boolean )
362 
363     /**
364      * Method getFloatValue.
365      * 
366      * @param s a s object.
367      * @param strict a strict object.
368      * @param parser a parser object.
369      * @param attribute a attribute object.
370      * @throws XmlPullParserException XmlPullParserException if
371      * any.
372      * @return float
373      */
374     private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
375         throws XmlPullParserException
376     {
377         if ( s != null )
378         {
379             try
380             {
381                 return Float.valueOf( s ).floatValue();
382             }
383             catch ( NumberFormatException nfe )
384             {
385                 if ( strict )
386                 {
387                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
388                 }
389             }
390         }
391         return 0;
392     } //-- float getFloatValue( String, String, XmlPullParser, boolean )
393 
394     /**
395      * Method getIntegerValue.
396      * 
397      * @param s a s object.
398      * @param strict a strict object.
399      * @param parser a parser object.
400      * @param attribute a attribute object.
401      * @throws XmlPullParserException XmlPullParserException if
402      * any.
403      * @return int
404      */
405     private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
406         throws XmlPullParserException
407     {
408         if ( s != null )
409         {
410             try
411             {
412                 return Integer.valueOf( s ).intValue();
413             }
414             catch ( NumberFormatException nfe )
415             {
416                 if ( strict )
417                 {
418                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe );
419                 }
420             }
421         }
422         return 0;
423     } //-- int getIntegerValue( String, String, XmlPullParser, boolean )
424 
425     /**
426      * Method getLongValue.
427      * 
428      * @param s a s object.
429      * @param strict a strict object.
430      * @param parser a parser object.
431      * @param attribute a attribute object.
432      * @throws XmlPullParserException XmlPullParserException if
433      * any.
434      * @return long
435      */
436     private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
437         throws XmlPullParserException
438     {
439         if ( s != null )
440         {
441             try
442             {
443                 return Long.valueOf( s ).longValue();
444             }
445             catch ( NumberFormatException nfe )
446             {
447                 if ( strict )
448                 {
449                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe );
450                 }
451             }
452         }
453         return 0;
454     } //-- long getLongValue( String, String, XmlPullParser, boolean )
455 
456     /**
457      * Method getRequiredAttributeValue.
458      * 
459      * @param s a s object.
460      * @param strict a strict object.
461      * @param parser a parser object.
462      * @param attribute a attribute object.
463      * @throws XmlPullParserException XmlPullParserException if
464      * any.
465      * @return String
466      */
467     private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
468         throws XmlPullParserException
469     {
470         if ( s == null )
471         {
472             if ( strict )
473             {
474                 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
475             }
476         }
477         return s;
478     } //-- String getRequiredAttributeValue( String, String, XmlPullParser, boolean )
479 
480     /**
481      * Method getShortValue.
482      * 
483      * @param s a s object.
484      * @param strict a strict object.
485      * @param parser a parser object.
486      * @param attribute a attribute object.
487      * @throws XmlPullParserException XmlPullParserException if
488      * any.
489      * @return short
490      */
491     private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
492         throws XmlPullParserException
493     {
494         if ( s != null )
495         {
496             try
497             {
498                 return Short.valueOf( s ).shortValue();
499             }
500             catch ( NumberFormatException nfe )
501             {
502                 if ( strict )
503                 {
504                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe );
505                 }
506             }
507         }
508         return 0;
509     } //-- short getShortValue( String, String, XmlPullParser, boolean )
510 
511     /**
512      * Method getTrimmedValue.
513      * 
514      * @param s a s object.
515      * @return String
516      */
517     private String getTrimmedValue( String s )
518     {
519         if ( s != null )
520         {
521             s = s.trim();
522         }
523         return s;
524     } //-- String getTrimmedValue( String )
525 
526     /**
527      * Method interpolatedTrimmed.
528      * 
529      * @param value a value object.
530      * @param context a context object.
531      * @return String
532      */
533     private String interpolatedTrimmed( String value, String context )
534     {
535         return getTrimmedValue( contentTransformer.transform( value, context ) );
536     } //-- String interpolatedTrimmed( String, String )
537 
538     /**
539      * Method nextTag.
540      * 
541      * @param parser a parser object.
542      * @throws IOException IOException if any.
543      * @throws XmlPullParserException XmlPullParserException if
544      * any.
545      * @return int
546      */
547     private int nextTag( XmlPullParser parser )
548         throws IOException, XmlPullParserException
549     {
550         int eventType = parser.next();
551         if ( eventType == XmlPullParser.TEXT )
552         {
553             eventType = parser.next();
554         }
555         if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG )
556         {
557             throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null );
558         }
559         return eventType;
560     } //-- int nextTag( XmlPullParser )
561 
562     /**
563      * @see ReaderFactory#newXmlReader
564      * 
565      * @param reader a reader object.
566      * @param strict a strict object.
567      * @throws IOException IOException if any.
568      * @throws XmlPullParserException XmlPullParserException if
569      * any.
570      * @return Component
571      */
572     public Component read( Reader reader, boolean strict )
573         throws IOException, XmlPullParserException
574     {
575         XmlPullParser parser = addDefaultEntities ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap) : new MXParser( );
576 
577         parser.setInput( reader );
578 
579 
580         return read( parser, strict );
581     } //-- Component read( Reader, boolean )
582 
583     /**
584      * @see ReaderFactory#newXmlReader
585      * 
586      * @param reader a reader object.
587      * @throws IOException IOException if any.
588      * @throws XmlPullParserException XmlPullParserException if
589      * any.
590      * @return Component
591      */
592     public Component read( Reader reader )
593         throws IOException, XmlPullParserException
594     {
595         return read( reader, true );
596     } //-- Component read( Reader )
597 
598     /**
599      * Method read.
600      * 
601      * @param in a in object.
602      * @param strict a strict object.
603      * @throws IOException IOException if any.
604      * @throws XmlPullParserException XmlPullParserException if
605      * any.
606      * @return Component
607      */
608     public Component read( InputStream in, boolean strict )
609         throws IOException, XmlPullParserException
610     {
611         return read( ReaderFactory.newXmlReader( in ), strict );
612     } //-- Component read( InputStream, boolean )
613 
614     /**
615      * Method read.
616      * 
617      * @param in a in object.
618      * @throws IOException IOException if any.
619      * @throws XmlPullParserException XmlPullParserException if
620      * any.
621      * @return Component
622      */
623     public Component read( InputStream in )
624         throws IOException, XmlPullParserException
625     {
626         return read( ReaderFactory.newXmlReader( in ) );
627     } //-- Component read( InputStream )
628 
629     /**
630      * Method parseComponent.
631      * 
632      * @param parser a parser object.
633      * @param strict a strict object.
634      * @throws IOException IOException if any.
635      * @throws XmlPullParserException XmlPullParserException if
636      * any.
637      * @return Component
638      */
639     private Component parseComponent( XmlPullParser parser, boolean strict )
640         throws IOException, XmlPullParserException
641     {
642         String tagName = parser.getName();
643         Component component = new Component();
644         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
645         {
646             String name = parser.getAttributeName( i );
647             String value = parser.getAttributeValue( i );
648 
649             if ( name.indexOf( ':' ) >= 0 )
650             {
651                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
652             }
653             else if ( "xmlns".equals( name ) )
654             {
655                 // ignore xmlns attribute in root class, which is a reserved attribute name
656             }
657             else
658             {
659                 checkUnknownAttribute( parser, name, tagName, strict );
660             }
661         }
662         java.util.Set parsed = new java.util.HashSet();
663         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
664         {
665             if ( checkFieldWithDuplicate( parser, "moduleSets", null, parsed ) )
666             {
667                 java.util.List<ModuleSet> moduleSets = new java.util.ArrayList<ModuleSet>();
668                 component.setModuleSets( moduleSets );
669                 while ( parser.nextTag() == XmlPullParser.START_TAG )
670                 {
671                     if ( "moduleSet".equals( parser.getName() ) )
672                     {
673                         moduleSets.add( parseModuleSet( parser, strict ) );
674                     }
675                     else
676                     {
677                         checkUnknownElement( parser, strict );
678                     }
679                 }
680             }
681             else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) )
682             {
683                 java.util.List<FileSet> fileSets = new java.util.ArrayList<FileSet>();
684                 component.setFileSets( fileSets );
685                 while ( parser.nextTag() == XmlPullParser.START_TAG )
686                 {
687                     if ( "fileSet".equals( parser.getName() ) )
688                     {
689                         fileSets.add( parseFileSet( parser, strict ) );
690                     }
691                     else
692                     {
693                         checkUnknownElement( parser, strict );
694                     }
695                 }
696             }
697             else if ( checkFieldWithDuplicate( parser, "files", null, parsed ) )
698             {
699                 java.util.List<FileItem> files = new java.util.ArrayList<FileItem>();
700                 component.setFiles( files );
701                 while ( parser.nextTag() == XmlPullParser.START_TAG )
702                 {
703                     if ( "file".equals( parser.getName() ) )
704                     {
705                         files.add( parseFileItem( parser, strict ) );
706                     }
707                     else
708                     {
709                         checkUnknownElement( parser, strict );
710                     }
711                 }
712             }
713             else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) )
714             {
715                 java.util.List<DependencySet> dependencySets = new java.util.ArrayList<DependencySet>();
716                 component.setDependencySets( dependencySets );
717                 while ( parser.nextTag() == XmlPullParser.START_TAG )
718                 {
719                     if ( "dependencySet".equals( parser.getName() ) )
720                     {
721                         dependencySets.add( parseDependencySet( parser, strict ) );
722                     }
723                     else
724                     {
725                         checkUnknownElement( parser, strict );
726                     }
727                 }
728             }
729             else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
730             {
731                 java.util.List<Repository> repositories = new java.util.ArrayList<Repository>();
732                 component.setRepositories( repositories );
733                 while ( parser.nextTag() == XmlPullParser.START_TAG )
734                 {
735                     if ( "repository".equals( parser.getName() ) )
736                     {
737                         repositories.add( parseRepository( parser, strict ) );
738                     }
739                     else
740                     {
741                         checkUnknownElement( parser, strict );
742                     }
743                 }
744             }
745             else if ( checkFieldWithDuplicate( parser, "containerDescriptorHandlers", null, parsed ) )
746             {
747                 java.util.List<ContainerDescriptorHandlerConfig> containerDescriptorHandlers = new java.util.ArrayList<ContainerDescriptorHandlerConfig>();
748                 component.setContainerDescriptorHandlers( containerDescriptorHandlers );
749                 while ( parser.nextTag() == XmlPullParser.START_TAG )
750                 {
751                     if ( "containerDescriptorHandler".equals( parser.getName() ) )
752                     {
753                         containerDescriptorHandlers.add( parseContainerDescriptorHandlerConfig( parser, strict ) );
754                     }
755                     else
756                     {
757                         checkUnknownElement( parser, strict );
758                     }
759                 }
760             }
761             else
762             {
763                 checkUnknownElement( parser, strict );
764             }
765         }
766         return component;
767     } //-- Component parseComponent( XmlPullParser, boolean )
768 
769     /**
770      * Method parseContainerDescriptorHandlerConfig.
771      * 
772      * @param parser a parser object.
773      * @param strict a strict object.
774      * @throws IOException IOException if any.
775      * @throws XmlPullParserException XmlPullParserException if
776      * any.
777      * @return ContainerDescriptorHandlerConfig
778      */
779     private ContainerDescriptorHandlerConfig parseContainerDescriptorHandlerConfig( XmlPullParser parser, boolean strict )
780         throws IOException, XmlPullParserException
781     {
782         String tagName = parser.getName();
783         ContainerDescriptorHandlerConfig containerDescriptorHandlerConfig = new ContainerDescriptorHandlerConfig();
784         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
785         {
786             String name = parser.getAttributeName( i );
787             String value = parser.getAttributeValue( i );
788 
789             if ( name.indexOf( ':' ) >= 0 )
790             {
791                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
792             }
793             else
794             {
795                 checkUnknownAttribute( parser, name, tagName, strict );
796             }
797         }
798         java.util.Set parsed = new java.util.HashSet();
799         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
800         {
801             if ( checkFieldWithDuplicate( parser, "handlerName", null, parsed ) )
802             {
803                 containerDescriptorHandlerConfig.setHandlerName( interpolatedTrimmed( parser.nextText(), "handlerName" ) );
804             }
805             else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
806             {
807                 containerDescriptorHandlerConfig.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
808             }
809             else
810             {
811                 checkUnknownElement( parser, strict );
812             }
813         }
814         return containerDescriptorHandlerConfig;
815     } //-- ContainerDescriptorHandlerConfig parseContainerDescriptorHandlerConfig( XmlPullParser, boolean )
816 
817     /**
818      * Method parseDependencySet.
819      * 
820      * @param parser a parser object.
821      * @param strict a strict object.
822      * @throws IOException IOException if any.
823      * @throws XmlPullParserException XmlPullParserException if
824      * any.
825      * @return DependencySet
826      */
827     private DependencySet parseDependencySet( XmlPullParser parser, boolean strict )
828         throws IOException, XmlPullParserException
829     {
830         String tagName = parser.getName();
831         DependencySet dependencySet = new DependencySet();
832         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
833         {
834             String name = parser.getAttributeName( i );
835             String value = parser.getAttributeValue( i );
836 
837             if ( name.indexOf( ':' ) >= 0 )
838             {
839                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
840             }
841             else
842             {
843                 checkUnknownAttribute( parser, name, tagName, strict );
844             }
845         }
846         java.util.Set parsed = new java.util.HashSet();
847         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
848         {
849             if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
850             {
851                 dependencySet.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
852             }
853             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
854             {
855                 java.util.List<String> includes = new java.util.ArrayList<String>();
856                 dependencySet.setIncludes( includes );
857                 while ( parser.nextTag() == XmlPullParser.START_TAG )
858                 {
859                     if ( "include".equals( parser.getName() ) )
860                     {
861                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
862                     }
863                     else
864                     {
865                         checkUnknownElement( parser, strict );
866                     }
867                 }
868             }
869             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
870             {
871                 java.util.List<String> excludes = new java.util.ArrayList<String>();
872                 dependencySet.setExcludes( excludes );
873                 while ( parser.nextTag() == XmlPullParser.START_TAG )
874                 {
875                     if ( "exclude".equals( parser.getName() ) )
876                     {
877                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
878                     }
879                     else
880                     {
881                         checkUnknownElement( parser, strict );
882                     }
883                 }
884             }
885             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
886             {
887                 dependencySet.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
888             }
889             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
890             {
891                 dependencySet.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
892             }
893             else if ( checkFieldWithDuplicate( parser, "useStrictFiltering", null, parsed ) )
894             {
895                 dependencySet.setUseStrictFiltering( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useStrictFiltering" ), "useStrictFiltering", parser, "false" ) );
896             }
897             else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) )
898             {
899                 dependencySet.setOutputFileNameMapping( interpolatedTrimmed( parser.nextText(), "outputFileNameMapping" ) );
900             }
901             else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) )
902             {
903                 dependencySet.setUnpack( getBooleanValue( interpolatedTrimmed( parser.nextText(), "unpack" ), "unpack", parser, "false" ) );
904             }
905             else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) )
906             {
907                 dependencySet.setUnpackOptions( parseUnpackOptions( parser, strict ) );
908             }
909             else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) )
910             {
911                 dependencySet.setScope( interpolatedTrimmed( parser.nextText(), "scope" ) );
912             }
913             else if ( checkFieldWithDuplicate( parser, "useProjectArtifact", null, parsed ) )
914             {
915                 dependencySet.setUseProjectArtifact( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useProjectArtifact" ), "useProjectArtifact", parser, "true" ) );
916             }
917             else if ( checkFieldWithDuplicate( parser, "useProjectAttachments", null, parsed ) )
918             {
919                 dependencySet.setUseProjectAttachments( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useProjectAttachments" ), "useProjectAttachments", parser, "false" ) );
920             }
921             else if ( checkFieldWithDuplicate( parser, "useTransitiveDependencies", null, parsed ) )
922             {
923                 dependencySet.setUseTransitiveDependencies( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useTransitiveDependencies" ), "useTransitiveDependencies", parser, "true" ) );
924             }
925             else if ( checkFieldWithDuplicate( parser, "useTransitiveFiltering", null, parsed ) )
926             {
927                 dependencySet.setUseTransitiveFiltering( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useTransitiveFiltering" ), "useTransitiveFiltering", parser, "false" ) );
928             }
929             else
930             {
931                 checkUnknownElement( parser, strict );
932             }
933         }
934         return dependencySet;
935     } //-- DependencySet parseDependencySet( XmlPullParser, boolean )
936 
937     /**
938      * Method parseFileItem.
939      * 
940      * @param parser a parser object.
941      * @param strict a strict object.
942      * @throws IOException IOException if any.
943      * @throws XmlPullParserException XmlPullParserException if
944      * any.
945      * @return FileItem
946      */
947     private FileItem parseFileItem( XmlPullParser parser, boolean strict )
948         throws IOException, XmlPullParserException
949     {
950         String tagName = parser.getName();
951         FileItem fileItem = new FileItem();
952         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
953         {
954             String name = parser.getAttributeName( i );
955             String value = parser.getAttributeValue( i );
956 
957             if ( name.indexOf( ':' ) >= 0 )
958             {
959                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
960             }
961             else
962             {
963                 checkUnknownAttribute( parser, name, tagName, strict );
964             }
965         }
966         java.util.Set parsed = new java.util.HashSet();
967         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
968         {
969             if ( checkFieldWithDuplicate( parser, "source", null, parsed ) )
970             {
971                 fileItem.setSource( interpolatedTrimmed( parser.nextText(), "source" ) );
972             }
973             else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) )
974             {
975                 java.util.List<String> sources = new java.util.ArrayList<String>();
976                 fileItem.setSources( sources );
977                 while ( parser.nextTag() == XmlPullParser.START_TAG )
978                 {
979                     if ( "source".equals( parser.getName() ) )
980                     {
981                         sources.add( interpolatedTrimmed( parser.nextText(), "sources" ) );
982                     }
983                     else
984                     {
985                         checkUnknownElement( parser, strict );
986                     }
987                 }
988             }
989             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
990             {
991                 fileItem.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
992             }
993             else if ( checkFieldWithDuplicate( parser, "destName", null, parsed ) )
994             {
995                 fileItem.setDestName( interpolatedTrimmed( parser.nextText(), "destName" ) );
996             }
997             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
998             {
999                 fileItem.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1000             }
1001             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1002             {
1003                 fileItem.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1004             }
1005             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1006             {
1007                 fileItem.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1008             }
1009             else
1010             {
1011                 checkUnknownElement( parser, strict );
1012             }
1013         }
1014         return fileItem;
1015     } //-- FileItem parseFileItem( XmlPullParser, boolean )
1016 
1017     /**
1018      * Method parseFileSet.
1019      * 
1020      * @param parser a parser object.
1021      * @param strict a strict object.
1022      * @throws IOException IOException if any.
1023      * @throws XmlPullParserException XmlPullParserException if
1024      * any.
1025      * @return FileSet
1026      */
1027     private FileSet parseFileSet( XmlPullParser parser, boolean strict )
1028         throws IOException, XmlPullParserException
1029     {
1030         String tagName = parser.getName();
1031         FileSet fileSet = new FileSet();
1032         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1033         {
1034             String name = parser.getAttributeName( i );
1035             String value = parser.getAttributeValue( i );
1036 
1037             if ( name.indexOf( ':' ) >= 0 )
1038             {
1039                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1040             }
1041             else
1042             {
1043                 checkUnknownAttribute( parser, name, tagName, strict );
1044             }
1045         }
1046         java.util.Set parsed = new java.util.HashSet();
1047         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1048         {
1049             if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1050             {
1051                 fileSet.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1052             }
1053             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1054             {
1055                 fileSet.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1056             }
1057             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1058             {
1059                 java.util.List<String> includes = new java.util.ArrayList<String>();
1060                 fileSet.setIncludes( includes );
1061                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1062                 {
1063                     if ( "include".equals( parser.getName() ) )
1064                     {
1065                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1066                     }
1067                     else
1068                     {
1069                         checkUnknownElement( parser, strict );
1070                     }
1071                 }
1072             }
1073             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1074             {
1075                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1076                 fileSet.setExcludes( excludes );
1077                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1078                 {
1079                     if ( "exclude".equals( parser.getName() ) )
1080                     {
1081                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1082                     }
1083                     else
1084                     {
1085                         checkUnknownElement( parser, strict );
1086                     }
1087                 }
1088             }
1089             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1090             {
1091                 fileSet.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1092             }
1093             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1094             {
1095                 fileSet.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1096             }
1097             else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1098             {
1099                 fileSet.setDirectory( interpolatedTrimmed( parser.nextText(), "directory" ) );
1100             }
1101             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1102             {
1103                 fileSet.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1104             }
1105             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1106             {
1107                 fileSet.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1108             }
1109             else if ( checkFieldWithDuplicate( parser, "nonFilteredFileExtensions", null, parsed ) )
1110             {
1111                 java.util.List<String> nonFilteredFileExtensions = new java.util.ArrayList<String>();
1112                 fileSet.setNonFilteredFileExtensions( nonFilteredFileExtensions );
1113                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1114                 {
1115                     if ( "nonFilteredFileExtension".equals( parser.getName() ) )
1116                     {
1117                         nonFilteredFileExtensions.add( interpolatedTrimmed( parser.nextText(), "nonFilteredFileExtensions" ) );
1118                     }
1119                     else
1120                     {
1121                         checkUnknownElement( parser, strict );
1122                     }
1123                 }
1124             }
1125             else
1126             {
1127                 checkUnknownElement( parser, strict );
1128             }
1129         }
1130         return fileSet;
1131     } //-- FileSet parseFileSet( XmlPullParser, boolean )
1132 
1133     /**
1134      * Method parseGroupVersionAlignment.
1135      * 
1136      * @param parser a parser object.
1137      * @param strict a strict object.
1138      * @throws IOException IOException if any.
1139      * @throws XmlPullParserException XmlPullParserException if
1140      * any.
1141      * @return GroupVersionAlignment
1142      */
1143     private GroupVersionAlignment parseGroupVersionAlignment( XmlPullParser parser, boolean strict )
1144         throws IOException, XmlPullParserException
1145     {
1146         String tagName = parser.getName();
1147         GroupVersionAlignment groupVersionAlignment = new GroupVersionAlignment();
1148         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1149         {
1150             String name = parser.getAttributeName( i );
1151             String value = parser.getAttributeValue( i );
1152 
1153             if ( name.indexOf( ':' ) >= 0 )
1154             {
1155                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1156             }
1157             else
1158             {
1159                 checkUnknownAttribute( parser, name, tagName, strict );
1160             }
1161         }
1162         java.util.Set parsed = new java.util.HashSet();
1163         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1164         {
1165             if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1166             {
1167                 groupVersionAlignment.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
1168             }
1169             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
1170             {
1171                 groupVersionAlignment.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
1172             }
1173             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1174             {
1175                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1176                 groupVersionAlignment.setExcludes( excludes );
1177                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1178                 {
1179                     if ( "exclude".equals( parser.getName() ) )
1180                     {
1181                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1182                     }
1183                     else
1184                     {
1185                         checkUnknownElement( parser, strict );
1186                     }
1187                 }
1188             }
1189             else
1190             {
1191                 checkUnknownElement( parser, strict );
1192             }
1193         }
1194         return groupVersionAlignment;
1195     } //-- GroupVersionAlignment parseGroupVersionAlignment( XmlPullParser, boolean )
1196 
1197     /**
1198      * Method parseModuleBinaries.
1199      * 
1200      * @param parser a parser object.
1201      * @param strict a strict object.
1202      * @throws IOException IOException if any.
1203      * @throws XmlPullParserException XmlPullParserException if
1204      * any.
1205      * @return ModuleBinaries
1206      */
1207     private ModuleBinaries parseModuleBinaries( XmlPullParser parser, boolean strict )
1208         throws IOException, XmlPullParserException
1209     {
1210         String tagName = parser.getName();
1211         ModuleBinaries moduleBinaries = new ModuleBinaries();
1212         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1213         {
1214             String name = parser.getAttributeName( i );
1215             String value = parser.getAttributeValue( i );
1216 
1217             if ( name.indexOf( ':' ) >= 0 )
1218             {
1219                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1220             }
1221             else
1222             {
1223                 checkUnknownAttribute( parser, name, tagName, strict );
1224             }
1225         }
1226         java.util.Set parsed = new java.util.HashSet();
1227         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1228         {
1229             if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1230             {
1231                 moduleBinaries.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1232             }
1233             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1234             {
1235                 java.util.List<String> includes = new java.util.ArrayList<String>();
1236                 moduleBinaries.setIncludes( includes );
1237                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1238                 {
1239                     if ( "include".equals( parser.getName() ) )
1240                     {
1241                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1242                     }
1243                     else
1244                     {
1245                         checkUnknownElement( parser, strict );
1246                     }
1247                 }
1248             }
1249             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1250             {
1251                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1252                 moduleBinaries.setExcludes( excludes );
1253                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1254                 {
1255                     if ( "exclude".equals( parser.getName() ) )
1256                     {
1257                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1258                     }
1259                     else
1260                     {
1261                         checkUnknownElement( parser, strict );
1262                     }
1263                 }
1264             }
1265             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1266             {
1267                 moduleBinaries.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1268             }
1269             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1270             {
1271                 moduleBinaries.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1272             }
1273             else if ( checkFieldWithDuplicate( parser, "attachmentClassifier", null, parsed ) )
1274             {
1275                 moduleBinaries.setAttachmentClassifier( interpolatedTrimmed( parser.nextText(), "attachmentClassifier" ) );
1276             }
1277             else if ( checkFieldWithDuplicate( parser, "includeDependencies", null, parsed ) )
1278             {
1279                 moduleBinaries.setIncludeDependencies( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeDependencies" ), "includeDependencies", parser, "true" ) );
1280             }
1281             else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) )
1282             {
1283                 java.util.List<DependencySet> dependencySets = new java.util.ArrayList<DependencySet>();
1284                 moduleBinaries.setDependencySets( dependencySets );
1285                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1286                 {
1287                     if ( "dependencySet".equals( parser.getName() ) )
1288                     {
1289                         dependencySets.add( parseDependencySet( parser, strict ) );
1290                     }
1291                     else
1292                     {
1293                         checkUnknownElement( parser, strict );
1294                     }
1295                 }
1296             }
1297             else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) )
1298             {
1299                 moduleBinaries.setUnpack( getBooleanValue( interpolatedTrimmed( parser.nextText(), "unpack" ), "unpack", parser, "true" ) );
1300             }
1301             else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) )
1302             {
1303                 moduleBinaries.setUnpackOptions( parseUnpackOptions( parser, strict ) );
1304             }
1305             else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) )
1306             {
1307                 moduleBinaries.setOutputFileNameMapping( interpolatedTrimmed( parser.nextText(), "outputFileNameMapping" ) );
1308             }
1309             else
1310             {
1311                 checkUnknownElement( parser, strict );
1312             }
1313         }
1314         return moduleBinaries;
1315     } //-- ModuleBinaries parseModuleBinaries( XmlPullParser, boolean )
1316 
1317     /**
1318      * Method parseModuleSet.
1319      * 
1320      * @param parser a parser object.
1321      * @param strict a strict object.
1322      * @throws IOException IOException if any.
1323      * @throws XmlPullParserException XmlPullParserException if
1324      * any.
1325      * @return ModuleSet
1326      */
1327     private ModuleSet parseModuleSet( XmlPullParser parser, boolean strict )
1328         throws IOException, XmlPullParserException
1329     {
1330         String tagName = parser.getName();
1331         ModuleSet moduleSet = new ModuleSet();
1332         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1333         {
1334             String name = parser.getAttributeName( i );
1335             String value = parser.getAttributeValue( i );
1336 
1337             if ( name.indexOf( ':' ) >= 0 )
1338             {
1339                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1340             }
1341             else
1342             {
1343                 checkUnknownAttribute( parser, name, tagName, strict );
1344             }
1345         }
1346         java.util.Set parsed = new java.util.HashSet();
1347         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1348         {
1349             if ( checkFieldWithDuplicate( parser, "useAllReactorProjects", null, parsed ) )
1350             {
1351                 moduleSet.setUseAllReactorProjects( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useAllReactorProjects" ), "useAllReactorProjects", parser, "false" ) );
1352             }
1353             else if ( checkFieldWithDuplicate( parser, "includeSubModules", null, parsed ) )
1354             {
1355                 moduleSet.setIncludeSubModules( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeSubModules" ), "includeSubModules", parser, "true" ) );
1356             }
1357             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1358             {
1359                 java.util.List<String> includes = new java.util.ArrayList<String>();
1360                 moduleSet.setIncludes( includes );
1361                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1362                 {
1363                     if ( "include".equals( parser.getName() ) )
1364                     {
1365                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1366                     }
1367                     else
1368                     {
1369                         checkUnknownElement( parser, strict );
1370                     }
1371                 }
1372             }
1373             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1374             {
1375                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1376                 moduleSet.setExcludes( excludes );
1377                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1378                 {
1379                     if ( "exclude".equals( parser.getName() ) )
1380                     {
1381                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1382                     }
1383                     else
1384                     {
1385                         checkUnknownElement( parser, strict );
1386                     }
1387                 }
1388             }
1389             else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) )
1390             {
1391                 moduleSet.setSources( parseModuleSources( parser, strict ) );
1392             }
1393             else if ( checkFieldWithDuplicate( parser, "binaries", null, parsed ) )
1394             {
1395                 moduleSet.setBinaries( parseModuleBinaries( parser, strict ) );
1396             }
1397             else
1398             {
1399                 checkUnknownElement( parser, strict );
1400             }
1401         }
1402         return moduleSet;
1403     } //-- ModuleSet parseModuleSet( XmlPullParser, boolean )
1404 
1405     /**
1406      * Method parseModuleSources.
1407      * 
1408      * @param parser a parser object.
1409      * @param strict a strict object.
1410      * @throws IOException IOException if any.
1411      * @throws XmlPullParserException XmlPullParserException if
1412      * any.
1413      * @return ModuleSources
1414      */
1415     private ModuleSources parseModuleSources( XmlPullParser parser, boolean strict )
1416         throws IOException, XmlPullParserException
1417     {
1418         String tagName = parser.getName();
1419         ModuleSources moduleSources = new ModuleSources();
1420         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1421         {
1422             String name = parser.getAttributeName( i );
1423             String value = parser.getAttributeValue( i );
1424 
1425             if ( name.indexOf( ':' ) >= 0 )
1426             {
1427                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1428             }
1429             else
1430             {
1431                 checkUnknownAttribute( parser, name, tagName, strict );
1432             }
1433         }
1434         java.util.Set parsed = new java.util.HashSet();
1435         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1436         {
1437             if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1438             {
1439                 moduleSources.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1440             }
1441             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1442             {
1443                 moduleSources.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1444             }
1445             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1446             {
1447                 java.util.List<String> includes = new java.util.ArrayList<String>();
1448                 moduleSources.setIncludes( includes );
1449                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1450                 {
1451                     if ( "include".equals( parser.getName() ) )
1452                     {
1453                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1454                     }
1455                     else
1456                     {
1457                         checkUnknownElement( parser, strict );
1458                     }
1459                 }
1460             }
1461             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1462             {
1463                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1464                 moduleSources.setExcludes( excludes );
1465                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1466                 {
1467                     if ( "exclude".equals( parser.getName() ) )
1468                     {
1469                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1470                     }
1471                     else
1472                     {
1473                         checkUnknownElement( parser, strict );
1474                     }
1475                 }
1476             }
1477             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1478             {
1479                 moduleSources.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1480             }
1481             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1482             {
1483                 moduleSources.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1484             }
1485             else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) )
1486             {
1487                 java.util.List<FileSet> fileSets = new java.util.ArrayList<FileSet>();
1488                 moduleSources.setFileSets( fileSets );
1489                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1490                 {
1491                     if ( "fileSet".equals( parser.getName() ) )
1492                     {
1493                         fileSets.add( parseFileSet( parser, strict ) );
1494                     }
1495                     else
1496                     {
1497                         checkUnknownElement( parser, strict );
1498                     }
1499                 }
1500             }
1501             else if ( checkFieldWithDuplicate( parser, "includeModuleDirectory", null, parsed ) )
1502             {
1503                 moduleSources.setIncludeModuleDirectory( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeModuleDirectory" ), "includeModuleDirectory", parser, "true" ) );
1504             }
1505             else if ( checkFieldWithDuplicate( parser, "excludeSubModuleDirectories", null, parsed ) )
1506             {
1507                 moduleSources.setExcludeSubModuleDirectories( getBooleanValue( interpolatedTrimmed( parser.nextText(), "excludeSubModuleDirectories" ), "excludeSubModuleDirectories", parser, "true" ) );
1508             }
1509             else if ( checkFieldWithDuplicate( parser, "outputDirectoryMapping", null, parsed ) )
1510             {
1511                 moduleSources.setOutputDirectoryMapping( interpolatedTrimmed( parser.nextText(), "outputDirectoryMapping" ) );
1512             }
1513             else
1514             {
1515                 checkUnknownElement( parser, strict );
1516             }
1517         }
1518         return moduleSources;
1519     } //-- ModuleSources parseModuleSources( XmlPullParser, boolean )
1520 
1521     /**
1522      * Method parseRepository.
1523      * 
1524      * @param parser a parser object.
1525      * @param strict a strict object.
1526      * @throws IOException IOException if any.
1527      * @throws XmlPullParserException XmlPullParserException if
1528      * any.
1529      * @return Repository
1530      */
1531     private Repository parseRepository( XmlPullParser parser, boolean strict )
1532         throws IOException, XmlPullParserException
1533     {
1534         String tagName = parser.getName();
1535         Repository repository = new Repository();
1536         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1537         {
1538             String name = parser.getAttributeName( i );
1539             String value = parser.getAttributeValue( i );
1540 
1541             if ( name.indexOf( ':' ) >= 0 )
1542             {
1543                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1544             }
1545             else
1546             {
1547                 checkUnknownAttribute( parser, name, tagName, strict );
1548             }
1549         }
1550         java.util.Set parsed = new java.util.HashSet();
1551         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1552         {
1553             if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1554             {
1555                 repository.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1556             }
1557             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1558             {
1559                 java.util.List<String> includes = new java.util.ArrayList<String>();
1560                 repository.setIncludes( includes );
1561                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1562                 {
1563                     if ( "include".equals( parser.getName() ) )
1564                     {
1565                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1566                     }
1567                     else
1568                     {
1569                         checkUnknownElement( parser, strict );
1570                     }
1571                 }
1572             }
1573             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1574             {
1575                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1576                 repository.setExcludes( excludes );
1577                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1578                 {
1579                     if ( "exclude".equals( parser.getName() ) )
1580                     {
1581                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1582                     }
1583                     else
1584                     {
1585                         checkUnknownElement( parser, strict );
1586                     }
1587                 }
1588             }
1589             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1590             {
1591                 repository.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1592             }
1593             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1594             {
1595                 repository.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1596             }
1597             else if ( checkFieldWithDuplicate( parser, "includeMetadata", null, parsed ) )
1598             {
1599                 repository.setIncludeMetadata( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeMetadata" ), "includeMetadata", parser, "false" ) );
1600             }
1601             else if ( checkFieldWithDuplicate( parser, "groupVersionAlignments", null, parsed ) )
1602             {
1603                 java.util.List<GroupVersionAlignment> groupVersionAlignments = new java.util.ArrayList<GroupVersionAlignment>();
1604                 repository.setGroupVersionAlignments( groupVersionAlignments );
1605                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1606                 {
1607                     if ( "groupVersionAlignment".equals( parser.getName() ) )
1608                     {
1609                         groupVersionAlignments.add( parseGroupVersionAlignment( parser, strict ) );
1610                     }
1611                     else
1612                     {
1613                         checkUnknownElement( parser, strict );
1614                     }
1615                 }
1616             }
1617             else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) )
1618             {
1619                 repository.setScope( interpolatedTrimmed( parser.nextText(), "scope" ) );
1620             }
1621             else
1622             {
1623                 checkUnknownElement( parser, strict );
1624             }
1625         }
1626         return repository;
1627     } //-- Repository parseRepository( XmlPullParser, boolean )
1628 
1629     /**
1630      * Method parseUnpackOptions.
1631      * 
1632      * @param parser a parser object.
1633      * @param strict a strict object.
1634      * @throws IOException IOException if any.
1635      * @throws XmlPullParserException XmlPullParserException if
1636      * any.
1637      * @return UnpackOptions
1638      */
1639     private UnpackOptions parseUnpackOptions( XmlPullParser parser, boolean strict )
1640         throws IOException, XmlPullParserException
1641     {
1642         String tagName = parser.getName();
1643         UnpackOptions unpackOptions = new UnpackOptions();
1644         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1645         {
1646             String name = parser.getAttributeName( i );
1647             String value = parser.getAttributeValue( i );
1648 
1649             if ( name.indexOf( ':' ) >= 0 )
1650             {
1651                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1652             }
1653             else
1654             {
1655                 checkUnknownAttribute( parser, name, tagName, strict );
1656             }
1657         }
1658         java.util.Set parsed = new java.util.HashSet();
1659         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1660         {
1661             if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1662             {
1663                 java.util.List<String> includes = new java.util.ArrayList<String>();
1664                 unpackOptions.setIncludes( includes );
1665                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1666                 {
1667                     if ( "include".equals( parser.getName() ) )
1668                     {
1669                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1670                     }
1671                     else
1672                     {
1673                         checkUnknownElement( parser, strict );
1674                     }
1675                 }
1676             }
1677             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1678             {
1679                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1680                 unpackOptions.setExcludes( excludes );
1681                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1682                 {
1683                     if ( "exclude".equals( parser.getName() ) )
1684                     {
1685                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1686                     }
1687                     else
1688                     {
1689                         checkUnknownElement( parser, strict );
1690                     }
1691                 }
1692             }
1693             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1694             {
1695                 unpackOptions.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1696             }
1697             else if ( checkFieldWithDuplicate( parser, "nonFilteredFileExtensions", null, parsed ) )
1698             {
1699                 java.util.List<String> nonFilteredFileExtensions = new java.util.ArrayList<String>();
1700                 unpackOptions.setNonFilteredFileExtensions( nonFilteredFileExtensions );
1701                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1702                 {
1703                     if ( "nonFilteredFileExtension".equals( parser.getName() ) )
1704                     {
1705                         nonFilteredFileExtensions.add( interpolatedTrimmed( parser.nextText(), "nonFilteredFileExtensions" ) );
1706                     }
1707                     else
1708                     {
1709                         checkUnknownElement( parser, strict );
1710                     }
1711                 }
1712             }
1713             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1714             {
1715                 unpackOptions.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1716             }
1717             else if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1718             {
1719                 unpackOptions.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1720             }
1721             else if ( checkFieldWithDuplicate( parser, "encoding", null, parsed ) )
1722             {
1723                 unpackOptions.setEncoding( interpolatedTrimmed( parser.nextText(), "encoding" ) );
1724             }
1725             else
1726             {
1727                 checkUnknownElement( parser, strict );
1728             }
1729         }
1730         return unpackOptions;
1731     } //-- UnpackOptions parseUnpackOptions( XmlPullParser, boolean )
1732 
1733     /**
1734      * Method read.
1735      * 
1736      * @param parser a parser object.
1737      * @param strict a strict object.
1738      * @throws IOException IOException if any.
1739      * @throws XmlPullParserException XmlPullParserException if
1740      * any.
1741      * @return Component
1742      */
1743     private Component read( XmlPullParser parser, boolean strict )
1744         throws IOException, XmlPullParserException
1745     {
1746         Component component = null;
1747         int eventType = parser.getEventType();
1748         boolean parsed = false;
1749         while ( eventType != XmlPullParser.END_DOCUMENT )
1750         {
1751             if ( eventType == XmlPullParser.START_TAG )
1752             {
1753                 if ( strict && ! "component".equals( parser.getName() ) )
1754                 {
1755                     throw new XmlPullParserException( "Expected root element 'component' but found '" + parser.getName() + "'", parser, null );
1756                 }
1757                 else if ( parsed )
1758                 {
1759                     // fallback, already expected a XmlPullParserException due to invalid XML
1760                     throw new XmlPullParserException( "Duplicated tag: 'component'", parser, null );
1761                 }
1762                 component = parseComponent( parser, strict );
1763                 component.setModelEncoding( parser.getInputEncoding() );
1764                 parsed = true;
1765             }
1766             eventType = parser.next();
1767         }
1768         if ( parsed )
1769         {
1770             return component;
1771         }
1772         throw new XmlPullParserException( "Expected root element 'component' but found no element at all: invalid XML document", parser, null );
1773     } //-- Component read( XmlPullParser, boolean )
1774 
1775     /**
1776      * Sets the state of the "add default entities" flag.
1777      * 
1778      * @param addDefaultEntities a addDefaultEntities object.
1779      */
1780     public void setAddDefaultEntities( boolean addDefaultEntities )
1781     {
1782         this.addDefaultEntities = addDefaultEntities;
1783     } //-- void setAddDefaultEntities( boolean )
1784 
1785     public static interface ContentTransformer
1786 {
1787     /**
1788      * Interpolate the value read from the xpp3 document
1789      * @param source The source value
1790      * @param fieldName A description of the field being interpolated. The implementation may use this to
1791      *                           log stuff.
1792      * @return The interpolated value.
1793      */
1794     String transform( String source, String fieldName );
1795 }
1796 
1797 }