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