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