View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.8.3,
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         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 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 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 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 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 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 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         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         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 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 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         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, "outputDirectory", null, parsed ) )
950             {
951                 fileItem.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
952             }
953             else if ( checkFieldWithDuplicate( parser, "destName", null, parsed ) )
954             {
955                 fileItem.setDestName( interpolatedTrimmed( parser.nextText(), "destName" ) );
956             }
957             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
958             {
959                 fileItem.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
960             }
961             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
962             {
963                 fileItem.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
964             }
965             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
966             {
967                 fileItem.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
968             }
969             else
970             {
971                 checkUnknownElement( parser, strict );
972             }
973         }
974         return fileItem;
975     } //-- FileItem parseFileItem( XmlPullParser, boolean )
976 
977     /**
978      * Method parseFileSet.
979      * 
980      * @param parser
981      * @param strict
982      * @throws IOException
983      * @throws XmlPullParserException
984      * @return FileSet
985      */
986     private FileSet parseFileSet( XmlPullParser parser, boolean strict )
987         throws IOException, XmlPullParserException
988     {
989         String tagName = parser.getName();
990         FileSet fileSet = new FileSet();
991         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
992         {
993             String name = parser.getAttributeName( i );
994             String value = parser.getAttributeValue( i );
995 
996             if ( name.indexOf( ':' ) >= 0 )
997             {
998                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
999             }
1000             else
1001             {
1002                 checkUnknownAttribute( parser, name, tagName, strict );
1003             }
1004         }
1005         java.util.Set parsed = new java.util.HashSet();
1006         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1007         {
1008             if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1009             {
1010                 fileSet.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1011             }
1012             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1013             {
1014                 fileSet.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1015             }
1016             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1017             {
1018                 java.util.List includes = new java.util.ArrayList/*<String>*/();
1019                 fileSet.setIncludes( includes );
1020                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1021                 {
1022                     if ( "include".equals( parser.getName() ) )
1023                     {
1024                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1025                     }
1026                     else
1027                     {
1028                         checkUnknownElement( parser, strict );
1029                     }
1030                 }
1031             }
1032             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1033             {
1034                 java.util.List excludes = new java.util.ArrayList/*<String>*/();
1035                 fileSet.setExcludes( excludes );
1036                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1037                 {
1038                     if ( "exclude".equals( parser.getName() ) )
1039                     {
1040                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1041                     }
1042                     else
1043                     {
1044                         checkUnknownElement( parser, strict );
1045                     }
1046                 }
1047             }
1048             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1049             {
1050                 fileSet.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1051             }
1052             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1053             {
1054                 fileSet.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1055             }
1056             else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1057             {
1058                 fileSet.setDirectory( interpolatedTrimmed( parser.nextText(), "directory" ) );
1059             }
1060             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1061             {
1062                 fileSet.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1063             }
1064             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1065             {
1066                 fileSet.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1067             }
1068             else
1069             {
1070                 checkUnknownElement( parser, strict );
1071             }
1072         }
1073         return fileSet;
1074     } //-- FileSet parseFileSet( XmlPullParser, boolean )
1075 
1076     /**
1077      * Method parseGroupVersionAlignment.
1078      * 
1079      * @param parser
1080      * @param strict
1081      * @throws IOException
1082      * @throws XmlPullParserException
1083      * @return GroupVersionAlignment
1084      */
1085     private GroupVersionAlignment parseGroupVersionAlignment( XmlPullParser parser, boolean strict )
1086         throws IOException, XmlPullParserException
1087     {
1088         String tagName = parser.getName();
1089         GroupVersionAlignment groupVersionAlignment = new GroupVersionAlignment();
1090         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1091         {
1092             String name = parser.getAttributeName( i );
1093             String value = parser.getAttributeValue( i );
1094 
1095             if ( name.indexOf( ':' ) >= 0 )
1096             {
1097                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1098             }
1099             else
1100             {
1101                 checkUnknownAttribute( parser, name, tagName, strict );
1102             }
1103         }
1104         java.util.Set parsed = new java.util.HashSet();
1105         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1106         {
1107             if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1108             {
1109                 groupVersionAlignment.setId( interpolatedTrimmed( parser.nextText(), "id" ) );
1110             }
1111             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
1112             {
1113                 groupVersionAlignment.setVersion( interpolatedTrimmed( parser.nextText(), "version" ) );
1114             }
1115             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1116             {
1117                 java.util.List excludes = new java.util.ArrayList/*<String>*/();
1118                 groupVersionAlignment.setExcludes( excludes );
1119                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1120                 {
1121                     if ( "exclude".equals( parser.getName() ) )
1122                     {
1123                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1124                     }
1125                     else
1126                     {
1127                         checkUnknownElement( parser, strict );
1128                     }
1129                 }
1130             }
1131             else
1132             {
1133                 checkUnknownElement( parser, strict );
1134             }
1135         }
1136         return groupVersionAlignment;
1137     } //-- GroupVersionAlignment parseGroupVersionAlignment( XmlPullParser, boolean )
1138 
1139     /**
1140      * Method parseModuleBinaries.
1141      * 
1142      * @param parser
1143      * @param strict
1144      * @throws IOException
1145      * @throws XmlPullParserException
1146      * @return ModuleBinaries
1147      */
1148     private ModuleBinaries parseModuleBinaries( XmlPullParser parser, boolean strict )
1149         throws IOException, XmlPullParserException
1150     {
1151         String tagName = parser.getName();
1152         ModuleBinaries moduleBinaries = new ModuleBinaries();
1153         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1154         {
1155             String name = parser.getAttributeName( i );
1156             String value = parser.getAttributeValue( i );
1157 
1158             if ( name.indexOf( ':' ) >= 0 )
1159             {
1160                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1161             }
1162             else
1163             {
1164                 checkUnknownAttribute( parser, name, tagName, strict );
1165             }
1166         }
1167         java.util.Set parsed = new java.util.HashSet();
1168         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1169         {
1170             if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1171             {
1172                 moduleBinaries.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1173             }
1174             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1175             {
1176                 java.util.List includes = new java.util.ArrayList/*<String>*/();
1177                 moduleBinaries.setIncludes( includes );
1178                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1179                 {
1180                     if ( "include".equals( parser.getName() ) )
1181                     {
1182                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1183                     }
1184                     else
1185                     {
1186                         checkUnknownElement( parser, strict );
1187                     }
1188                 }
1189             }
1190             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1191             {
1192                 java.util.List excludes = new java.util.ArrayList/*<String>*/();
1193                 moduleBinaries.setExcludes( excludes );
1194                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1195                 {
1196                     if ( "exclude".equals( parser.getName() ) )
1197                     {
1198                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1199                     }
1200                     else
1201                     {
1202                         checkUnknownElement( parser, strict );
1203                     }
1204                 }
1205             }
1206             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1207             {
1208                 moduleBinaries.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1209             }
1210             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1211             {
1212                 moduleBinaries.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1213             }
1214             else if ( checkFieldWithDuplicate( parser, "attachmentClassifier", null, parsed ) )
1215             {
1216                 moduleBinaries.setAttachmentClassifier( interpolatedTrimmed( parser.nextText(), "attachmentClassifier" ) );
1217             }
1218             else if ( checkFieldWithDuplicate( parser, "includeDependencies", null, parsed ) )
1219             {
1220                 moduleBinaries.setIncludeDependencies( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeDependencies" ), "includeDependencies", parser, "true" ) );
1221             }
1222             else if ( checkFieldWithDuplicate( parser, "dependencySets", null, parsed ) )
1223             {
1224                 java.util.List dependencySets = new java.util.ArrayList/*<DependencySet>*/();
1225                 moduleBinaries.setDependencySets( dependencySets );
1226                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1227                 {
1228                     if ( "dependencySet".equals( parser.getName() ) )
1229                     {
1230                         dependencySets.add( parseDependencySet( parser, strict ) );
1231                     }
1232                     else
1233                     {
1234                         checkUnknownElement( parser, strict );
1235                     }
1236                 }
1237             }
1238             else if ( checkFieldWithDuplicate( parser, "unpack", null, parsed ) )
1239             {
1240                 moduleBinaries.setUnpack( getBooleanValue( interpolatedTrimmed( parser.nextText(), "unpack" ), "unpack", parser, "true" ) );
1241             }
1242             else if ( checkFieldWithDuplicate( parser, "unpackOptions", null, parsed ) )
1243             {
1244                 moduleBinaries.setUnpackOptions( parseUnpackOptions( parser, strict ) );
1245             }
1246             else if ( checkFieldWithDuplicate( parser, "outputFileNameMapping", null, parsed ) )
1247             {
1248                 moduleBinaries.setOutputFileNameMapping( interpolatedTrimmed( parser.nextText(), "outputFileNameMapping" ) );
1249             }
1250             else
1251             {
1252                 checkUnknownElement( parser, strict );
1253             }
1254         }
1255         return moduleBinaries;
1256     } //-- ModuleBinaries parseModuleBinaries( XmlPullParser, boolean )
1257 
1258     /**
1259      * Method parseModuleSet.
1260      * 
1261      * @param parser
1262      * @param strict
1263      * @throws IOException
1264      * @throws XmlPullParserException
1265      * @return ModuleSet
1266      */
1267     private ModuleSet parseModuleSet( XmlPullParser parser, boolean strict )
1268         throws IOException, XmlPullParserException
1269     {
1270         String tagName = parser.getName();
1271         ModuleSet moduleSet = new ModuleSet();
1272         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1273         {
1274             String name = parser.getAttributeName( i );
1275             String value = parser.getAttributeValue( i );
1276 
1277             if ( name.indexOf( ':' ) >= 0 )
1278             {
1279                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1280             }
1281             else
1282             {
1283                 checkUnknownAttribute( parser, name, tagName, strict );
1284             }
1285         }
1286         java.util.Set parsed = new java.util.HashSet();
1287         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1288         {
1289             if ( checkFieldWithDuplicate( parser, "useAllReactorProjects", null, parsed ) )
1290             {
1291                 moduleSet.setUseAllReactorProjects( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useAllReactorProjects" ), "useAllReactorProjects", parser, "false" ) );
1292             }
1293             else if ( checkFieldWithDuplicate( parser, "includeSubModules", null, parsed ) )
1294             {
1295                 moduleSet.setIncludeSubModules( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeSubModules" ), "includeSubModules", parser, "true" ) );
1296             }
1297             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1298             {
1299                 java.util.List includes = new java.util.ArrayList/*<String>*/();
1300                 moduleSet.setIncludes( includes );
1301                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1302                 {
1303                     if ( "include".equals( parser.getName() ) )
1304                     {
1305                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1306                     }
1307                     else
1308                     {
1309                         checkUnknownElement( parser, strict );
1310                     }
1311                 }
1312             }
1313             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1314             {
1315                 java.util.List excludes = new java.util.ArrayList/*<String>*/();
1316                 moduleSet.setExcludes( excludes );
1317                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1318                 {
1319                     if ( "exclude".equals( parser.getName() ) )
1320                     {
1321                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1322                     }
1323                     else
1324                     {
1325                         checkUnknownElement( parser, strict );
1326                     }
1327                 }
1328             }
1329             else if ( checkFieldWithDuplicate( parser, "sources", null, parsed ) )
1330             {
1331                 moduleSet.setSources( parseModuleSources( parser, strict ) );
1332             }
1333             else if ( checkFieldWithDuplicate( parser, "binaries", null, parsed ) )
1334             {
1335                 moduleSet.setBinaries( parseModuleBinaries( parser, strict ) );
1336             }
1337             else
1338             {
1339                 checkUnknownElement( parser, strict );
1340             }
1341         }
1342         return moduleSet;
1343     } //-- ModuleSet parseModuleSet( XmlPullParser, boolean )
1344 
1345     /**
1346      * Method parseModuleSources.
1347      * 
1348      * @param parser
1349      * @param strict
1350      * @throws IOException
1351      * @throws XmlPullParserException
1352      * @return ModuleSources
1353      */
1354     private ModuleSources parseModuleSources( XmlPullParser parser, boolean strict )
1355         throws IOException, XmlPullParserException
1356     {
1357         String tagName = parser.getName();
1358         ModuleSources moduleSources = new ModuleSources();
1359         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1360         {
1361             String name = parser.getAttributeName( i );
1362             String value = parser.getAttributeValue( i );
1363 
1364             if ( name.indexOf( ':' ) >= 0 )
1365             {
1366                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1367             }
1368             else
1369             {
1370                 checkUnknownAttribute( parser, name, tagName, strict );
1371             }
1372         }
1373         java.util.Set parsed = new java.util.HashSet();
1374         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1375         {
1376             if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1377             {
1378                 moduleSources.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1379             }
1380             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1381             {
1382                 moduleSources.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1383             }
1384             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1385             {
1386                 java.util.List includes = new java.util.ArrayList/*<String>*/();
1387                 moduleSources.setIncludes( includes );
1388                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1389                 {
1390                     if ( "include".equals( parser.getName() ) )
1391                     {
1392                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1393                     }
1394                     else
1395                     {
1396                         checkUnknownElement( parser, strict );
1397                     }
1398                 }
1399             }
1400             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1401             {
1402                 java.util.List excludes = new java.util.ArrayList/*<String>*/();
1403                 moduleSources.setExcludes( excludes );
1404                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1405                 {
1406                     if ( "exclude".equals( parser.getName() ) )
1407                     {
1408                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1409                     }
1410                     else
1411                     {
1412                         checkUnknownElement( parser, strict );
1413                     }
1414                 }
1415             }
1416             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1417             {
1418                 moduleSources.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1419             }
1420             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1421             {
1422                 moduleSources.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1423             }
1424             else if ( checkFieldWithDuplicate( parser, "fileSets", null, parsed ) )
1425             {
1426                 java.util.List fileSets = new java.util.ArrayList/*<FileSet>*/();
1427                 moduleSources.setFileSets( fileSets );
1428                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1429                 {
1430                     if ( "fileSet".equals( parser.getName() ) )
1431                     {
1432                         fileSets.add( parseFileSet( parser, strict ) );
1433                     }
1434                     else
1435                     {
1436                         checkUnknownElement( parser, strict );
1437                     }
1438                 }
1439             }
1440             else if ( checkFieldWithDuplicate( parser, "includeModuleDirectory", null, parsed ) )
1441             {
1442                 moduleSources.setIncludeModuleDirectory( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeModuleDirectory" ), "includeModuleDirectory", parser, "true" ) );
1443             }
1444             else if ( checkFieldWithDuplicate( parser, "excludeSubModuleDirectories", null, parsed ) )
1445             {
1446                 moduleSources.setExcludeSubModuleDirectories( getBooleanValue( interpolatedTrimmed( parser.nextText(), "excludeSubModuleDirectories" ), "excludeSubModuleDirectories", parser, "true" ) );
1447             }
1448             else if ( checkFieldWithDuplicate( parser, "outputDirectoryMapping", null, parsed ) )
1449             {
1450                 moduleSources.setOutputDirectoryMapping( interpolatedTrimmed( parser.nextText(), "outputDirectoryMapping" ) );
1451             }
1452             else
1453             {
1454                 checkUnknownElement( parser, strict );
1455             }
1456         }
1457         return moduleSources;
1458     } //-- ModuleSources parseModuleSources( XmlPullParser, boolean )
1459 
1460     /**
1461      * Method parseRepository.
1462      * 
1463      * @param parser
1464      * @param strict
1465      * @throws IOException
1466      * @throws XmlPullParserException
1467      * @return Repository
1468      */
1469     private Repository parseRepository( XmlPullParser parser, boolean strict )
1470         throws IOException, XmlPullParserException
1471     {
1472         String tagName = parser.getName();
1473         Repository repository = new Repository();
1474         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1475         {
1476             String name = parser.getAttributeName( i );
1477             String value = parser.getAttributeValue( i );
1478 
1479             if ( name.indexOf( ':' ) >= 0 )
1480             {
1481                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1482             }
1483             else
1484             {
1485                 checkUnknownAttribute( parser, name, tagName, strict );
1486             }
1487         }
1488         java.util.Set parsed = new java.util.HashSet();
1489         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1490         {
1491             if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1492             {
1493                 repository.setOutputDirectory( interpolatedTrimmed( parser.nextText(), "outputDirectory" ) );
1494             }
1495             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1496             {
1497                 java.util.List includes = new java.util.ArrayList/*<String>*/();
1498                 repository.setIncludes( includes );
1499                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1500                 {
1501                     if ( "include".equals( parser.getName() ) )
1502                     {
1503                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1504                     }
1505                     else
1506                     {
1507                         checkUnknownElement( parser, strict );
1508                     }
1509                 }
1510             }
1511             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1512             {
1513                 java.util.List excludes = new java.util.ArrayList/*<String>*/();
1514                 repository.setExcludes( excludes );
1515                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1516                 {
1517                     if ( "exclude".equals( parser.getName() ) )
1518                     {
1519                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1520                     }
1521                     else
1522                     {
1523                         checkUnknownElement( parser, strict );
1524                     }
1525                 }
1526             }
1527             else if ( checkFieldWithDuplicate( parser, "fileMode", null, parsed ) )
1528             {
1529                 repository.setFileMode( interpolatedTrimmed( parser.nextText(), "fileMode" ) );
1530             }
1531             else if ( checkFieldWithDuplicate( parser, "directoryMode", null, parsed ) )
1532             {
1533                 repository.setDirectoryMode( interpolatedTrimmed( parser.nextText(), "directoryMode" ) );
1534             }
1535             else if ( checkFieldWithDuplicate( parser, "includeMetadata", null, parsed ) )
1536             {
1537                 repository.setIncludeMetadata( getBooleanValue( interpolatedTrimmed( parser.nextText(), "includeMetadata" ), "includeMetadata", parser, "false" ) );
1538             }
1539             else if ( checkFieldWithDuplicate( parser, "groupVersionAlignments", null, parsed ) )
1540             {
1541                 java.util.List groupVersionAlignments = new java.util.ArrayList/*<GroupVersionAlignment>*/();
1542                 repository.setGroupVersionAlignments( groupVersionAlignments );
1543                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1544                 {
1545                     if ( "groupVersionAlignment".equals( parser.getName() ) )
1546                     {
1547                         groupVersionAlignments.add( parseGroupVersionAlignment( parser, strict ) );
1548                     }
1549                     else
1550                     {
1551                         checkUnknownElement( parser, strict );
1552                     }
1553                 }
1554             }
1555             else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) )
1556             {
1557                 repository.setScope( interpolatedTrimmed( parser.nextText(), "scope" ) );
1558             }
1559             else
1560             {
1561                 checkUnknownElement( parser, strict );
1562             }
1563         }
1564         return repository;
1565     } //-- Repository parseRepository( XmlPullParser, boolean )
1566 
1567     /**
1568      * Method parseUnpackOptions.
1569      * 
1570      * @param parser
1571      * @param strict
1572      * @throws IOException
1573      * @throws XmlPullParserException
1574      * @return UnpackOptions
1575      */
1576     private UnpackOptions parseUnpackOptions( XmlPullParser parser, boolean strict )
1577         throws IOException, XmlPullParserException
1578     {
1579         String tagName = parser.getName();
1580         UnpackOptions unpackOptions = new UnpackOptions();
1581         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1582         {
1583             String name = parser.getAttributeName( i );
1584             String value = parser.getAttributeValue( i );
1585 
1586             if ( name.indexOf( ':' ) >= 0 )
1587             {
1588                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1589             }
1590             else
1591             {
1592                 checkUnknownAttribute( parser, name, tagName, strict );
1593             }
1594         }
1595         java.util.Set parsed = new java.util.HashSet();
1596         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1597         {
1598             if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
1599             {
1600                 java.util.List includes = new java.util.ArrayList/*<String>*/();
1601                 unpackOptions.setIncludes( includes );
1602                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1603                 {
1604                     if ( "include".equals( parser.getName() ) )
1605                     {
1606                         includes.add( interpolatedTrimmed( parser.nextText(), "includes" ) );
1607                     }
1608                     else
1609                     {
1610                         checkUnknownElement( parser, strict );
1611                     }
1612                 }
1613             }
1614             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
1615             {
1616                 java.util.List excludes = new java.util.ArrayList/*<String>*/();
1617                 unpackOptions.setExcludes( excludes );
1618                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1619                 {
1620                     if ( "exclude".equals( parser.getName() ) )
1621                     {
1622                         excludes.add( interpolatedTrimmed( parser.nextText(), "excludes" ) );
1623                     }
1624                     else
1625                     {
1626                         checkUnknownElement( parser, strict );
1627                     }
1628                 }
1629             }
1630             else if ( checkFieldWithDuplicate( parser, "filtered", null, parsed ) )
1631             {
1632                 unpackOptions.setFiltered( getBooleanValue( interpolatedTrimmed( parser.nextText(), "filtered" ), "filtered", parser, "false" ) );
1633             }
1634             else if ( checkFieldWithDuplicate( parser, "lineEnding", null, parsed ) )
1635             {
1636                 unpackOptions.setLineEnding( interpolatedTrimmed( parser.nextText(), "lineEnding" ) );
1637             }
1638             else if ( checkFieldWithDuplicate( parser, "useDefaultExcludes", null, parsed ) )
1639             {
1640                 unpackOptions.setUseDefaultExcludes( getBooleanValue( interpolatedTrimmed( parser.nextText(), "useDefaultExcludes" ), "useDefaultExcludes", parser, "true" ) );
1641             }
1642             else if ( checkFieldWithDuplicate( parser, "encoding", null, parsed ) )
1643             {
1644                 unpackOptions.setEncoding( interpolatedTrimmed( parser.nextText(), "encoding" ) );
1645             }
1646             else
1647             {
1648                 checkUnknownElement( parser, strict );
1649             }
1650         }
1651         return unpackOptions;
1652     } //-- UnpackOptions parseUnpackOptions( XmlPullParser, boolean )
1653 
1654     /**
1655      * Method read.
1656      * 
1657      * @param parser
1658      * @param strict
1659      * @throws IOException
1660      * @throws XmlPullParserException
1661      * @return Component
1662      */
1663     private Component read( XmlPullParser parser, boolean strict )
1664         throws IOException, XmlPullParserException
1665     {
1666         int eventType = parser.getEventType();
1667         while ( eventType != XmlPullParser.END_DOCUMENT )
1668         {
1669             if ( eventType == XmlPullParser.START_TAG )
1670             {
1671                 if ( strict && ! "component".equals( parser.getName() ) )
1672                 {
1673                     throw new XmlPullParserException( "Expected root element 'component' but found '" + parser.getName() + "'", parser, null );
1674                 }
1675                 Component component = parseComponent( parser, strict );
1676                 component.setModelEncoding( parser.getInputEncoding() );
1677                 return component;
1678             }
1679             eventType = parser.next();
1680         }
1681         throw new XmlPullParserException( "Expected root element 'component' but found no element at all: invalid XML document", parser, null );
1682     } //-- Component read( XmlPullParser, boolean )
1683 
1684     /**
1685      * Sets the state of the "add default entities" flag.
1686      * 
1687      * @param addDefaultEntities
1688      */
1689     public void setAddDefaultEntities( boolean addDefaultEntities )
1690     {
1691         this.addDefaultEntities = addDefaultEntities;
1692     } //-- void setAddDefaultEntities( boolean )
1693 
1694     public static interface ContentTransformer
1695 {
1696     /**
1697      * Interpolate the value read from the xpp3 document
1698      * @param source The source value
1699      * @param fieldName A description of the field being interpolated. The implementation may use this to
1700      *                           log stuff.
1701      * @return The interpolated value.
1702      */
1703     String transform( String source, String fieldName );
1704 }
1705 
1706 }