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.Component;
17  import org.apache.maven.plugins.assembly.model.ContainerDescriptorHandlerConfig;
18  import org.apache.maven.plugins.assembly.model.DependencySet;
19  import org.apache.maven.plugins.assembly.model.FileItem;
20  import org.apache.maven.plugins.assembly.model.FileSet;
21  import org.apache.maven.plugins.assembly.model.GroupVersionAlignment;
22  import org.apache.maven.plugins.assembly.model.ModuleBinaries;
23  import org.apache.maven.plugins.assembly.model.ModuleSet;
24  import org.apache.maven.plugins.assembly.model.ModuleSources;
25  import org.apache.maven.plugins.assembly.model.Repository;
26  import org.apache.maven.plugins.assembly.model.UnpackOptions;
27  import org.codehaus.plexus.util.ReaderFactory;
28  import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
29  import org.codehaus.plexus.util.xml.pull.MXParser;
30  import org.codehaus.plexus.util.xml.pull.XmlPullParser;
31  import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
32  
33  /**
34   * Class ComponentXpp3Reader.
35   * 
36   * @version $Revision$ $Date$
37   */
38  @SuppressWarnings( "all" )
39  public class ComponentXpp3Reader
40  {
41  
42        //--------------------------/
43       //- Class/Member Variables -/
44      //--------------------------/
45  
46      /**
47       * If set the parser will be loaded with all single characters
48       * from the XHTML specification.
49       * The entities used:
50       * <ul>
51       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li>
52       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li>
53       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li>
54       * </ul>
55       */
56      private boolean addDefaultEntities = true;
57  
58      /**
59       * Field contentTransformer.
60       */
61      public final ContentTransformer contentTransformer;
62  
63  
64        //----------------/
65       //- Constructors -/
66      //----------------/
67  
68      public ComponentXpp3Reader()
69      {
70          this( new ContentTransformer()
71          {
72              public String transform( String source, String fieldName )
73              {
74                  return source;
75              }
76          } );
77      } //-- org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Reader()
78  
79      public ComponentXpp3Reader(ContentTransformer contentTransformer)
80      {
81          this.contentTransformer = contentTransformer;
82      } //-- org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Reader(ContentTransformer)
83  
84  
85        //-----------/
86       //- Methods -/
87      //-----------/
88  
89      /**
90       * Method checkFieldWithDuplicate.
91       * 
92       * @param parser
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 Component
554      */
555     public Component 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     } //-- Component read( Reader, boolean )
565 
566     /**
567      * @see ReaderFactory#newXmlReader
568      * 
569      * @param reader
570      * @throws IOException
571      * @throws XmlPullParserException
572      * @return Component
573      */
574     public Component read( Reader reader )
575         throws IOException, XmlPullParserException
576     {
577         return read( reader, true );
578     } //-- Component read( Reader )
579 
580     /**
581      * Method read.
582      * 
583      * @param in
584      * @param strict
585      * @throws IOException
586      * @throws XmlPullParserException
587      * @return Component
588      */
589     public Component read( InputStream in, boolean strict )
590         throws IOException, XmlPullParserException
591     {
592         return read( ReaderFactory.newXmlReader( in ), strict );
593     } //-- Component read( InputStream, boolean )
594 
595     /**
596      * Method read.
597      * 
598      * @param in
599      * @throws IOException
600      * @throws XmlPullParserException
601      * @return Component
602      */
603     public Component read( InputStream in )
604         throws IOException, XmlPullParserException
605     {
606         return read( ReaderFactory.newXmlReader( in ) );
607     } //-- Component read( InputStream )
608 
609     /**
610      * Method parseComponent.
611      * 
612      * @param parser
613      * @param strict
614      * @throws IOException
615      * @throws XmlPullParserException
616      * @return Component
617      */
618     private Component parseComponent( XmlPullParser parser, boolean strict )
619         throws IOException, XmlPullParserException
620     {
621         String tagName = parser.getName();
622         Componentns/assembly/model/Component.html#Component">Component component = new Component();
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, "moduleSets", null, parsed ) )
645             {
646                 java.util.List<ModuleSet> moduleSets = new java.util.ArrayList<ModuleSet>();
647                 component.setModuleSets( moduleSets );
648                 while ( parser.nextTag() == XmlPullParser.START_TAG )
649                 {
650                     if ( "moduleSet".equals( parser.getName() ) )
651                     {
652                         moduleSets.add( parseModuleSet( parser, strict ) );
653                     }
654                     else
655                     {
656                         checkUnknownElement( parser, strict );
657                     }
658                 }
659             }
660             else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) )
661             {
662                 java.util.List<FileSet> fileSets = new java.util.ArrayList<FileSet>();
663                 component.setFileSets( fileSets );
664                 while ( parser.nextTag() == XmlPullParser.START_TAG )
665                 {
666                     if ( "fileSet".equals( parser.getName() ) )
667                     {
668                         fileSets.add( parseFileSet( parser, strict ) );
669                     }
670                     else
671                     {
672                         checkUnknownElement( parser, strict );
673                     }
674                 }
675             }
676             else if ( checkFieldWithDuplicate( parser, "files", null, parsed ) )
677             {
678                 java.util.List<FileItem> files = new java.util.ArrayList<FileItem>();
679                 component.setFiles( files );
680                 while ( parser.nextTag() == XmlPullParser.START_TAG )
681                 {
682                     if ( "file".equals( parser.getName() ) )
683                     {
684                         files.add( parseFileItem( parser, strict ) );
685                     }
686                     else
687                     {
688                         checkUnknownElement( parser, strict );
689                     }
690                 }
691             }
692             else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) )
693             {
694                 java.util.List<DependencySet> dependencySets = new java.util.ArrayList<DependencySet>();
695                 component.setDependencySets( dependencySets );
696                 while ( parser.nextTag() == XmlPullParser.START_TAG )
697                 {
698                     if ( "dependencySet".equals( parser.getName() ) )
699                     {
700                         dependencySets.add( parseDependencySet( parser, strict ) );
701                     }
702                     else
703                     {
704                         checkUnknownElement( parser, strict );
705                     }
706                 }
707             }
708             else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
709             {
710                 java.util.List<Repository> repositories = new java.util.ArrayList<Repository>();
711                 component.setRepositories( repositories );
712                 while ( parser.nextTag() == XmlPullParser.START_TAG )
713                 {
714                     if ( "repository".equals( parser.getName() ) )
715                     {
716                         repositories.add( parseRepository( parser, strict ) );
717                     }
718                     else
719                     {
720                         checkUnknownElement( parser, strict );
721                     }
722                 }
723             }
724             else if ( checkFieldWithDuplicate( parser, "containerDescriptorHandlers", null, parsed ) )
725             {
726                 java.util.List<ContainerDescriptorHandlerConfig> containerDescriptorHandlers = new java.util.ArrayList<ContainerDescriptorHandlerConfig>();
727                 component.setContainerDescriptorHandlers( containerDescriptorHandlers );
728                 while ( parser.nextTag() == XmlPullParser.START_TAG )
729                 {
730                     if ( "containerDescriptorHandler".equals( parser.getName() ) )
731                     {
732                         containerDescriptorHandlers.add( parseContainerDescriptorHandlerConfig( parser, strict ) );
733                     }
734                     else
735                     {
736                         checkUnknownElement( parser, strict );
737                     }
738                 }
739             }
740             else
741             {
742                 checkUnknownElement( parser, strict );
743             }
744         }
745         return component;
746     } //-- Component parseComponent( XmlPullParser, boolean )
747 
748     /**
749      * Method parseContainerDescriptorHandlerConfig.
750      * 
751      * @param parser
752      * @param strict
753      * @throws IOException
754      * @throws XmlPullParserException
755      * @return ContainerDescriptorHandlerConfig
756      */
757     private ContainerDescriptorHandlerConfig parseContainerDescriptorHandlerConfig( XmlPullParser parser, boolean strict )
758         throws IOException, XmlPullParserException
759     {
760         String tagName = parser.getName();
761         ContainerDescriptorHandlerConfignfig.html#ContainerDescriptorHandlerConfig">ContainerDescriptorHandlerConfig containerDescriptorHandlerConfig = new ContainerDescriptorHandlerConfig();
762         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
763         {
764             String name = parser.getAttributeName( i );
765             String value = parser.getAttributeValue( i );
766 
767             if ( name.indexOf( ':' ) >= 0 )
768             {
769                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
770             }
771             else
772             {
773                 checkUnknownAttribute( parser, name, tagName, strict );
774             }
775         }
776         java.util.Set parsed = new java.util.HashSet();
777         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
778         {
779             if ( checkFieldWithDuplicate( parser, "handlerName", null, parsed ) )
780             {
781                 containerDescriptorHandlerConfig.setHandlerName( interpolatedTrimmed( parser.nextText(), "handlerName" ) );
782             }
783             else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
784             {
785                 containerDescriptorHandlerConfig.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
786             }
787             else
788             {
789                 checkUnknownElement( parser, strict );
790             }
791         }
792         return containerDescriptorHandlerConfig;
793     } //-- ContainerDescriptorHandlerConfig parseContainerDescriptorHandlerConfig( XmlPullParser, boolean )
794 
795     /**
796      * Method parseDependencySet.
797      * 
798      * @param parser
799      * @param strict
800      * @throws IOException
801      * @throws XmlPullParserException
802      * @return DependencySet
803      */
804     private DependencySet parseDependencySet( XmlPullParser parser, boolean strict )
805         throws IOException, XmlPullParserException
806     {
807         String tagName = parser.getName();
808         DependencySetbly/model/DependencySet.html#DependencySet">DependencySet dependencySet = new DependencySet();
809         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
810         {
811             String name = parser.getAttributeName( i );
812             String value = parser.getAttributeValue( i );
813 
814             if ( name.indexOf( ':' ) >= 0 )
815             {
816                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
817             }
818             else
819             {
820                 checkUnknownAttribute( parser, name, tagName, strict );
821             }
822         }
823         java.util.Set parsed = new java.util.HashSet();
824         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
825         {
826             if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
827             {
828                 dependencySet.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
829             }
830             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
831             {
832                 java.util.List<String> includes = new java.util.ArrayList<String>();
833                 dependencySet.setIncludes( includes );
834                 while ( parser.nextTag() == XmlPullParser.START_TAG )
835                 {
836                     if ( "include".equals( parser.getName() ) )
837                     {
838                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
839                     }
840                     else
841                     {
842                         checkUnknownElement( parser, strict );
843                     }
844                 }
845             }
846             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
847             {
848                 java.util.List<String> excludes = new java.util.ArrayList<String>();
849                 dependencySet.setExcludes( excludes );
850                 while ( parser.nextTag() == XmlPullParser.START_TAG )
851                 {
852                     if ( "exclude".equals( parser.getName() ) )
853                     {
854                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
855                     }
856                     else
857                     {
858                         checkUnknownElement( parser, strict );
859                     }
860                 }
861             }
862             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
863             {
864                 dependencySet.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
865             }
866             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
867             {
868                 dependencySet.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
869             }
870             else if ( checkFieldWithDuplicate( parser, "useStrictFiltering", null, parsed ) )
871             {
872                 dependencySet.setUseStrictFiltering( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useStrictFiltering" ), "useStrictFiltering", parser, "false" ) );
873             }
874             else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) )
875             {
876                 dependencySet.setOutputFileNameMapping( interpolatedTrimmed( parser.nextText(), "outputFileNameMapping" ) );
877             }
878             else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) )
879             {
880                 dependencySet.setUnpack( getBooleanValue( interpolatedTrimmed( parser.nextText(), "unpack" ), "unpack", parser, "false" ) );
881             }
882             else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) )
883             {
884                 dependencySet.setUnpackOptions( parseUnpackOptions( parser, strict ) );
885             }
886             else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) )
887             {
888                 dependencySet.setScope( interpolatedTrimmed( parser.nextText(), "scope" ) );
889             }
890             else if ( checkFieldWithDuplicate( parser, "useProjectArtifact", null, parsed ) )
891             {
892                 dependencySet.setUseProjectArtifact( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useProjectArtifact" ), "useProjectArtifact", parser, "true" ) );
893             }
894             else if ( checkFieldWithDuplicate( parser, "useProjectAttachments", null, parsed ) )
895             {
896                 dependencySet.setUseProjectAttachments( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useProjectAttachments" ), "useProjectAttachments", parser, "false" ) );
897             }
898             else if ( checkFieldWithDuplicate( parser, "useTransitiveDependencies", null, parsed ) )
899             {
900                 dependencySet.setUseTransitiveDependencies( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useTransitiveDependencies" ), "useTransitiveDependencies", parser, "true" ) );
901             }
902             else if ( checkFieldWithDuplicate( parser, "useTransitiveFiltering", null, parsed ) )
903             {
904                 dependencySet.setUseTransitiveFiltering( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useTransitiveFiltering" ), "useTransitiveFiltering", parser, "false" ) );
905             }
906             else
907             {
908                 checkUnknownElement( parser, strict );
909             }
910         }
911         return dependencySet;
912     } //-- DependencySet parseDependencySet( XmlPullParser, boolean )
913 
914     /**
915      * Method parseFileItem.
916      * 
917      * @param parser
918      * @param strict
919      * @throws IOException
920      * @throws XmlPullParserException
921      * @return FileItem
922      */
923     private FileItem parseFileItem( XmlPullParser parser, boolean strict )
924         throws IOException, XmlPullParserException
925     {
926         String tagName = parser.getName();
927         FileItemgins/assembly/model/FileItem.html#FileItem">FileItem fileItem = new FileItem();
928         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
929         {
930             String name = parser.getAttributeName( i );
931             String value = parser.getAttributeValue( i );
932 
933             if ( name.indexOf( ':' ) >= 0 )
934             {
935                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
936             }
937             else
938             {
939                 checkUnknownAttribute( parser, name, tagName, strict );
940             }
941         }
942         java.util.Set parsed = new java.util.HashSet();
943         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
944         {
945             if ( checkFieldWithDuplicate( parser, "source", null, parsed ) )
946             {
947                 fileItem.setSource( interpolatedTrimmed( parser.nextText(), "source" ) );
948             }
949             else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) )
950             {
951                 java.util.List<String> sources = new java.util.ArrayList<String>();
952                 fileItem.setSources( sources );
953                 while ( parser.nextTag() == XmlPullParser.START_TAG )
954                 {
955                     if ( "source".equals( parser.getName() ) )
956                     {
957                         sources.add( interpolatedTrimmed( parser.nextText(), "sources" ) );
958                     }
959                     else
960                     {
961                         checkUnknownElement( parser, strict );
962                     }
963                 }
964             }
965             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
966             {
967                 fileItem.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
968             }
969             else if ( checkFieldWithDuplicate( parser, "destName", null, parsed ) )
970             {
971                 fileItem.setDestName( interpolatedTrimmed( parser.nextText(), "destName" ) );
972             }
973             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
974             {
975                 fileItem.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
976             }
977             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
978             {
979                 fileItem.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
980             }
981             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
982             {
983                 fileItem.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
984             }
985             else
986             {
987                 checkUnknownElement( parser, strict );
988             }
989         }
990         return fileItem;
991     } //-- FileItem parseFileItem( XmlPullParser, boolean )
992 
993     /**
994      * Method parseFileSet.
995      * 
996      * @param parser
997      * @param strict
998      * @throws IOException
999      * @throws XmlPullParserException
1000      * @return FileSet
1001      */
1002     private FileSet parseFileSet( XmlPullParser parser, boolean strict )
1003         throws IOException, XmlPullParserException
1004     {
1005         String tagName = parser.getName();
1006         FileSetlugins/assembly/model/FileSet.html#FileSet">FileSet fileSet = new FileSet();
1007         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1008         {
1009             String name = parser.getAttributeName( i );
1010             String value = parser.getAttributeValue( i );
1011 
1012             if ( name.indexOf( ':' ) >= 0 )
1013             {
1014                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1015             }
1016             else
1017             {
1018                 checkUnknownAttribute( parser, name, tagName, strict );
1019             }
1020         }
1021         java.util.Set parsed = new java.util.HashSet();
1022         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1023         {
1024             if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1025             {
1026                 fileSet.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1027             }
1028             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1029             {
1030                 fileSet.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1031             }
1032             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1033             {
1034                 java.util.List<String> includes = new java.util.ArrayList<String>();
1035                 fileSet.setIncludes( includes );
1036                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1037                 {
1038                     if ( "include".equals( parser.getName() ) )
1039                     {
1040                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1041                     }
1042                     else
1043                     {
1044                         checkUnknownElement( parser, strict );
1045                     }
1046                 }
1047             }
1048             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1049             {
1050                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1051                 fileSet.setExcludes( excludes );
1052                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1053                 {
1054                     if ( "exclude".equals( parser.getName() ) )
1055                     {
1056                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1057                     }
1058                     else
1059                     {
1060                         checkUnknownElement( parser, strict );
1061                     }
1062                 }
1063             }
1064             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1065             {
1066                 fileSet.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1067             }
1068             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1069             {
1070                 fileSet.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1071             }
1072             else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1073             {
1074                 fileSet.setDirectory( interpolatedTrimmed( parser.nextText(), "directory" ) );
1075             }
1076             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1077             {
1078                 fileSet.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1079             }
1080             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1081             {
1082                 fileSet.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1083             }
1084             else if ( checkFieldWithDuplicate( parser, "nonFilteredFileExtensions", null, parsed ) )
1085             {
1086                 java.util.List<String> nonFilteredFileExtensions = new java.util.ArrayList<String>();
1087                 fileSet.setNonFilteredFileExtensions( nonFilteredFileExtensions );
1088                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1089                 {
1090                     if ( "nonFilteredFileExtension".equals( parser.getName() ) )
1091                     {
1092                         nonFilteredFileExtensions.add( interpolatedTrimmed( parser.nextText(), "nonFilteredFileExtensions" ) );
1093                     }
1094                     else
1095                     {
1096                         checkUnknownElement( parser, strict );
1097                     }
1098                 }
1099             }
1100             else
1101             {
1102                 checkUnknownElement( parser, strict );
1103             }
1104         }
1105         return fileSet;
1106     } //-- FileSet parseFileSet( XmlPullParser, boolean )
1107 
1108     /**
1109      * Method parseGroupVersionAlignment.
1110      * 
1111      * @param parser
1112      * @param strict
1113      * @throws IOException
1114      * @throws XmlPullParserException
1115      * @return GroupVersionAlignment
1116      */
1117     private GroupVersionAlignment parseGroupVersionAlignment( XmlPullParser parser, boolean strict )
1118         throws IOException, XmlPullParserException
1119     {
1120         String tagName = parser.getName();
1121         GroupVersionAlignmentersionAlignment.html#GroupVersionAlignment">GroupVersionAlignment groupVersionAlignment = new GroupVersionAlignment();
1122         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1123         {
1124             String name = parser.getAttributeName( i );
1125             String value = parser.getAttributeValue( i );
1126 
1127             if ( name.indexOf( ':' ) >= 0 )
1128             {
1129                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1130             }
1131             else
1132             {
1133                 checkUnknownAttribute( parser, name, tagName, strict );
1134             }
1135         }
1136         java.util.Set parsed = new java.util.HashSet();
1137         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1138         {
1139             if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1140             {
1141                 groupVersionAlignment.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
1142             }
1143             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
1144             {
1145                 groupVersionAlignment.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
1146             }
1147             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1148             {
1149                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1150                 groupVersionAlignment.setExcludes( excludes );
1151                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1152                 {
1153                     if ( "exclude".equals( parser.getName() ) )
1154                     {
1155                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1156                     }
1157                     else
1158                     {
1159                         checkUnknownElement( parser, strict );
1160                     }
1161                 }
1162             }
1163             else
1164             {
1165                 checkUnknownElement( parser, strict );
1166             }
1167         }
1168         return groupVersionAlignment;
1169     } //-- GroupVersionAlignment parseGroupVersionAlignment( XmlPullParser, boolean )
1170 
1171     /**
1172      * Method parseModuleBinaries.
1173      * 
1174      * @param parser
1175      * @param strict
1176      * @throws IOException
1177      * @throws XmlPullParserException
1178      * @return ModuleBinaries
1179      */
1180     private ModuleBinaries parseModuleBinaries( XmlPullParser parser, boolean strict )
1181         throws IOException, XmlPullParserException
1182     {
1183         String tagName = parser.getName();
1184         ModuleBinariesy/model/ModuleBinaries.html#ModuleBinaries">ModuleBinaries moduleBinaries = new ModuleBinaries();
1185         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1186         {
1187             String name = parser.getAttributeName( i );
1188             String value = parser.getAttributeValue( i );
1189 
1190             if ( name.indexOf( ':' ) >= 0 )
1191             {
1192                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1193             }
1194             else
1195             {
1196                 checkUnknownAttribute( parser, name, tagName, strict );
1197             }
1198         }
1199         java.util.Set parsed = new java.util.HashSet();
1200         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1201         {
1202             if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1203             {
1204                 moduleBinaries.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1205             }
1206             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1207             {
1208                 java.util.List<String> includes = new java.util.ArrayList<String>();
1209                 moduleBinaries.setIncludes( includes );
1210                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1211                 {
1212                     if ( "include".equals( parser.getName() ) )
1213                     {
1214                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1215                     }
1216                     else
1217                     {
1218                         checkUnknownElement( parser, strict );
1219                     }
1220                 }
1221             }
1222             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1223             {
1224                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1225                 moduleBinaries.setExcludes( excludes );
1226                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1227                 {
1228                     if ( "exclude".equals( parser.getName() ) )
1229                     {
1230                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1231                     }
1232                     else
1233                     {
1234                         checkUnknownElement( parser, strict );
1235                     }
1236                 }
1237             }
1238             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1239             {
1240                 moduleBinaries.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1241             }
1242             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1243             {
1244                 moduleBinaries.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1245             }
1246             else if ( checkFieldWithDuplicate( parser, "attachmentClassifier", null, parsed ) )
1247             {
1248                 moduleBinaries.setAttachmentClassifier( interpolatedTrimmed( parser.nextText(), "attachmentClassifier" ) );
1249             }
1250             else if ( checkFieldWithDuplicate( parser, "includeDependencies", null, parsed ) )
1251             {
1252                 moduleBinaries.setIncludeDependencies( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeDependencies" ), "includeDependencies", parser, "true" ) );
1253             }
1254             else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) )
1255             {
1256                 java.util.List<DependencySet> dependencySets = new java.util.ArrayList<DependencySet>();
1257                 moduleBinaries.setDependencySets( dependencySets );
1258                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1259                 {
1260                     if ( "dependencySet".equals( parser.getName() ) )
1261                     {
1262                         dependencySets.add( parseDependencySet( parser, strict ) );
1263                     }
1264                     else
1265                     {
1266                         checkUnknownElement( parser, strict );
1267                     }
1268                 }
1269             }
1270             else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) )
1271             {
1272                 moduleBinaries.setUnpack( getBooleanValue( interpolatedTrimmed( parser.nextText(), "unpack" ), "unpack", parser, "true" ) );
1273             }
1274             else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) )
1275             {
1276                 moduleBinaries.setUnpackOptions( parseUnpackOptions( parser, strict ) );
1277             }
1278             else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) )
1279             {
1280                 moduleBinaries.setOutputFileNameMapping( interpolatedTrimmed( parser.nextText(), "outputFileNameMapping" ) );
1281             }
1282             else
1283             {
1284                 checkUnknownElement( parser, strict );
1285             }
1286         }
1287         return moduleBinaries;
1288     } //-- ModuleBinaries parseModuleBinaries( XmlPullParser, boolean )
1289 
1290     /**
1291      * Method parseModuleSet.
1292      * 
1293      * @param parser
1294      * @param strict
1295      * @throws IOException
1296      * @throws XmlPullParserException
1297      * @return ModuleSet
1298      */
1299     private ModuleSet parseModuleSet( XmlPullParser parser, boolean strict )
1300         throws IOException, XmlPullParserException
1301     {
1302         String tagName = parser.getName();
1303         ModuleSetns/assembly/model/ModuleSet.html#ModuleSet">ModuleSet moduleSet = new ModuleSet();
1304         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1305         {
1306             String name = parser.getAttributeName( i );
1307             String value = parser.getAttributeValue( i );
1308 
1309             if ( name.indexOf( ':' ) >= 0 )
1310             {
1311                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1312             }
1313             else
1314             {
1315                 checkUnknownAttribute( parser, name, tagName, strict );
1316             }
1317         }
1318         java.util.Set parsed = new java.util.HashSet();
1319         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1320         {
1321             if ( checkFieldWithDuplicate( parser, "useAllReactorProjects", null, parsed ) )
1322             {
1323                 moduleSet.setUseAllReactorProjects( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useAllReactorProjects" ), "useAllReactorProjects", parser, "false" ) );
1324             }
1325             else if ( checkFieldWithDuplicate( parser, "includeSubModules", null, parsed ) )
1326             {
1327                 moduleSet.setIncludeSubModules( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeSubModules" ), "includeSubModules", parser, "true" ) );
1328             }
1329             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1330             {
1331                 java.util.List<String> includes = new java.util.ArrayList<String>();
1332                 moduleSet.setIncludes( includes );
1333                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1334                 {
1335                     if ( "include".equals( parser.getName() ) )
1336                     {
1337                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1338                     }
1339                     else
1340                     {
1341                         checkUnknownElement( parser, strict );
1342                     }
1343                 }
1344             }
1345             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1346             {
1347                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1348                 moduleSet.setExcludes( excludes );
1349                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1350                 {
1351                     if ( "exclude".equals( parser.getName() ) )
1352                     {
1353                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1354                     }
1355                     else
1356                     {
1357                         checkUnknownElement( parser, strict );
1358                     }
1359                 }
1360             }
1361             else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) )
1362             {
1363                 moduleSet.setSources( parseModuleSources( parser, strict ) );
1364             }
1365             else if ( checkFieldWithDuplicate( parser, "binaries", null, parsed ) )
1366             {
1367                 moduleSet.setBinaries( parseModuleBinaries( parser, strict ) );
1368             }
1369             else
1370             {
1371                 checkUnknownElement( parser, strict );
1372             }
1373         }
1374         return moduleSet;
1375     } //-- ModuleSet parseModuleSet( XmlPullParser, boolean )
1376 
1377     /**
1378      * Method parseModuleSources.
1379      * 
1380      * @param parser
1381      * @param strict
1382      * @throws IOException
1383      * @throws XmlPullParserException
1384      * @return ModuleSources
1385      */
1386     private ModuleSources parseModuleSources( XmlPullParser parser, boolean strict )
1387         throws IOException, XmlPullParserException
1388     {
1389         String tagName = parser.getName();
1390         ModuleSourcesbly/model/ModuleSources.html#ModuleSources">ModuleSources moduleSources = new ModuleSources();
1391         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1392         {
1393             String name = parser.getAttributeName( i );
1394             String value = parser.getAttributeValue( i );
1395 
1396             if ( name.indexOf( ':' ) >= 0 )
1397             {
1398                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1399             }
1400             else
1401             {
1402                 checkUnknownAttribute( parser, name, tagName, strict );
1403             }
1404         }
1405         java.util.Set parsed = new java.util.HashSet();
1406         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1407         {
1408             if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1409             {
1410                 moduleSources.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1411             }
1412             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1413             {
1414                 moduleSources.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1415             }
1416             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1417             {
1418                 java.util.List<String> includes = new java.util.ArrayList<String>();
1419                 moduleSources.setIncludes( includes );
1420                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1421                 {
1422                     if ( "include".equals( parser.getName() ) )
1423                     {
1424                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1425                     }
1426                     else
1427                     {
1428                         checkUnknownElement( parser, strict );
1429                     }
1430                 }
1431             }
1432             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1433             {
1434                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1435                 moduleSources.setExcludes( excludes );
1436                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1437                 {
1438                     if ( "exclude".equals( parser.getName() ) )
1439                     {
1440                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1441                     }
1442                     else
1443                     {
1444                         checkUnknownElement( parser, strict );
1445                     }
1446                 }
1447             }
1448             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1449             {
1450                 moduleSources.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1451             }
1452             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1453             {
1454                 moduleSources.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1455             }
1456             else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) )
1457             {
1458                 java.util.List<FileSet> fileSets = new java.util.ArrayList<FileSet>();
1459                 moduleSources.setFileSets( fileSets );
1460                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1461                 {
1462                     if ( "fileSet".equals( parser.getName() ) )
1463                     {
1464                         fileSets.add( parseFileSet( parser, strict ) );
1465                     }
1466                     else
1467                     {
1468                         checkUnknownElement( parser, strict );
1469                     }
1470                 }
1471             }
1472             else if ( checkFieldWithDuplicate( parser, "includeModuleDirectory", null, parsed ) )
1473             {
1474                 moduleSources.setIncludeModuleDirectory( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeModuleDirectory" ), "includeModuleDirectory", parser, "true" ) );
1475             }
1476             else if ( checkFieldWithDuplicate( parser, "excludeSubModuleDirectories", null, parsed ) )
1477             {
1478                 moduleSources.setExcludeSubModuleDirectories( getBooleanValue( interpolatedTrimmed( parser.nextText(), "excludeSubModuleDirectories" ), "excludeSubModuleDirectories", parser, "true" ) );
1479             }
1480             else if ( checkFieldWithDuplicate( parser, "outputDirectoryMapping", null, parsed ) )
1481             {
1482                 moduleSources.setOutputDirectoryMapping( interpolatedTrimmed( parser.nextText(), "outputDirectoryMapping" ) );
1483             }
1484             else
1485             {
1486                 checkUnknownElement( parser, strict );
1487             }
1488         }
1489         return moduleSources;
1490     } //-- ModuleSources parseModuleSources( XmlPullParser, boolean )
1491 
1492     /**
1493      * Method parseRepository.
1494      * 
1495      * @param parser
1496      * @param strict
1497      * @throws IOException
1498      * @throws XmlPullParserException
1499      * @return Repository
1500      */
1501     private Repository parseRepository( XmlPullParser parser, boolean strict )
1502         throws IOException, XmlPullParserException
1503     {
1504         String tagName = parser.getName();
1505         Repository/assembly/model/Repository.html#Repository">Repository repository = new Repository();
1506         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1507         {
1508             String name = parser.getAttributeName( i );
1509             String value = parser.getAttributeValue( i );
1510 
1511             if ( name.indexOf( ':' ) >= 0 )
1512             {
1513                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1514             }
1515             else
1516             {
1517                 checkUnknownAttribute( parser, name, tagName, strict );
1518             }
1519         }
1520         java.util.Set parsed = new java.util.HashSet();
1521         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1522         {
1523             if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1524             {
1525                 repository.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1526             }
1527             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1528             {
1529                 java.util.List<String> includes = new java.util.ArrayList<String>();
1530                 repository.setIncludes( includes );
1531                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1532                 {
1533                     if ( "include".equals( parser.getName() ) )
1534                     {
1535                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1536                     }
1537                     else
1538                     {
1539                         checkUnknownElement( parser, strict );
1540                     }
1541                 }
1542             }
1543             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1544             {
1545                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1546                 repository.setExcludes( excludes );
1547                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1548                 {
1549                     if ( "exclude".equals( parser.getName() ) )
1550                     {
1551                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1552                     }
1553                     else
1554                     {
1555                         checkUnknownElement( parser, strict );
1556                     }
1557                 }
1558             }
1559             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1560             {
1561                 repository.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1562             }
1563             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1564             {
1565                 repository.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1566             }
1567             else if ( checkFieldWithDuplicate( parser, "includeMetadata", null, parsed ) )
1568             {
1569                 repository.setIncludeMetadata( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeMetadata" ), "includeMetadata", parser, "false" ) );
1570             }
1571             else if ( checkFieldWithDuplicate( parser, "groupVersionAlignments", null, parsed ) )
1572             {
1573                 java.util.List<GroupVersionAlignment> groupVersionAlignments = new java.util.ArrayList<GroupVersionAlignment>();
1574                 repository.setGroupVersionAlignments( groupVersionAlignments );
1575                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1576                 {
1577                     if ( "groupVersionAlignment".equals( parser.getName() ) )
1578                     {
1579                         groupVersionAlignments.add( parseGroupVersionAlignment( parser, strict ) );
1580                     }
1581                     else
1582                     {
1583                         checkUnknownElement( parser, strict );
1584                     }
1585                 }
1586             }
1587             else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) )
1588             {
1589                 repository.setScope( interpolatedTrimmed( parser.nextText(), "scope" ) );
1590             }
1591             else
1592             {
1593                 checkUnknownElement( parser, strict );
1594             }
1595         }
1596         return repository;
1597     } //-- Repository parseRepository( XmlPullParser, boolean )
1598 
1599     /**
1600      * Method parseUnpackOptions.
1601      * 
1602      * @param parser
1603      * @param strict
1604      * @throws IOException
1605      * @throws XmlPullParserException
1606      * @return UnpackOptions
1607      */
1608     private UnpackOptions parseUnpackOptions( XmlPullParser parser, boolean strict )
1609         throws IOException, XmlPullParserException
1610     {
1611         String tagName = parser.getName();
1612         UnpackOptionsbly/model/UnpackOptions.html#UnpackOptions">UnpackOptions unpackOptions = new UnpackOptions();
1613         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1614         {
1615             String name = parser.getAttributeName( i );
1616             String value = parser.getAttributeValue( i );
1617 
1618             if ( name.indexOf( ':' ) >= 0 )
1619             {
1620                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1621             }
1622             else
1623             {
1624                 checkUnknownAttribute( parser, name, tagName, strict );
1625             }
1626         }
1627         java.util.Set parsed = new java.util.HashSet();
1628         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1629         {
1630             if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1631             {
1632                 java.util.List<String> includes = new java.util.ArrayList<String>();
1633                 unpackOptions.setIncludes( includes );
1634                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1635                 {
1636                     if ( "include".equals( parser.getName() ) )
1637                     {
1638                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1639                     }
1640                     else
1641                     {
1642                         checkUnknownElement( parser, strict );
1643                     }
1644                 }
1645             }
1646             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1647             {
1648                 java.util.List<String> excludes = new java.util.ArrayList<String>();
1649                 unpackOptions.setExcludes( excludes );
1650                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1651                 {
1652                     if ( "exclude".equals( parser.getName() ) )
1653                     {
1654                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1655                     }
1656                     else
1657                     {
1658                         checkUnknownElement( parser, strict );
1659                     }
1660                 }
1661             }
1662             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1663             {
1664                 unpackOptions.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1665             }
1666             else if ( checkFieldWithDuplicate( parser, "nonFilteredFileExtensions", null, parsed ) )
1667             {
1668                 java.util.List<String> nonFilteredFileExtensions = new java.util.ArrayList<String>();
1669                 unpackOptions.setNonFilteredFileExtensions( nonFilteredFileExtensions );
1670                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1671                 {
1672                     if ( "nonFilteredFileExtension".equals( parser.getName() ) )
1673                     {
1674                         nonFilteredFileExtensions.add( interpolatedTrimmed( parser.nextText(), "nonFilteredFileExtensions" ) );
1675                     }
1676                     else
1677                     {
1678                         checkUnknownElement( parser, strict );
1679                     }
1680                 }
1681             }
1682             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1683             {
1684                 unpackOptions.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1685             }
1686             else if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1687             {
1688                 unpackOptions.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1689             }
1690             else if ( checkFieldWithDuplicate( parser, "encoding", null, parsed ) )
1691             {
1692                 unpackOptions.setEncoding( interpolatedTrimmed( parser.nextText(), "encoding" ) );
1693             }
1694             else
1695             {
1696                 checkUnknownElement( parser, strict );
1697             }
1698         }
1699         return unpackOptions;
1700     } //-- UnpackOptions parseUnpackOptions( XmlPullParser, boolean )
1701 
1702     /**
1703      * Method read.
1704      * 
1705      * @param parser
1706      * @param strict
1707      * @throws IOException
1708      * @throws XmlPullParserException
1709      * @return Component
1710      */
1711     private Component read( XmlPullParser parser, boolean strict )
1712         throws IOException, XmlPullParserException
1713     {
1714         Component component = null;
1715         int eventType = parser.getEventType();
1716         boolean parsed = false;
1717         while ( eventType != XmlPullParser.END_DOCUMENT )
1718         {
1719             if ( eventType == XmlPullParser.START_TAG )
1720             {
1721                 if ( strict && ! "component".equals( parser.getName() ) )
1722                 {
1723                     throw new XmlPullParserException( "Expected root element 'component' but found '" + parser.getName() + "'", parser, null );
1724                 }
1725                 else if ( parsed )
1726                 {
1727                     // fallback, already expected a XmlPullParserException due to invalid XML
1728                     throw new XmlPullParserException( "Duplicated tag: 'component'", parser, null );
1729                 }
1730                 component = parseComponent( parser, strict );
1731                 component.setModelEncoding( parser.getInputEncoding() );
1732                 parsed = true;
1733             }
1734             eventType = parser.next();
1735         }
1736         if ( parsed )
1737         {
1738             return component;
1739         }
1740         throw new XmlPullParserException( "Expected root element 'component' but found no element at all: invalid XML document", parser, null );
1741     } //-- Component read( XmlPullParser, boolean )
1742 
1743     /**
1744      * Sets the state of the "add default entities" flag.
1745      * 
1746      * @param addDefaultEntities
1747      */
1748     public void setAddDefaultEntities( boolean addDefaultEntities )
1749     {
1750         this.addDefaultEntities = addDefaultEntities;
1751     } //-- void setAddDefaultEntities( boolean )
1752 
1753     public static interface ContentTransformer
1754 {
1755     /**
1756      * Interpolate the value read from the xpp3 document
1757      * @param source The source value
1758      * @param fieldName A description of the field being interpolated. The implementation may use this to
1759      *                           log stuff.
1760      * @return The interpolated value.
1761      */
1762     String transform( String source, String fieldName );
1763 }
1764 
1765 }