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