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.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.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 ComponentXpp3Reader.
33   * 
34   * @version $Revision$ $Date$
35   */
36  @SuppressWarnings( "all" )
37  public class ComponentXpp3Reader
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 ComponentXpp3Reader()
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.ComponentXpp3Reader()
76  
77      public ComponentXpp3Reader(ContentTransformer contentTransformer)
78      {
79          this.contentTransformer = contentTransformer;
80      } //-- org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Reader(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 Component
569      */
570     public Component read( XmlPullParser parser, boolean strict )
571         throws IOException, XmlPullParserException
572     {
573         Component component = 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 && ! "component".equals( parser.getName() ) )
581                 {
582                     throw new XmlPullParserException( "Expected root element 'component' 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: 'component'", parser, null );
588                 }
589                 component = parseComponent( parser, strict );
590                 component.setModelEncoding( parser.getInputEncoding() );
591                 parsed = true;
592             }
593             eventType = parser.next();
594         }
595         if ( parsed )
596         {
597             return component;
598         }
599         throw new XmlPullParserException( "Expected root element 'component' but found no element at all: invalid XML document", parser, null );
600     } //-- Component 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 Component
611      */
612     public Component 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     } //-- Component 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 Component
631      */
632     public Component read( Reader reader )
633         throws IOException, XmlPullParserException
634     {
635         return read( reader, true );
636     } //-- Component 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 Component
647      */
648     public Component read( InputStream in, boolean strict )
649         throws IOException, XmlPullParserException
650     {
651         return read( ReaderFactory.newXmlReader( in ), strict );
652     } //-- Component 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 Component
662      */
663     public Component read( InputStream in )
664         throws IOException, XmlPullParserException
665     {
666         return read( ReaderFactory.newXmlReader( in ) );
667     } //-- Component read( InputStream )
668 
669     /**
670      * Method parseComponent.
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 Component
678      */
679     private Component parseComponent( XmlPullParser parser, boolean strict )
680         throws IOException, XmlPullParserException
681     {
682         String tagName = parser.getName();
683         Component component = new Component();
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, "moduleSets", null, parsed ) )
706             {
707                 java.util.List<ModuleSet> moduleSets = new java.util.ArrayList<ModuleSet>();
708                 while ( parser.nextTag() == XmlPullParser.START_TAG )
709                 {
710                     if ( "moduleSet".equals( parser.getName() ) )
711                     {
712                         moduleSets.add( parseModuleSet( parser, strict ) );
713                     }
714                     else
715                     {
716                         checkUnknownElement( parser, strict );
717                     }
718                 }
719                 component.setModuleSets( moduleSets );
720             }
721             else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) )
722             {
723                 java.util.List<FileSet> fileSets = new java.util.ArrayList<FileSet>();
724                 while ( parser.nextTag() == XmlPullParser.START_TAG )
725                 {
726                     if ( "fileSet".equals( parser.getName() ) )
727                     {
728                         fileSets.add( parseFileSet( parser, strict ) );
729                     }
730                     else
731                     {
732                         checkUnknownElement( parser, strict );
733                     }
734                 }
735                 component.setFileSets( fileSets );
736             }
737             else if ( checkFieldWithDuplicate( parser, "files", null, parsed ) )
738             {
739                 java.util.List<FileItem> files = new java.util.ArrayList<FileItem>();
740                 while ( parser.nextTag() == XmlPullParser.START_TAG )
741                 {
742                     if ( "file".equals( parser.getName() ) )
743                     {
744                         files.add( parseFileItem( parser, strict ) );
745                     }
746                     else
747                     {
748                         checkUnknownElement( parser, strict );
749                     }
750                 }
751                 component.setFiles( files );
752             }
753             else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) )
754             {
755                 java.util.List<DependencySet> dependencySets = new java.util.ArrayList<DependencySet>();
756                 while ( parser.nextTag() == XmlPullParser.START_TAG )
757                 {
758                     if ( "dependencySet".equals( parser.getName() ) )
759                     {
760                         dependencySets.add( parseDependencySet( parser, strict ) );
761                     }
762                     else
763                     {
764                         checkUnknownElement( parser, strict );
765                     }
766                 }
767                 component.setDependencySets( dependencySets );
768             }
769             else if ( checkFieldWithDuplicate( parser, "containerDescriptorHandlers", null, parsed ) )
770             {
771                 java.util.List<ContainerDescriptorHandlerConfig> containerDescriptorHandlers = new java.util.ArrayList<ContainerDescriptorHandlerConfig>();
772                 while ( parser.nextTag() == XmlPullParser.START_TAG )
773                 {
774                     if ( "containerDescriptorHandler".equals( parser.getName() ) )
775                     {
776                         containerDescriptorHandlers.add( parseContainerDescriptorHandlerConfig( parser, strict ) );
777                     }
778                     else
779                     {
780                         checkUnknownElement( parser, strict );
781                     }
782                 }
783                 component.setContainerDescriptorHandlers( containerDescriptorHandlers );
784             }
785             else
786             {
787                 checkUnknownElement( parser, strict );
788             }
789         }
790         return component;
791     } //-- Component parseComponent( XmlPullParser, boolean )
792 
793     /**
794      * Method parseContainerDescriptorHandlerConfig.
795      * 
796      * @param parser a parser object.
797      * @param strict a strict object.
798      * @throws IOException IOException if any.
799      * @throws XmlPullParserException XmlPullParserException if
800      * any.
801      * @return ContainerDescriptorHandlerConfig
802      */
803     private ContainerDescriptorHandlerConfig parseContainerDescriptorHandlerConfig( XmlPullParser parser, boolean strict )
804         throws IOException, XmlPullParserException
805     {
806         String tagName = parser.getName();
807         ContainerDescriptorHandlerConfig containerDescriptorHandlerConfig = new ContainerDescriptorHandlerConfig();
808         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
809         {
810             String name = parser.getAttributeName( i );
811             String value = parser.getAttributeValue( i );
812 
813             if ( name.indexOf( ':' ) >= 0 )
814             {
815                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
816             }
817             else
818             {
819                 checkUnknownAttribute( parser, name, tagName, strict );
820             }
821         }
822         java.util.Set parsed = new java.util.HashSet();
823         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
824         {
825             if ( checkFieldWithDuplicate( parser, "handlerName", null, parsed ) )
826             {
827                 containerDescriptorHandlerConfig.setHandlerName( interpolatedTrimmed( parser.nextText(), "handlerName" ) );
828             }
829             else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
830             {
831                 containerDescriptorHandlerConfig.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
832             }
833             else
834             {
835                 checkUnknownElement( parser, strict );
836             }
837         }
838         return containerDescriptorHandlerConfig;
839     } //-- ContainerDescriptorHandlerConfig parseContainerDescriptorHandlerConfig( XmlPullParser, boolean )
840 
841     /**
842      * Method parseDependencySet.
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 DependencySet
850      */
851     private DependencySet parseDependencySet( XmlPullParser parser, boolean strict )
852         throws IOException, XmlPullParserException
853     {
854         String tagName = parser.getName();
855         DependencySet dependencySet = new DependencySet();
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, "outputDirectory", null, parsed ) )
874             {
875                 dependencySet.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
876             }
877             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
878             {
879                 java.util.List<String> includes = new java.util.ArrayList<String>();
880                 while ( parser.nextTag() == XmlPullParser.START_TAG )
881                 {
882                     if ( "include".equals( parser.getName() ) )
883                     {
884                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
885                     }
886                     else
887                     {
888                         checkUnknownElement( parser, strict );
889                     }
890                 }
891                 dependencySet.setIncludes( includes );
892             }
893             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
894             {
895                 java.util.List<String> excludes = new java.util.ArrayList<String>();
896                 while ( parser.nextTag() == XmlPullParser.START_TAG )
897                 {
898                     if ( "exclude".equals( parser.getName() ) )
899                     {
900                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
901                     }
902                     else
903                     {
904                         checkUnknownElement( parser, strict );
905                     }
906                 }
907                 dependencySet.setExcludes( excludes );
908             }
909             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
910             {
911                 dependencySet.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
912             }
913             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
914             {
915                 dependencySet.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
916             }
917             else if ( checkFieldWithDuplicate( parser, "useStrictFiltering", null, parsed ) )
918             {
919                 dependencySet.setUseStrictFiltering( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useStrictFiltering" ), "useStrictFiltering", parser, "false" ) );
920             }
921             else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) )
922             {
923                 dependencySet.setOutputFileNameMapping( interpolatedTrimmed( parser.nextText(), "outputFileNameMapping" ) );
924             }
925             else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) )
926             {
927                 dependencySet.setUnpack( getBooleanValue( interpolatedTrimmed( parser.nextText(), "unpack" ), "unpack", parser, "false" ) );
928             }
929             else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) )
930             {
931                 dependencySet.setUnpackOptions( parseUnpackOptions( parser, strict ) );
932             }
933             else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) )
934             {
935                 dependencySet.setScope( interpolatedTrimmed( parser.nextText(), "scope" ) );
936             }
937             else if ( checkFieldWithDuplicate( parser, "useProjectArtifact", null, parsed ) )
938             {
939                 dependencySet.setUseProjectArtifact( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useProjectArtifact" ), "useProjectArtifact", parser, "true" ) );
940             }
941             else if ( checkFieldWithDuplicate( parser, "useProjectAttachments", null, parsed ) )
942             {
943                 dependencySet.setUseProjectAttachments( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useProjectAttachments" ), "useProjectAttachments", parser, "false" ) );
944             }
945             else if ( checkFieldWithDuplicate( parser, "useTransitiveDependencies", null, parsed ) )
946             {
947                 dependencySet.setUseTransitiveDependencies( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useTransitiveDependencies" ), "useTransitiveDependencies", parser, "true" ) );
948             }
949             else if ( checkFieldWithDuplicate( parser, "useTransitiveFiltering", null, parsed ) )
950             {
951                 dependencySet.setUseTransitiveFiltering( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useTransitiveFiltering" ), "useTransitiveFiltering", parser, "false" ) );
952             }
953             else
954             {
955                 checkUnknownElement( parser, strict );
956             }
957         }
958         return dependencySet;
959     } //-- DependencySet parseDependencySet( XmlPullParser, boolean )
960 
961     /**
962      * Method parseFileItem.
963      * 
964      * @param parser a parser object.
965      * @param strict a strict object.
966      * @throws IOException IOException if any.
967      * @throws XmlPullParserException XmlPullParserException if
968      * any.
969      * @return FileItem
970      */
971     private FileItem parseFileItem( XmlPullParser parser, boolean strict )
972         throws IOException, XmlPullParserException
973     {
974         String tagName = parser.getName();
975         FileItem fileItem = new FileItem();
976         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
977         {
978             String name = parser.getAttributeName( i );
979             String value = parser.getAttributeValue( i );
980 
981             if ( name.indexOf( ':' ) >= 0 )
982             {
983                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
984             }
985             else
986             {
987                 checkUnknownAttribute( parser, name, tagName, strict );
988             }
989         }
990         java.util.Set parsed = new java.util.HashSet();
991         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
992         {
993             if ( checkFieldWithDuplicate( parser, "source", null, parsed ) )
994             {
995                 fileItem.setSource( interpolatedTrimmed( parser.nextText(), "source" ) );
996             }
997             else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) )
998             {
999                 java.util.List<String> sources = new java.util.ArrayList<String>();
1000                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1001                 {
1002                     if ( "source".equals( parser.getName() ) )
1003                     {
1004                         sources.add( interpolatedTrimmed( parser.nextText(), "sources" ) );
1005                     }
1006                     else
1007                     {
1008                         checkUnknownElement( parser, strict );
1009                     }
1010                 }
1011                 fileItem.setSources( sources );
1012             }
1013             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1014             {
1015                 fileItem.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1016             }
1017             else if ( checkFieldWithDuplicate( parser, "destName", null, parsed ) )
1018             {
1019                 fileItem.setDestName( interpolatedTrimmed( parser.nextText(), "destName" ) );
1020             }
1021             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1022             {
1023                 fileItem.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1024             }
1025             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1026             {
1027                 fileItem.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1028             }
1029             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1030             {
1031                 fileItem.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1032             }
1033             else
1034             {
1035                 checkUnknownElement( parser, strict );
1036             }
1037         }
1038         return fileItem;
1039     } //-- FileItem parseFileItem( XmlPullParser, boolean )
1040 
1041     /**
1042      * Method parseFileSet.
1043      * 
1044      * @param parser a parser object.
1045      * @param strict a strict object.
1046      * @throws IOException IOException if any.
1047      * @throws XmlPullParserException XmlPullParserException if
1048      * any.
1049      * @return FileSet
1050      */
1051     private FileSet parseFileSet( XmlPullParser parser, boolean strict )
1052         throws IOException, XmlPullParserException
1053     {
1054         String tagName = parser.getName();
1055         FileSet fileSet = new FileSet();
1056         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1057         {
1058             String name = parser.getAttributeName( i );
1059             String value = parser.getAttributeValue( i );
1060 
1061             if ( name.indexOf( ':' ) >= 0 )
1062             {
1063                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1064             }
1065             else
1066             {
1067                 checkUnknownAttribute( parser, name, tagName, strict );
1068             }
1069         }
1070         java.util.Set parsed = new java.util.HashSet();
1071         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1072         {
1073             if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1074             {
1075                 fileSet.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1076             }
1077             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1078             {
1079                 fileSet.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1080             }
1081             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1082             {
1083                 java.util.List<String> includes = new java.util.ArrayList<String>();
1084                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1085                 {
1086                     if ( "include".equals( parser.getName() ) )
1087                     {
1088                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1089                     }
1090                     else
1091                     {
1092                         checkUnknownElement( parser, strict );
1093                     }
1094                 }
1095                 fileSet.setIncludes( includes );
1096             }
1097             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1098             {
1099                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1100                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1101                 {
1102                     if ( "exclude".equals( parser.getName() ) )
1103                     {
1104                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1105                     }
1106                     else
1107                     {
1108                         checkUnknownElement( parser, strict );
1109                     }
1110                 }
1111                 fileSet.setExcludes( excludes );
1112             }
1113             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1114             {
1115                 fileSet.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1116             }
1117             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1118             {
1119                 fileSet.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1120             }
1121             else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1122             {
1123                 fileSet.setDirectory( interpolatedTrimmed( parser.nextText(), "directory" ) );
1124             }
1125             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1126             {
1127                 fileSet.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1128             }
1129             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1130             {
1131                 fileSet.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1132             }
1133             else if ( checkFieldWithDuplicate( parser, "nonFilteredFileExtensions", null, parsed ) )
1134             {
1135                 java.util.List<String> nonFilteredFileExtensions = new java.util.ArrayList<String>();
1136                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1137                 {
1138                     if ( "nonFilteredFileExtension".equals( parser.getName() ) )
1139                     {
1140                         nonFilteredFileExtensions.add( interpolatedTrimmed( parser.nextText(), "nonFilteredFileExtensions" ) );
1141                     }
1142                     else
1143                     {
1144                         checkUnknownElement( parser, strict );
1145                     }
1146                 }
1147                 fileSet.setNonFilteredFileExtensions( nonFilteredFileExtensions );
1148             }
1149             else
1150             {
1151                 checkUnknownElement( parser, strict );
1152             }
1153         }
1154         return fileSet;
1155     } //-- FileSet parseFileSet( XmlPullParser, boolean )
1156 
1157     /**
1158      * Method parseModuleBinaries.
1159      * 
1160      * @param parser a parser object.
1161      * @param strict a strict object.
1162      * @throws IOException IOException if any.
1163      * @throws XmlPullParserException XmlPullParserException if
1164      * any.
1165      * @return ModuleBinaries
1166      */
1167     private ModuleBinaries parseModuleBinaries( XmlPullParser parser, boolean strict )
1168         throws IOException, XmlPullParserException
1169     {
1170         String tagName = parser.getName();
1171         ModuleBinaries moduleBinaries = new ModuleBinaries();
1172         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1173         {
1174             String name = parser.getAttributeName( i );
1175             String value = parser.getAttributeValue( i );
1176 
1177             if ( name.indexOf( ':' ) >= 0 )
1178             {
1179                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1180             }
1181             else
1182             {
1183                 checkUnknownAttribute( parser, name, tagName, strict );
1184             }
1185         }
1186         java.util.Set parsed = new java.util.HashSet();
1187         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1188         {
1189             if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1190             {
1191                 moduleBinaries.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1192             }
1193             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1194             {
1195                 java.util.List<String> includes = new java.util.ArrayList<String>();
1196                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1197                 {
1198                     if ( "include".equals( parser.getName() ) )
1199                     {
1200                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1201                     }
1202                     else
1203                     {
1204                         checkUnknownElement( parser, strict );
1205                     }
1206                 }
1207                 moduleBinaries.setIncludes( includes );
1208             }
1209             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1210             {
1211                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1212                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1213                 {
1214                     if ( "exclude".equals( parser.getName() ) )
1215                     {
1216                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1217                     }
1218                     else
1219                     {
1220                         checkUnknownElement( parser, strict );
1221                     }
1222                 }
1223                 moduleBinaries.setExcludes( excludes );
1224             }
1225             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1226             {
1227                 moduleBinaries.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1228             }
1229             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1230             {
1231                 moduleBinaries.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1232             }
1233             else if ( checkFieldWithDuplicate( parser, "attachmentClassifier", null, parsed ) )
1234             {
1235                 moduleBinaries.setAttachmentClassifier( interpolatedTrimmed( parser.nextText(), "attachmentClassifier" ) );
1236             }
1237             else if ( checkFieldWithDuplicate( parser, "includeDependencies", null, parsed ) )
1238             {
1239                 moduleBinaries.setIncludeDependencies( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeDependencies" ), "includeDependencies", parser, "true" ) );
1240             }
1241             else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) )
1242             {
1243                 java.util.List<DependencySet> dependencySets = new java.util.ArrayList<DependencySet>();
1244                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1245                 {
1246                     if ( "dependencySet".equals( parser.getName() ) )
1247                     {
1248                         dependencySets.add( parseDependencySet( parser, strict ) );
1249                     }
1250                     else
1251                     {
1252                         checkUnknownElement( parser, strict );
1253                     }
1254                 }
1255                 moduleBinaries.setDependencySets( dependencySets );
1256             }
1257             else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) )
1258             {
1259                 moduleBinaries.setUnpack( getBooleanValue( interpolatedTrimmed( parser.nextText(), "unpack" ), "unpack", parser, "true" ) );
1260             }
1261             else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) )
1262             {
1263                 moduleBinaries.setUnpackOptions( parseUnpackOptions( parser, strict ) );
1264             }
1265             else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) )
1266             {
1267                 moduleBinaries.setOutputFileNameMapping( interpolatedTrimmed( parser.nextText(), "outputFileNameMapping" ) );
1268             }
1269             else
1270             {
1271                 checkUnknownElement( parser, strict );
1272             }
1273         }
1274         return moduleBinaries;
1275     } //-- ModuleBinaries parseModuleBinaries( XmlPullParser, boolean )
1276 
1277     /**
1278      * Method parseModuleSet.
1279      * 
1280      * @param parser a parser object.
1281      * @param strict a strict object.
1282      * @throws IOException IOException if any.
1283      * @throws XmlPullParserException XmlPullParserException if
1284      * any.
1285      * @return ModuleSet
1286      */
1287     private ModuleSet parseModuleSet( XmlPullParser parser, boolean strict )
1288         throws IOException, XmlPullParserException
1289     {
1290         String tagName = parser.getName();
1291         ModuleSet moduleSet = new ModuleSet();
1292         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1293         {
1294             String name = parser.getAttributeName( i );
1295             String value = parser.getAttributeValue( i );
1296 
1297             if ( name.indexOf( ':' ) >= 0 )
1298             {
1299                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1300             }
1301             else
1302             {
1303                 checkUnknownAttribute( parser, name, tagName, strict );
1304             }
1305         }
1306         java.util.Set parsed = new java.util.HashSet();
1307         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1308         {
1309             if ( checkFieldWithDuplicate( parser, "useAllReactorProjects", null, parsed ) )
1310             {
1311                 moduleSet.setUseAllReactorProjects( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useAllReactorProjects" ), "useAllReactorProjects", parser, "false" ) );
1312             }
1313             else if ( checkFieldWithDuplicate( parser, "includeSubModules", null, parsed ) )
1314             {
1315                 moduleSet.setIncludeSubModules( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeSubModules" ), "includeSubModules", parser, "true" ) );
1316             }
1317             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1318             {
1319                 java.util.List<String> includes = new java.util.ArrayList<String>();
1320                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1321                 {
1322                     if ( "include".equals( parser.getName() ) )
1323                     {
1324                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1325                     }
1326                     else
1327                     {
1328                         checkUnknownElement( parser, strict );
1329                     }
1330                 }
1331                 moduleSet.setIncludes( includes );
1332             }
1333             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1334             {
1335                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1336                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1337                 {
1338                     if ( "exclude".equals( parser.getName() ) )
1339                     {
1340                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1341                     }
1342                     else
1343                     {
1344                         checkUnknownElement( parser, strict );
1345                     }
1346                 }
1347                 moduleSet.setExcludes( excludes );
1348             }
1349             else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) )
1350             {
1351                 moduleSet.setSources( parseModuleSources( parser, strict ) );
1352             }
1353             else if ( checkFieldWithDuplicate( parser, "binaries", null, parsed ) )
1354             {
1355                 moduleSet.setBinaries( parseModuleBinaries( parser, strict ) );
1356             }
1357             else
1358             {
1359                 checkUnknownElement( parser, strict );
1360             }
1361         }
1362         return moduleSet;
1363     } //-- ModuleSet parseModuleSet( XmlPullParser, boolean )
1364 
1365     /**
1366      * Method parseModuleSources.
1367      * 
1368      * @param parser a parser object.
1369      * @param strict a strict object.
1370      * @throws IOException IOException if any.
1371      * @throws XmlPullParserException XmlPullParserException if
1372      * any.
1373      * @return ModuleSources
1374      */
1375     private ModuleSources parseModuleSources( XmlPullParser parser, boolean strict )
1376         throws IOException, XmlPullParserException
1377     {
1378         String tagName = parser.getName();
1379         ModuleSources moduleSources = new ModuleSources();
1380         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1381         {
1382             String name = parser.getAttributeName( i );
1383             String value = parser.getAttributeValue( i );
1384 
1385             if ( name.indexOf( ':' ) >= 0 )
1386             {
1387                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1388             }
1389             else
1390             {
1391                 checkUnknownAttribute( parser, name, tagName, strict );
1392             }
1393         }
1394         java.util.Set parsed = new java.util.HashSet();
1395         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1396         {
1397             if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1398             {
1399                 moduleSources.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1400             }
1401             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1402             {
1403                 moduleSources.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1404             }
1405             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1406             {
1407                 java.util.List<String> includes = new java.util.ArrayList<String>();
1408                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1409                 {
1410                     if ( "include".equals( parser.getName() ) )
1411                     {
1412                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1413                     }
1414                     else
1415                     {
1416                         checkUnknownElement( parser, strict );
1417                     }
1418                 }
1419                 moduleSources.setIncludes( includes );
1420             }
1421             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1422             {
1423                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1424                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1425                 {
1426                     if ( "exclude".equals( parser.getName() ) )
1427                     {
1428                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1429                     }
1430                     else
1431                     {
1432                         checkUnknownElement( parser, strict );
1433                     }
1434                 }
1435                 moduleSources.setExcludes( excludes );
1436             }
1437             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1438             {
1439                 moduleSources.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1440             }
1441             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1442             {
1443                 moduleSources.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1444             }
1445             else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) )
1446             {
1447                 java.util.List<FileSet> fileSets = new java.util.ArrayList<FileSet>();
1448                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1449                 {
1450                     if ( "fileSet".equals( parser.getName() ) )
1451                     {
1452                         fileSets.add( parseFileSet( parser, strict ) );
1453                     }
1454                     else
1455                     {
1456                         checkUnknownElement( parser, strict );
1457                     }
1458                 }
1459                 moduleSources.setFileSets( fileSets );
1460             }
1461             else if ( checkFieldWithDuplicate( parser, "includeModuleDirectory", null, parsed ) )
1462             {
1463                 moduleSources.setIncludeModuleDirectory( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeModuleDirectory" ), "includeModuleDirectory", parser, "true" ) );
1464             }
1465             else if ( checkFieldWithDuplicate( parser, "excludeSubModuleDirectories", null, parsed ) )
1466             {
1467                 moduleSources.setExcludeSubModuleDirectories( getBooleanValue( interpolatedTrimmed( parser.nextText(), "excludeSubModuleDirectories" ), "excludeSubModuleDirectories", parser, "true" ) );
1468             }
1469             else if ( checkFieldWithDuplicate( parser, "outputDirectoryMapping", null, parsed ) )
1470             {
1471                 moduleSources.setOutputDirectoryMapping( interpolatedTrimmed( parser.nextText(), "outputDirectoryMapping" ) );
1472             }
1473             else
1474             {
1475                 checkUnknownElement( parser, strict );
1476             }
1477         }
1478         return moduleSources;
1479     } //-- ModuleSources parseModuleSources( XmlPullParser, boolean )
1480 
1481     /**
1482      * Method parseUnpackOptions.
1483      * 
1484      * @param parser a parser object.
1485      * @param strict a strict object.
1486      * @throws IOException IOException if any.
1487      * @throws XmlPullParserException XmlPullParserException if
1488      * any.
1489      * @return UnpackOptions
1490      */
1491     private UnpackOptions parseUnpackOptions( XmlPullParser parser, boolean strict )
1492         throws IOException, XmlPullParserException
1493     {
1494         String tagName = parser.getName();
1495         UnpackOptions unpackOptions = new UnpackOptions();
1496         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1497         {
1498             String name = parser.getAttributeName( i );
1499             String value = parser.getAttributeValue( i );
1500 
1501             if ( name.indexOf( ':' ) >= 0 )
1502             {
1503                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1504             }
1505             else
1506             {
1507                 checkUnknownAttribute( parser, name, tagName, strict );
1508             }
1509         }
1510         java.util.Set parsed = new java.util.HashSet();
1511         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1512         {
1513             if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1514             {
1515                 java.util.List<String> includes = new java.util.ArrayList<String>();
1516                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1517                 {
1518                     if ( "include".equals( parser.getName() ) )
1519                     {
1520                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1521                     }
1522                     else
1523                     {
1524                         checkUnknownElement( parser, strict );
1525                     }
1526                 }
1527                 unpackOptions.setIncludes( includes );
1528             }
1529             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1530             {
1531                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1532                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1533                 {
1534                     if ( "exclude".equals( parser.getName() ) )
1535                     {
1536                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1537                     }
1538                     else
1539                     {
1540                         checkUnknownElement( parser, strict );
1541                     }
1542                 }
1543                 unpackOptions.setExcludes( excludes );
1544             }
1545             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1546             {
1547                 unpackOptions.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1548             }
1549             else if ( checkFieldWithDuplicate( parser, "nonFilteredFileExtensions", null, parsed ) )
1550             {
1551                 java.util.List<String> nonFilteredFileExtensions = new java.util.ArrayList<String>();
1552                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1553                 {
1554                     if ( "nonFilteredFileExtension".equals( parser.getName() ) )
1555                     {
1556                         nonFilteredFileExtensions.add( interpolatedTrimmed( parser.nextText(), "nonFilteredFileExtensions" ) );
1557                     }
1558                     else
1559                     {
1560                         checkUnknownElement( parser, strict );
1561                     }
1562                 }
1563                 unpackOptions.setNonFilteredFileExtensions( nonFilteredFileExtensions );
1564             }
1565             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1566             {
1567                 unpackOptions.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1568             }
1569             else if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1570             {
1571                 unpackOptions.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1572             }
1573             else if ( checkFieldWithDuplicate( parser, "encoding", null, parsed ) )
1574             {
1575                 unpackOptions.setEncoding( interpolatedTrimmed( parser.nextText(), "encoding" ) );
1576             }
1577             else
1578             {
1579                 checkUnknownElement( parser, strict );
1580             }
1581         }
1582         return unpackOptions;
1583     } //-- UnpackOptions parseUnpackOptions( XmlPullParser, boolean )
1584 
1585     /**
1586      * Sets the state of the "add default entities" flag.
1587      * 
1588      * @param addDefaultEntities a addDefaultEntities object.
1589      */
1590     public void setAddDefaultEntities( boolean addDefaultEntities )
1591     {
1592         this.addDefaultEntities = addDefaultEntities;
1593     } //-- void setAddDefaultEntities( boolean )
1594 
1595     public static interface ContentTransformer
1596 {
1597     /**
1598      * Interpolate the value read from the xpp3 document
1599      * @param source The source value
1600      * @param fieldName A description of the field being interpolated. The implementation may use this to
1601      *                           log stuff.
1602      * @return The interpolated value.
1603      */
1604     String transform( String source, String fieldName );
1605 }
1606 
1607 }