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