View Javadoc

1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.7,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.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.model.Activation;
17  import org.apache.maven.model.ActivationFile;
18  import org.apache.maven.model.ActivationOS;
19  import org.apache.maven.model.ActivationProperty;
20  import org.apache.maven.model.Build;
21  import org.apache.maven.model.BuildBase;
22  import org.apache.maven.model.CiManagement;
23  import org.apache.maven.model.ConfigurationContainer;
24  import org.apache.maven.model.Contributor;
25  import org.apache.maven.model.Dependency;
26  import org.apache.maven.model.DependencyManagement;
27  import org.apache.maven.model.DeploymentRepository;
28  import org.apache.maven.model.Developer;
29  import org.apache.maven.model.DistributionManagement;
30  import org.apache.maven.model.Exclusion;
31  import org.apache.maven.model.Extension;
32  import org.apache.maven.model.FileSet;
33  import org.apache.maven.model.IssueManagement;
34  import org.apache.maven.model.License;
35  import org.apache.maven.model.MailingList;
36  import org.apache.maven.model.Model;
37  import org.apache.maven.model.ModelBase;
38  import org.apache.maven.model.Notifier;
39  import org.apache.maven.model.Organization;
40  import org.apache.maven.model.Parent;
41  import org.apache.maven.model.PatternSet;
42  import org.apache.maven.model.Plugin;
43  import org.apache.maven.model.PluginConfiguration;
44  import org.apache.maven.model.PluginContainer;
45  import org.apache.maven.model.PluginExecution;
46  import org.apache.maven.model.PluginManagement;
47  import org.apache.maven.model.Prerequisites;
48  import org.apache.maven.model.Profile;
49  import org.apache.maven.model.Relocation;
50  import org.apache.maven.model.ReportPlugin;
51  import org.apache.maven.model.ReportSet;
52  import org.apache.maven.model.Reporting;
53  import org.apache.maven.model.Repository;
54  import org.apache.maven.model.RepositoryBase;
55  import org.apache.maven.model.RepositoryPolicy;
56  import org.apache.maven.model.Resource;
57  import org.apache.maven.model.Scm;
58  import org.apache.maven.model.Site;
59  import org.codehaus.plexus.util.ReaderFactory;
60  import org.codehaus.plexus.util.xml.pull.MXParser;
61  import org.codehaus.plexus.util.xml.pull.XmlPullParser;
62  import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
63  
64  /**
65   * Class MavenXpp3Reader.
66   * 
67   * @version $Revision$ $Date$
68   */
69  @SuppressWarnings( "all" )
70  public class MavenXpp3Reader
71  {
72  
73        //--------------------------/
74       //- Class/Member Variables -/
75      //--------------------------/
76  
77      /**
78       * If set the parser will be loaded with all single characters
79       * from the XHTML specification.
80       * The entities used:
81       * <ul>
82       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li>
83       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li>
84       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li>
85       * </ul>
86       */
87      private boolean addDefaultEntities = true;
88  
89  
90        //-----------/
91       //- Methods -/
92      //-----------/
93  
94      /**
95       * Method checkFieldWithDuplicate.
96       * 
97       * @param parser
98       * @param parsed
99       * @param alias
100      * @param tagName
101      * @throws XmlPullParserException
102      * @return boolean
103      */
104     private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed )
105         throws XmlPullParserException
106     {
107         if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
108         {
109             return false;
110         }
111         if ( !parsed.add( tagName ) )
112         {
113             throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
114         }
115         return true;
116     } //-- boolean checkFieldWithDuplicate( XmlPullParser, String, String, java.util.Set )
117 
118     /**
119      * Method checkUnknownAttribute.
120      * 
121      * @param parser
122      * @param strict
123      * @param tagName
124      * @param attribute
125      * @throws XmlPullParserException
126      * @throws IOException
127      */
128     private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict )
129         throws XmlPullParserException, IOException
130     {
131         // strictXmlAttributes = true for model: if strict == true, not only elements are checked but attributes too
132         if ( strict )
133         {
134             throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null );
135         }
136     } //-- void checkUnknownAttribute( XmlPullParser, String, String, boolean )
137 
138     /**
139      * Method checkUnknownElement.
140      * 
141      * @param parser
142      * @param strict
143      * @throws XmlPullParserException
144      * @throws IOException
145      */
146     private void checkUnknownElement( XmlPullParser parser, boolean strict )
147         throws XmlPullParserException, IOException
148     {
149         if ( strict )
150         {
151             throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
152         }
153 
154         for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; )
155         {
156             int eventType = parser.next();
157             if ( eventType == XmlPullParser.START_TAG )
158             {
159                 unrecognizedTagCount++;
160             }
161             else if ( eventType == XmlPullParser.END_TAG )
162             {
163                 unrecognizedTagCount--;
164             }
165         }
166     } //-- void checkUnknownElement( XmlPullParser, boolean )
167 
168     /**
169      * Returns the state of the "add default entities" flag.
170      * 
171      * @return boolean
172      */
173     public boolean getAddDefaultEntities()
174     {
175         return addDefaultEntities;
176     } //-- boolean getAddDefaultEntities()
177 
178     /**
179      * Method getBooleanValue.
180      * 
181      * @param s
182      * @param parser
183      * @param attribute
184      * @throws XmlPullParserException
185      * @return boolean
186      */
187     private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
188         throws XmlPullParserException
189     {
190         return getBooleanValue( s, attribute, parser, null );
191     } //-- boolean getBooleanValue( String, String, XmlPullParser )
192 
193     /**
194      * Method getBooleanValue.
195      * 
196      * @param s
197      * @param defaultValue
198      * @param parser
199      * @param attribute
200      * @throws XmlPullParserException
201      * @return boolean
202      */
203     private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
204         throws XmlPullParserException
205     {
206         if ( s != null && s.length() != 0 )
207         {
208             return Boolean.valueOf( s ).booleanValue();
209         }
210         if ( defaultValue != null )
211         {
212             return Boolean.valueOf( defaultValue ).booleanValue();
213         }
214         return false;
215     } //-- boolean getBooleanValue( String, String, XmlPullParser, String )
216 
217     /**
218      * Method getByteValue.
219      * 
220      * @param s
221      * @param strict
222      * @param parser
223      * @param attribute
224      * @throws XmlPullParserException
225      * @return byte
226      */
227     private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
228         throws XmlPullParserException
229     {
230         if ( s != null )
231         {
232             try
233             {
234                 return Byte.valueOf( s ).byteValue();
235             }
236             catch ( NumberFormatException nfe )
237             {
238                 if ( strict )
239                 {
240                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe );
241                 }
242             }
243         }
244         return 0;
245     } //-- byte getByteValue( String, String, XmlPullParser, boolean )
246 
247     /**
248      * Method getCharacterValue.
249      * 
250      * @param s
251      * @param parser
252      * @param attribute
253      * @throws XmlPullParserException
254      * @return char
255      */
256     private char getCharacterValue( String s, String attribute, XmlPullParser parser )
257         throws XmlPullParserException
258     {
259         if ( s != null )
260         {
261             return s.charAt( 0 );
262         }
263         return 0;
264     } //-- char getCharacterValue( String, String, XmlPullParser )
265 
266     /**
267      * Method getDateValue.
268      * 
269      * @param s
270      * @param parser
271      * @param attribute
272      * @throws XmlPullParserException
273      * @return Date
274      */
275     private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
276         throws XmlPullParserException
277     {
278         return getDateValue( s, attribute, null, parser );
279     } //-- java.util.Date getDateValue( String, String, XmlPullParser )
280 
281     /**
282      * Method getDateValue.
283      * 
284      * @param s
285      * @param parser
286      * @param dateFormat
287      * @param attribute
288      * @throws XmlPullParserException
289      * @return Date
290      */
291     private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
292         throws XmlPullParserException
293     {
294         if ( s != null )
295         {
296             String effectiveDateFormat = dateFormat;
297             if ( dateFormat == null )
298             {
299                 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
300             }
301             if ( "long".equals( effectiveDateFormat ) )
302             {
303                 try
304                 {
305                     return new java.util.Date( Long.parseLong( s ) );
306                 }
307                 catch ( NumberFormatException e )
308                 {
309                     throw new XmlPullParserException( e.getMessage(), parser, e );
310                 }
311             }
312             else
313             {
314                 try
315                 {
316                     DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, java.util.Locale.US );
317                     return dateParser.parse( s );
318                 }
319                 catch ( java.text.ParseException e )
320                 {
321                     throw new XmlPullParserException( e.getMessage(), parser, e );
322                 }
323             }
324         }
325         return null;
326     } //-- java.util.Date getDateValue( String, String, String, XmlPullParser )
327 
328     /**
329      * Method getDoubleValue.
330      * 
331      * @param s
332      * @param strict
333      * @param parser
334      * @param attribute
335      * @throws XmlPullParserException
336      * @return double
337      */
338     private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
339         throws XmlPullParserException
340     {
341         if ( s != null )
342         {
343             try
344             {
345                 return Double.valueOf( s ).doubleValue();
346             }
347             catch ( NumberFormatException nfe )
348             {
349                 if ( strict )
350                 {
351                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
352                 }
353             }
354         }
355         return 0;
356     } //-- double getDoubleValue( String, String, XmlPullParser, boolean )
357 
358     /**
359      * Method getFloatValue.
360      * 
361      * @param s
362      * @param strict
363      * @param parser
364      * @param attribute
365      * @throws XmlPullParserException
366      * @return float
367      */
368     private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
369         throws XmlPullParserException
370     {
371         if ( s != null )
372         {
373             try
374             {
375                 return Float.valueOf( s ).floatValue();
376             }
377             catch ( NumberFormatException nfe )
378             {
379                 if ( strict )
380                 {
381                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
382                 }
383             }
384         }
385         return 0;
386     } //-- float getFloatValue( String, String, XmlPullParser, boolean )
387 
388     /**
389      * Method getIntegerValue.
390      * 
391      * @param s
392      * @param strict
393      * @param parser
394      * @param attribute
395      * @throws XmlPullParserException
396      * @return int
397      */
398     private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
399         throws XmlPullParserException
400     {
401         if ( s != null )
402         {
403             try
404             {
405                 return Integer.valueOf( s ).intValue();
406             }
407             catch ( NumberFormatException nfe )
408             {
409                 if ( strict )
410                 {
411                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe );
412                 }
413             }
414         }
415         return 0;
416     } //-- int getIntegerValue( String, String, XmlPullParser, boolean )
417 
418     /**
419      * Method getLongValue.
420      * 
421      * @param s
422      * @param strict
423      * @param parser
424      * @param attribute
425      * @throws XmlPullParserException
426      * @return long
427      */
428     private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
429         throws XmlPullParserException
430     {
431         if ( s != null )
432         {
433             try
434             {
435                 return Long.valueOf( s ).longValue();
436             }
437             catch ( NumberFormatException nfe )
438             {
439                 if ( strict )
440                 {
441                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe );
442                 }
443             }
444         }
445         return 0;
446     } //-- long getLongValue( String, String, XmlPullParser, boolean )
447 
448     /**
449      * Method getRequiredAttributeValue.
450      * 
451      * @param s
452      * @param strict
453      * @param parser
454      * @param attribute
455      * @throws XmlPullParserException
456      * @return String
457      */
458     private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
459         throws XmlPullParserException
460     {
461         if ( s == null )
462         {
463             if ( strict )
464             {
465                 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
466             }
467         }
468         return s;
469     } //-- String getRequiredAttributeValue( String, String, XmlPullParser, boolean )
470 
471     /**
472      * Method getShortValue.
473      * 
474      * @param s
475      * @param strict
476      * @param parser
477      * @param attribute
478      * @throws XmlPullParserException
479      * @return short
480      */
481     private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
482         throws XmlPullParserException
483     {
484         if ( s != null )
485         {
486             try
487             {
488                 return Short.valueOf( s ).shortValue();
489             }
490             catch ( NumberFormatException nfe )
491             {
492                 if ( strict )
493                 {
494                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe );
495                 }
496             }
497         }
498         return 0;
499     } //-- short getShortValue( String, String, XmlPullParser, boolean )
500 
501     /**
502      * Method getTrimmedValue.
503      * 
504      * @param s
505      * @return String
506      */
507     private String getTrimmedValue( String s )
508     {
509         if ( s != null )
510         {
511             s = s.trim();
512         }
513         return s;
514     } //-- String getTrimmedValue( String )
515 
516     /**
517      * Method initParser.
518      * 
519      * @param parser
520      * @throws XmlPullParserException
521      */
522     private void initParser( XmlPullParser parser )
523         throws XmlPullParserException
524     {
525         if ( addDefaultEntities )
526         {
527             // ----------------------------------------------------------------------
528             // Latin 1 entities
529             // ----------------------------------------------------------------------
530 
531             parser.defineEntityReplacementText( "nbsp", "\u00a0" );
532             parser.defineEntityReplacementText( "iexcl", "\u00a1" );
533             parser.defineEntityReplacementText( "cent", "\u00a2" );
534             parser.defineEntityReplacementText( "pound", "\u00a3" );
535             parser.defineEntityReplacementText( "curren", "\u00a4" );
536             parser.defineEntityReplacementText( "yen", "\u00a5" );
537             parser.defineEntityReplacementText( "brvbar", "\u00a6" );
538             parser.defineEntityReplacementText( "sect", "\u00a7" );
539             parser.defineEntityReplacementText( "uml", "\u00a8" );
540             parser.defineEntityReplacementText( "copy", "\u00a9" );
541             parser.defineEntityReplacementText( "ordf", "\u00aa" );
542             parser.defineEntityReplacementText( "laquo", "\u00ab" );
543             parser.defineEntityReplacementText( "not", "\u00ac" );
544             parser.defineEntityReplacementText( "shy", "\u00ad" );
545             parser.defineEntityReplacementText( "reg", "\u00ae" );
546             parser.defineEntityReplacementText( "macr", "\u00af" );
547             parser.defineEntityReplacementText( "deg", "\u00b0" );
548             parser.defineEntityReplacementText( "plusmn", "\u00b1" );
549             parser.defineEntityReplacementText( "sup2", "\u00b2" );
550             parser.defineEntityReplacementText( "sup3", "\u00b3" );
551             parser.defineEntityReplacementText( "acute", "\u00b4" );
552             parser.defineEntityReplacementText( "micro", "\u00b5" );
553             parser.defineEntityReplacementText( "para", "\u00b6" );
554             parser.defineEntityReplacementText( "middot", "\u00b7" );
555             parser.defineEntityReplacementText( "cedil", "\u00b8" );
556             parser.defineEntityReplacementText( "sup1", "\u00b9" );
557             parser.defineEntityReplacementText( "ordm", "\u00ba" );
558             parser.defineEntityReplacementText( "raquo", "\u00bb" );
559             parser.defineEntityReplacementText( "frac14", "\u00bc" );
560             parser.defineEntityReplacementText( "frac12", "\u00bd" );
561             parser.defineEntityReplacementText( "frac34", "\u00be" );
562             parser.defineEntityReplacementText( "iquest", "\u00bf" );
563             parser.defineEntityReplacementText( "Agrave", "\u00c0" );
564             parser.defineEntityReplacementText( "Aacute", "\u00c1" );
565             parser.defineEntityReplacementText( "Acirc", "\u00c2" );
566             parser.defineEntityReplacementText( "Atilde", "\u00c3" );
567             parser.defineEntityReplacementText( "Auml", "\u00c4" );
568             parser.defineEntityReplacementText( "Aring", "\u00c5" );
569             parser.defineEntityReplacementText( "AElig", "\u00c6" );
570             parser.defineEntityReplacementText( "Ccedil", "\u00c7" );
571             parser.defineEntityReplacementText( "Egrave", "\u00c8" );
572             parser.defineEntityReplacementText( "Eacute", "\u00c9" );
573             parser.defineEntityReplacementText( "Ecirc", "\u00ca" );
574             parser.defineEntityReplacementText( "Euml", "\u00cb" );
575             parser.defineEntityReplacementText( "Igrave", "\u00cc" );
576             parser.defineEntityReplacementText( "Iacute", "\u00cd" );
577             parser.defineEntityReplacementText( "Icirc", "\u00ce" );
578             parser.defineEntityReplacementText( "Iuml", "\u00cf" );
579             parser.defineEntityReplacementText( "ETH", "\u00d0" );
580             parser.defineEntityReplacementText( "Ntilde", "\u00d1" );
581             parser.defineEntityReplacementText( "Ograve", "\u00d2" );
582             parser.defineEntityReplacementText( "Oacute", "\u00d3" );
583             parser.defineEntityReplacementText( "Ocirc", "\u00d4" );
584             parser.defineEntityReplacementText( "Otilde", "\u00d5" );
585             parser.defineEntityReplacementText( "Ouml", "\u00d6" );
586             parser.defineEntityReplacementText( "times", "\u00d7" );
587             parser.defineEntityReplacementText( "Oslash", "\u00d8" );
588             parser.defineEntityReplacementText( "Ugrave", "\u00d9" );
589             parser.defineEntityReplacementText( "Uacute", "\u00da" );
590             parser.defineEntityReplacementText( "Ucirc", "\u00db" );
591             parser.defineEntityReplacementText( "Uuml", "\u00dc" );
592             parser.defineEntityReplacementText( "Yacute", "\u00dd" );
593             parser.defineEntityReplacementText( "THORN", "\u00de" );
594             parser.defineEntityReplacementText( "szlig", "\u00df" );
595             parser.defineEntityReplacementText( "agrave", "\u00e0" );
596             parser.defineEntityReplacementText( "aacute", "\u00e1" );
597             parser.defineEntityReplacementText( "acirc", "\u00e2" );
598             parser.defineEntityReplacementText( "atilde", "\u00e3" );
599             parser.defineEntityReplacementText( "auml", "\u00e4" );
600             parser.defineEntityReplacementText( "aring", "\u00e5" );
601             parser.defineEntityReplacementText( "aelig", "\u00e6" );
602             parser.defineEntityReplacementText( "ccedil", "\u00e7" );
603             parser.defineEntityReplacementText( "egrave", "\u00e8" );
604             parser.defineEntityReplacementText( "eacute", "\u00e9" );
605             parser.defineEntityReplacementText( "ecirc", "\u00ea" );
606             parser.defineEntityReplacementText( "euml", "\u00eb" );
607             parser.defineEntityReplacementText( "igrave", "\u00ec" );
608             parser.defineEntityReplacementText( "iacute", "\u00ed" );
609             parser.defineEntityReplacementText( "icirc", "\u00ee" );
610             parser.defineEntityReplacementText( "iuml", "\u00ef" );
611             parser.defineEntityReplacementText( "eth", "\u00f0" );
612             parser.defineEntityReplacementText( "ntilde", "\u00f1" );
613             parser.defineEntityReplacementText( "ograve", "\u00f2" );
614             parser.defineEntityReplacementText( "oacute", "\u00f3" );
615             parser.defineEntityReplacementText( "ocirc", "\u00f4" );
616             parser.defineEntityReplacementText( "otilde", "\u00f5" );
617             parser.defineEntityReplacementText( "ouml", "\u00f6" );
618             parser.defineEntityReplacementText( "divide", "\u00f7" );
619             parser.defineEntityReplacementText( "oslash", "\u00f8" );
620             parser.defineEntityReplacementText( "ugrave", "\u00f9" );
621             parser.defineEntityReplacementText( "uacute", "\u00fa" );
622             parser.defineEntityReplacementText( "ucirc", "\u00fb" );
623             parser.defineEntityReplacementText( "uuml", "\u00fc" );
624             parser.defineEntityReplacementText( "yacute", "\u00fd" );
625             parser.defineEntityReplacementText( "thorn", "\u00fe" );
626             parser.defineEntityReplacementText( "yuml", "\u00ff" );
627 
628             // ----------------------------------------------------------------------
629             // Special entities
630             // ----------------------------------------------------------------------
631 
632             parser.defineEntityReplacementText( "OElig", "\u0152" );
633             parser.defineEntityReplacementText( "oelig", "\u0153" );
634             parser.defineEntityReplacementText( "Scaron", "\u0160" );
635             parser.defineEntityReplacementText( "scaron", "\u0161" );
636             parser.defineEntityReplacementText( "Yuml", "\u0178" );
637             parser.defineEntityReplacementText( "circ", "\u02c6" );
638             parser.defineEntityReplacementText( "tilde", "\u02dc" );
639             parser.defineEntityReplacementText( "ensp", "\u2002" );
640             parser.defineEntityReplacementText( "emsp", "\u2003" );
641             parser.defineEntityReplacementText( "thinsp", "\u2009" );
642             parser.defineEntityReplacementText( "zwnj", "\u200c" );
643             parser.defineEntityReplacementText( "zwj", "\u200d" );
644             parser.defineEntityReplacementText( "lrm", "\u200e" );
645             parser.defineEntityReplacementText( "rlm", "\u200f" );
646             parser.defineEntityReplacementText( "ndash", "\u2013" );
647             parser.defineEntityReplacementText( "mdash", "\u2014" );
648             parser.defineEntityReplacementText( "lsquo", "\u2018" );
649             parser.defineEntityReplacementText( "rsquo", "\u2019" );
650             parser.defineEntityReplacementText( "sbquo", "\u201a" );
651             parser.defineEntityReplacementText( "ldquo", "\u201c" );
652             parser.defineEntityReplacementText( "rdquo", "\u201d" );
653             parser.defineEntityReplacementText( "bdquo", "\u201e" );
654             parser.defineEntityReplacementText( "dagger", "\u2020" );
655             parser.defineEntityReplacementText( "Dagger", "\u2021" );
656             parser.defineEntityReplacementText( "permil", "\u2030" );
657             parser.defineEntityReplacementText( "lsaquo", "\u2039" );
658             parser.defineEntityReplacementText( "rsaquo", "\u203a" );
659             parser.defineEntityReplacementText( "euro", "\u20ac" );
660 
661             // ----------------------------------------------------------------------
662             // Symbol entities
663             // ----------------------------------------------------------------------
664 
665             parser.defineEntityReplacementText( "fnof", "\u0192" );
666             parser.defineEntityReplacementText( "Alpha", "\u0391" );
667             parser.defineEntityReplacementText( "Beta", "\u0392" );
668             parser.defineEntityReplacementText( "Gamma", "\u0393" );
669             parser.defineEntityReplacementText( "Delta", "\u0394" );
670             parser.defineEntityReplacementText( "Epsilon", "\u0395" );
671             parser.defineEntityReplacementText( "Zeta", "\u0396" );
672             parser.defineEntityReplacementText( "Eta", "\u0397" );
673             parser.defineEntityReplacementText( "Theta", "\u0398" );
674             parser.defineEntityReplacementText( "Iota", "\u0399" );
675             parser.defineEntityReplacementText( "Kappa", "\u039a" );
676             parser.defineEntityReplacementText( "Lambda", "\u039b" );
677             parser.defineEntityReplacementText( "Mu", "\u039c" );
678             parser.defineEntityReplacementText( "Nu", "\u039d" );
679             parser.defineEntityReplacementText( "Xi", "\u039e" );
680             parser.defineEntityReplacementText( "Omicron", "\u039f" );
681             parser.defineEntityReplacementText( "Pi", "\u03a0" );
682             parser.defineEntityReplacementText( "Rho", "\u03a1" );
683             parser.defineEntityReplacementText( "Sigma", "\u03a3" );
684             parser.defineEntityReplacementText( "Tau", "\u03a4" );
685             parser.defineEntityReplacementText( "Upsilon", "\u03a5" );
686             parser.defineEntityReplacementText( "Phi", "\u03a6" );
687             parser.defineEntityReplacementText( "Chi", "\u03a7" );
688             parser.defineEntityReplacementText( "Psi", "\u03a8" );
689             parser.defineEntityReplacementText( "Omega", "\u03a9" );
690             parser.defineEntityReplacementText( "alpha", "\u03b1" );
691             parser.defineEntityReplacementText( "beta", "\u03b2" );
692             parser.defineEntityReplacementText( "gamma", "\u03b3" );
693             parser.defineEntityReplacementText( "delta", "\u03b4" );
694             parser.defineEntityReplacementText( "epsilon", "\u03b5" );
695             parser.defineEntityReplacementText( "zeta", "\u03b6" );
696             parser.defineEntityReplacementText( "eta", "\u03b7" );
697             parser.defineEntityReplacementText( "theta", "\u03b8" );
698             parser.defineEntityReplacementText( "iota", "\u03b9" );
699             parser.defineEntityReplacementText( "kappa", "\u03ba" );
700             parser.defineEntityReplacementText( "lambda", "\u03bb" );
701             parser.defineEntityReplacementText( "mu", "\u03bc" );
702             parser.defineEntityReplacementText( "nu", "\u03bd" );
703             parser.defineEntityReplacementText( "xi", "\u03be" );
704             parser.defineEntityReplacementText( "omicron", "\u03bf" );
705             parser.defineEntityReplacementText( "pi", "\u03c0" );
706             parser.defineEntityReplacementText( "rho", "\u03c1" );
707             parser.defineEntityReplacementText( "sigmaf", "\u03c2" );
708             parser.defineEntityReplacementText( "sigma", "\u03c3" );
709             parser.defineEntityReplacementText( "tau", "\u03c4" );
710             parser.defineEntityReplacementText( "upsilon", "\u03c5" );
711             parser.defineEntityReplacementText( "phi", "\u03c6" );
712             parser.defineEntityReplacementText( "chi", "\u03c7" );
713             parser.defineEntityReplacementText( "psi", "\u03c8" );
714             parser.defineEntityReplacementText( "omega", "\u03c9" );
715             parser.defineEntityReplacementText( "thetasym", "\u03d1" );
716             parser.defineEntityReplacementText( "upsih", "\u03d2" );
717             parser.defineEntityReplacementText( "piv", "\u03d6" );
718             parser.defineEntityReplacementText( "bull", "\u2022" );
719             parser.defineEntityReplacementText( "hellip", "\u2026" );
720             parser.defineEntityReplacementText( "prime", "\u2032" );
721             parser.defineEntityReplacementText( "Prime", "\u2033" );
722             parser.defineEntityReplacementText( "oline", "\u203e" );
723             parser.defineEntityReplacementText( "frasl", "\u2044" );
724             parser.defineEntityReplacementText( "weierp", "\u2118" );
725             parser.defineEntityReplacementText( "image", "\u2111" );
726             parser.defineEntityReplacementText( "real", "\u211c" );
727             parser.defineEntityReplacementText( "trade", "\u2122" );
728             parser.defineEntityReplacementText( "alefsym", "\u2135" );
729             parser.defineEntityReplacementText( "larr", "\u2190" );
730             parser.defineEntityReplacementText( "uarr", "\u2191" );
731             parser.defineEntityReplacementText( "rarr", "\u2192" );
732             parser.defineEntityReplacementText( "darr", "\u2193" );
733             parser.defineEntityReplacementText( "harr", "\u2194" );
734             parser.defineEntityReplacementText( "crarr", "\u21b5" );
735             parser.defineEntityReplacementText( "lArr", "\u21d0" );
736             parser.defineEntityReplacementText( "uArr", "\u21d1" );
737             parser.defineEntityReplacementText( "rArr", "\u21d2" );
738             parser.defineEntityReplacementText( "dArr", "\u21d3" );
739             parser.defineEntityReplacementText( "hArr", "\u21d4" );
740             parser.defineEntityReplacementText( "forall", "\u2200" );
741             parser.defineEntityReplacementText( "part", "\u2202" );
742             parser.defineEntityReplacementText( "exist", "\u2203" );
743             parser.defineEntityReplacementText( "empty", "\u2205" );
744             parser.defineEntityReplacementText( "nabla", "\u2207" );
745             parser.defineEntityReplacementText( "isin", "\u2208" );
746             parser.defineEntityReplacementText( "notin", "\u2209" );
747             parser.defineEntityReplacementText( "ni", "\u220b" );
748             parser.defineEntityReplacementText( "prod", "\u220f" );
749             parser.defineEntityReplacementText( "sum", "\u2211" );
750             parser.defineEntityReplacementText( "minus", "\u2212" );
751             parser.defineEntityReplacementText( "lowast", "\u2217" );
752             parser.defineEntityReplacementText( "radic", "\u221a" );
753             parser.defineEntityReplacementText( "prop", "\u221d" );
754             parser.defineEntityReplacementText( "infin", "\u221e" );
755             parser.defineEntityReplacementText( "ang", "\u2220" );
756             parser.defineEntityReplacementText( "and", "\u2227" );
757             parser.defineEntityReplacementText( "or", "\u2228" );
758             parser.defineEntityReplacementText( "cap", "\u2229" );
759             parser.defineEntityReplacementText( "cup", "\u222a" );
760             parser.defineEntityReplacementText( "int", "\u222b" );
761             parser.defineEntityReplacementText( "there4", "\u2234" );
762             parser.defineEntityReplacementText( "sim", "\u223c" );
763             parser.defineEntityReplacementText( "cong", "\u2245" );
764             parser.defineEntityReplacementText( "asymp", "\u2248" );
765             parser.defineEntityReplacementText( "ne", "\u2260" );
766             parser.defineEntityReplacementText( "equiv", "\u2261" );
767             parser.defineEntityReplacementText( "le", "\u2264" );
768             parser.defineEntityReplacementText( "ge", "\u2265" );
769             parser.defineEntityReplacementText( "sub", "\u2282" );
770             parser.defineEntityReplacementText( "sup", "\u2283" );
771             parser.defineEntityReplacementText( "nsub", "\u2284" );
772             parser.defineEntityReplacementText( "sube", "\u2286" );
773             parser.defineEntityReplacementText( "supe", "\u2287" );
774             parser.defineEntityReplacementText( "oplus", "\u2295" );
775             parser.defineEntityReplacementText( "otimes", "\u2297" );
776             parser.defineEntityReplacementText( "perp", "\u22a5" );
777             parser.defineEntityReplacementText( "sdot", "\u22c5" );
778             parser.defineEntityReplacementText( "lceil", "\u2308" );
779             parser.defineEntityReplacementText( "rceil", "\u2309" );
780             parser.defineEntityReplacementText( "lfloor", "\u230a" );
781             parser.defineEntityReplacementText( "rfloor", "\u230b" );
782             parser.defineEntityReplacementText( "lang", "\u2329" );
783             parser.defineEntityReplacementText( "rang", "\u232a" );
784             parser.defineEntityReplacementText( "loz", "\u25ca" );
785             parser.defineEntityReplacementText( "spades", "\u2660" );
786             parser.defineEntityReplacementText( "clubs", "\u2663" );
787             parser.defineEntityReplacementText( "hearts", "\u2665" );
788             parser.defineEntityReplacementText( "diams", "\u2666" );
789 
790         }
791     } //-- void initParser( XmlPullParser )
792 
793     /**
794      * Method nextTag.
795      * 
796      * @param parser
797      * @throws IOException
798      * @throws XmlPullParserException
799      * @return int
800      */
801     private int nextTag( XmlPullParser parser )
802         throws IOException, XmlPullParserException
803     {
804         int eventType = parser.next();
805         if ( eventType == XmlPullParser.TEXT )
806         {
807             eventType = parser.next();
808         }
809         if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG )
810         {
811             throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null );
812         }
813         return eventType;
814     } //-- int nextTag( XmlPullParser )
815 
816     /**
817      * @see ReaderFactory#newXmlReader
818      * 
819      * @param reader
820      * @param strict
821      * @throws IOException
822      * @throws XmlPullParserException
823      * @return Model
824      */
825     public Model read( Reader reader, boolean strict )
826         throws IOException, XmlPullParserException
827     {
828         XmlPullParser parser = new MXParser();
829 
830         parser.setInput( reader );
831 
832         initParser( parser );
833 
834         return read( parser, strict );
835     } //-- Model read( Reader, boolean )
836 
837     /**
838      * @see ReaderFactory#newXmlReader
839      * 
840      * @param reader
841      * @throws IOException
842      * @throws XmlPullParserException
843      * @return Model
844      */
845     public Model read( Reader reader )
846         throws IOException, XmlPullParserException
847     {
848         return read( reader, true );
849     } //-- Model read( Reader )
850 
851     /**
852      * Method read.
853      * 
854      * @param in
855      * @param strict
856      * @throws IOException
857      * @throws XmlPullParserException
858      * @return Model
859      */
860     public Model read( InputStream in, boolean strict )
861         throws IOException, XmlPullParserException
862     {
863         return read( ReaderFactory.newXmlReader( in ), strict );
864     } //-- Model read( InputStream, boolean )
865 
866     /**
867      * Method read.
868      * 
869      * @param in
870      * @throws IOException
871      * @throws XmlPullParserException
872      * @return Model
873      */
874     public Model read( InputStream in )
875         throws IOException, XmlPullParserException
876     {
877         return read( ReaderFactory.newXmlReader( in ) );
878     } //-- Model read( InputStream )
879 
880     /**
881      * Method parseActivation.
882      * 
883      * @param parser
884      * @param strict
885      * @throws IOException
886      * @throws XmlPullParserException
887      * @return Activation
888      */
889     private Activation parseActivation( XmlPullParser parser, boolean strict )
890         throws IOException, XmlPullParserException
891     {
892         String tagName = parser.getName();
893         Activation activation = new Activation();
894         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
895         {
896             String name = parser.getAttributeName( i );
897             String value = parser.getAttributeValue( i );
898 
899             if ( name.indexOf( ':' ) >= 0 )
900             {
901                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
902             }
903             else
904             {
905                 checkUnknownAttribute( parser, name, tagName, strict );
906             }
907         }
908         java.util.Set parsed = new java.util.HashSet();
909         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
910         {
911             if ( checkFieldWithDuplicate( parser, "activeByDefault", null, parsed ) )
912             {
913                 activation.setActiveByDefault( getBooleanValue( getTrimmedValue( parser.nextText() ), "activeByDefault", parser, "false" ) );
914             }
915             else if ( checkFieldWithDuplicate( parser, "jdk", null, parsed ) )
916             {
917                 activation.setJdk( getTrimmedValue( parser.nextText() ) );
918             }
919             else if ( checkFieldWithDuplicate( parser, "os", null, parsed ) )
920             {
921                 activation.setOs( parseActivationOS( parser, strict ) );
922             }
923             else if ( checkFieldWithDuplicate( parser, "property", null, parsed ) )
924             {
925                 activation.setProperty( parseActivationProperty( parser, strict ) );
926             }
927             else if ( checkFieldWithDuplicate( parser, "file", null, parsed ) )
928             {
929                 activation.setFile( parseActivationFile( parser, strict ) );
930             }
931             else
932             {
933                 checkUnknownElement( parser, strict );
934             }
935         }
936         return activation;
937     } //-- Activation parseActivation( XmlPullParser, boolean )
938 
939     /**
940      * Method parseActivationFile.
941      * 
942      * @param parser
943      * @param strict
944      * @throws IOException
945      * @throws XmlPullParserException
946      * @return ActivationFile
947      */
948     private ActivationFile parseActivationFile( XmlPullParser parser, boolean strict )
949         throws IOException, XmlPullParserException
950     {
951         String tagName = parser.getName();
952         ActivationFile activationFile = new ActivationFile();
953         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
954         {
955             String name = parser.getAttributeName( i );
956             String value = parser.getAttributeValue( i );
957 
958             if ( name.indexOf( ':' ) >= 0 )
959             {
960                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
961             }
962             else
963             {
964                 checkUnknownAttribute( parser, name, tagName, strict );
965             }
966         }
967         java.util.Set parsed = new java.util.HashSet();
968         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
969         {
970             if ( checkFieldWithDuplicate( parser, "missing", null, parsed ) )
971             {
972                 activationFile.setMissing( getTrimmedValue( parser.nextText() ) );
973             }
974             else if ( checkFieldWithDuplicate( parser, "exists", null, parsed ) )
975             {
976                 activationFile.setExists( getTrimmedValue( parser.nextText() ) );
977             }
978             else
979             {
980                 checkUnknownElement( parser, strict );
981             }
982         }
983         return activationFile;
984     } //-- ActivationFile parseActivationFile( XmlPullParser, boolean )
985 
986     /**
987      * Method parseActivationOS.
988      * 
989      * @param parser
990      * @param strict
991      * @throws IOException
992      * @throws XmlPullParserException
993      * @return ActivationOS
994      */
995     private ActivationOS parseActivationOS( XmlPullParser parser, boolean strict )
996         throws IOException, XmlPullParserException
997     {
998         String tagName = parser.getName();
999         ActivationOS activationOS = new ActivationOS();
1000         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1001         {
1002             String name = parser.getAttributeName( i );
1003             String value = parser.getAttributeValue( i );
1004 
1005             if ( name.indexOf( ':' ) >= 0 )
1006             {
1007                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1008             }
1009             else
1010             {
1011                 checkUnknownAttribute( parser, name, tagName, strict );
1012             }
1013         }
1014         java.util.Set parsed = new java.util.HashSet();
1015         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1016         {
1017             if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1018             {
1019                 activationOS.setName( getTrimmedValue( parser.nextText() ) );
1020             }
1021             else if ( checkFieldWithDuplicate( parser, "family", null, parsed ) )
1022             {
1023                 activationOS.setFamily( getTrimmedValue( parser.nextText() ) );
1024             }
1025             else if ( checkFieldWithDuplicate( parser, "arch", null, parsed ) )
1026             {
1027                 activationOS.setArch( getTrimmedValue( parser.nextText() ) );
1028             }
1029             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
1030             {
1031                 activationOS.setVersion( getTrimmedValue( parser.nextText() ) );
1032             }
1033             else
1034             {
1035                 checkUnknownElement( parser, strict );
1036             }
1037         }
1038         return activationOS;
1039     } //-- ActivationOS parseActivationOS( XmlPullParser, boolean )
1040 
1041     /**
1042      * Method parseActivationProperty.
1043      * 
1044      * @param parser
1045      * @param strict
1046      * @throws IOException
1047      * @throws XmlPullParserException
1048      * @return ActivationProperty
1049      */
1050     private ActivationProperty parseActivationProperty( XmlPullParser parser, boolean strict )
1051         throws IOException, XmlPullParserException
1052     {
1053         String tagName = parser.getName();
1054         ActivationProperty activationProperty = new ActivationProperty();
1055         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1056         {
1057             String name = parser.getAttributeName( i );
1058             String value = parser.getAttributeValue( i );
1059 
1060             if ( name.indexOf( ':' ) >= 0 )
1061             {
1062                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1063             }
1064             else
1065             {
1066                 checkUnknownAttribute( parser, name, tagName, strict );
1067             }
1068         }
1069         java.util.Set parsed = new java.util.HashSet();
1070         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1071         {
1072             if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1073             {
1074                 activationProperty.setName( getTrimmedValue( parser.nextText() ) );
1075             }
1076             else if ( checkFieldWithDuplicate( parser, "value", null, parsed ) )
1077             {
1078                 activationProperty.setValue( getTrimmedValue( parser.nextText() ) );
1079             }
1080             else
1081             {
1082                 checkUnknownElement( parser, strict );
1083             }
1084         }
1085         return activationProperty;
1086     } //-- ActivationProperty parseActivationProperty( XmlPullParser, boolean )
1087 
1088     /**
1089      * Method parseBuild.
1090      * 
1091      * @param parser
1092      * @param strict
1093      * @throws IOException
1094      * @throws XmlPullParserException
1095      * @return Build
1096      */
1097     private Build parseBuild( XmlPullParser parser, boolean strict )
1098         throws IOException, XmlPullParserException
1099     {
1100         String tagName = parser.getName();
1101         Build build = new Build();
1102         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1103         {
1104             String name = parser.getAttributeName( i );
1105             String value = parser.getAttributeValue( i );
1106 
1107             if ( name.indexOf( ':' ) >= 0 )
1108             {
1109                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1110             }
1111             else
1112             {
1113                 checkUnknownAttribute( parser, name, tagName, strict );
1114             }
1115         }
1116         java.util.Set parsed = new java.util.HashSet();
1117         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1118         {
1119             if ( checkFieldWithDuplicate( parser, "sourceDirectory", null, parsed ) )
1120             {
1121                 build.setSourceDirectory( getTrimmedValue( parser.nextText() ) );
1122             }
1123             else if ( checkFieldWithDuplicate( parser, "scriptSourceDirectory", null, parsed ) )
1124             {
1125                 build.setScriptSourceDirectory( getTrimmedValue( parser.nextText() ) );
1126             }
1127             else if ( checkFieldWithDuplicate( parser, "testSourceDirectory", null, parsed ) )
1128             {
1129                 build.setTestSourceDirectory( getTrimmedValue( parser.nextText() ) );
1130             }
1131             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
1132             {
1133                 build.setOutputDirectory( getTrimmedValue( parser.nextText() ) );
1134             }
1135             else if ( checkFieldWithDuplicate( parser, "testOutputDirectory", null, parsed ) )
1136             {
1137                 build.setTestOutputDirectory( getTrimmedValue( parser.nextText() ) );
1138             }
1139             else if ( checkFieldWithDuplicate( parser, "extensions", null, parsed ) )
1140             {
1141                 java.util.List extensions = new java.util.ArrayList/*<Extension>*/();
1142                 build.setExtensions( extensions );
1143                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1144                 {
1145                     if ( "extension".equals( parser.getName() ) )
1146                     {
1147                         extensions.add( parseExtension( parser, strict ) );
1148                     }
1149                     else
1150                     {
1151                         checkUnknownElement( parser, strict );
1152                     }
1153                 }
1154             }
1155             else if ( checkFieldWithDuplicate( parser, "defaultGoal", null, parsed ) )
1156             {
1157                 build.setDefaultGoal( getTrimmedValue( parser.nextText() ) );
1158             }
1159             else if ( checkFieldWithDuplicate( parser, "resources", null, parsed ) )
1160             {
1161                 java.util.List resources = new java.util.ArrayList/*<Resource>*/();
1162                 build.setResources( resources );
1163                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1164                 {
1165                     if ( "resource".equals( parser.getName() ) )
1166                     {
1167                         resources.add( parseResource( parser, strict ) );
1168                     }
1169                     else
1170                     {
1171                         checkUnknownElement( parser, strict );
1172                     }
1173                 }
1174             }
1175             else if ( checkFieldWithDuplicate( parser, "testResources", null, parsed ) )
1176             {
1177                 java.util.List testResources = new java.util.ArrayList/*<Resource>*/();
1178                 build.setTestResources( testResources );
1179                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1180                 {
1181                     if ( "testResource".equals( parser.getName() ) )
1182                     {
1183                         testResources.add( parseResource( parser, strict ) );
1184                     }
1185                     else
1186                     {
1187                         checkUnknownElement( parser, strict );
1188                     }
1189                 }
1190             }
1191             else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1192             {
1193                 build.setDirectory( getTrimmedValue( parser.nextText() ) );
1194             }
1195             else if ( checkFieldWithDuplicate( parser, "finalName", null, parsed ) )
1196             {
1197                 build.setFinalName( getTrimmedValue( parser.nextText() ) );
1198             }
1199             else if ( checkFieldWithDuplicate( parser, "filters", null, parsed ) )
1200             {
1201                 java.util.List filters = new java.util.ArrayList/*<String>*/();
1202                 build.setFilters( filters );
1203                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1204                 {
1205                     if ( "filter".equals( parser.getName() ) )
1206                     {
1207                         filters.add( getTrimmedValue( parser.nextText() ) );
1208                     }
1209                     else
1210                     {
1211                         checkUnknownElement( parser, strict );
1212                     }
1213                 }
1214             }
1215             else if ( checkFieldWithDuplicate( parser, "pluginManagement", null, parsed ) )
1216             {
1217                 build.setPluginManagement( parsePluginManagement( parser, strict ) );
1218             }
1219             else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
1220             {
1221                 java.util.List plugins = new java.util.ArrayList/*<Plugin>*/();
1222                 build.setPlugins( plugins );
1223                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1224                 {
1225                     if ( "plugin".equals( parser.getName() ) )
1226                     {
1227                         plugins.add( parsePlugin( parser, strict ) );
1228                     }
1229                     else
1230                     {
1231                         checkUnknownElement( parser, strict );
1232                     }
1233                 }
1234             }
1235             else
1236             {
1237                 checkUnknownElement( parser, strict );
1238             }
1239         }
1240         return build;
1241     } //-- Build parseBuild( XmlPullParser, boolean )
1242 
1243     /**
1244      * Method parseBuildBase.
1245      * 
1246      * @param parser
1247      * @param strict
1248      * @throws IOException
1249      * @throws XmlPullParserException
1250      * @return BuildBase
1251      */
1252     private BuildBase parseBuildBase( XmlPullParser parser, boolean strict )
1253         throws IOException, XmlPullParserException
1254     {
1255         String tagName = parser.getName();
1256         BuildBase buildBase = new BuildBase();
1257         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1258         {
1259             String name = parser.getAttributeName( i );
1260             String value = parser.getAttributeValue( i );
1261 
1262             if ( name.indexOf( ':' ) >= 0 )
1263             {
1264                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1265             }
1266             else
1267             {
1268                 checkUnknownAttribute( parser, name, tagName, strict );
1269             }
1270         }
1271         java.util.Set parsed = new java.util.HashSet();
1272         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1273         {
1274             if ( checkFieldWithDuplicate( parser, "defaultGoal", null, parsed ) )
1275             {
1276                 buildBase.setDefaultGoal( getTrimmedValue( parser.nextText() ) );
1277             }
1278             else if ( checkFieldWithDuplicate( parser, "resources", null, parsed ) )
1279             {
1280                 java.util.List resources = new java.util.ArrayList/*<Resource>*/();
1281                 buildBase.setResources( resources );
1282                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1283                 {
1284                     if ( "resource".equals( parser.getName() ) )
1285                     {
1286                         resources.add( parseResource( parser, strict ) );
1287                     }
1288                     else
1289                     {
1290                         checkUnknownElement( parser, strict );
1291                     }
1292                 }
1293             }
1294             else if ( checkFieldWithDuplicate( parser, "testResources", null, parsed ) )
1295             {
1296                 java.util.List testResources = new java.util.ArrayList/*<Resource>*/();
1297                 buildBase.setTestResources( testResources );
1298                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1299                 {
1300                     if ( "testResource".equals( parser.getName() ) )
1301                     {
1302                         testResources.add( parseResource( parser, strict ) );
1303                     }
1304                     else
1305                     {
1306                         checkUnknownElement( parser, strict );
1307                     }
1308                 }
1309             }
1310             else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
1311             {
1312                 buildBase.setDirectory( getTrimmedValue( parser.nextText() ) );
1313             }
1314             else if ( checkFieldWithDuplicate( parser, "finalName", null, parsed ) )
1315             {
1316                 buildBase.setFinalName( getTrimmedValue( parser.nextText() ) );
1317             }
1318             else if ( checkFieldWithDuplicate( parser, "filters", null, parsed ) )
1319             {
1320                 java.util.List filters = new java.util.ArrayList/*<String>*/();
1321                 buildBase.setFilters( filters );
1322                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1323                 {
1324                     if ( "filter".equals( parser.getName() ) )
1325                     {
1326                         filters.add( getTrimmedValue( parser.nextText() ) );
1327                     }
1328                     else
1329                     {
1330                         checkUnknownElement( parser, strict );
1331                     }
1332                 }
1333             }
1334             else if ( checkFieldWithDuplicate( parser, "pluginManagement", null, parsed ) )
1335             {
1336                 buildBase.setPluginManagement( parsePluginManagement( parser, strict ) );
1337             }
1338             else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
1339             {
1340                 java.util.List plugins = new java.util.ArrayList/*<Plugin>*/();
1341                 buildBase.setPlugins( plugins );
1342                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1343                 {
1344                     if ( "plugin".equals( parser.getName() ) )
1345                     {
1346                         plugins.add( parsePlugin( parser, strict ) );
1347                     }
1348                     else
1349                     {
1350                         checkUnknownElement( parser, strict );
1351                     }
1352                 }
1353             }
1354             else
1355             {
1356                 checkUnknownElement( parser, strict );
1357             }
1358         }
1359         return buildBase;
1360     } //-- BuildBase parseBuildBase( XmlPullParser, boolean )
1361 
1362     /**
1363      * Method parseCiManagement.
1364      * 
1365      * @param parser
1366      * @param strict
1367      * @throws IOException
1368      * @throws XmlPullParserException
1369      * @return CiManagement
1370      */
1371     private CiManagement parseCiManagement( XmlPullParser parser, boolean strict )
1372         throws IOException, XmlPullParserException
1373     {
1374         String tagName = parser.getName();
1375         CiManagement ciManagement = new CiManagement();
1376         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1377         {
1378             String name = parser.getAttributeName( i );
1379             String value = parser.getAttributeValue( i );
1380 
1381             if ( name.indexOf( ':' ) >= 0 )
1382             {
1383                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1384             }
1385             else
1386             {
1387                 checkUnknownAttribute( parser, name, tagName, strict );
1388             }
1389         }
1390         java.util.Set parsed = new java.util.HashSet();
1391         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1392         {
1393             if ( checkFieldWithDuplicate( parser, "system", null, parsed ) )
1394             {
1395                 ciManagement.setSystem( getTrimmedValue( parser.nextText() ) );
1396             }
1397             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1398             {
1399                 ciManagement.setUrl( getTrimmedValue( parser.nextText() ) );
1400             }
1401             else if ( checkFieldWithDuplicate( parser, "notifiers", null, parsed ) )
1402             {
1403                 java.util.List notifiers = new java.util.ArrayList/*<Notifier>*/();
1404                 ciManagement.setNotifiers( notifiers );
1405                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1406                 {
1407                     if ( "notifier".equals( parser.getName() ) )
1408                     {
1409                         notifiers.add( parseNotifier( parser, strict ) );
1410                     }
1411                     else
1412                     {
1413                         checkUnknownElement( parser, strict );
1414                     }
1415                 }
1416             }
1417             else
1418             {
1419                 checkUnknownElement( parser, strict );
1420             }
1421         }
1422         return ciManagement;
1423     } //-- CiManagement parseCiManagement( XmlPullParser, boolean )
1424 
1425     /**
1426      * Method parseConfigurationContainer.
1427      * 
1428      * @param parser
1429      * @param strict
1430      * @throws IOException
1431      * @throws XmlPullParserException
1432      * @return ConfigurationContainer
1433      */
1434     private ConfigurationContainer parseConfigurationContainer( XmlPullParser parser, boolean strict )
1435         throws IOException, XmlPullParserException
1436     {
1437         String tagName = parser.getName();
1438         ConfigurationContainer configurationContainer = new ConfigurationContainer();
1439         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1440         {
1441             String name = parser.getAttributeName( i );
1442             String value = parser.getAttributeValue( i );
1443 
1444             if ( name.indexOf( ':' ) >= 0 )
1445             {
1446                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1447             }
1448             else
1449             {
1450                 checkUnknownAttribute( parser, name, tagName, strict );
1451             }
1452         }
1453         java.util.Set parsed = new java.util.HashSet();
1454         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1455         {
1456             if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
1457             {
1458                 configurationContainer.setInherited( getTrimmedValue( parser.nextText() ) );
1459             }
1460             else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
1461             {
1462                 configurationContainer.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
1463             }
1464             else
1465             {
1466                 checkUnknownElement( parser, strict );
1467             }
1468         }
1469         return configurationContainer;
1470     } //-- ConfigurationContainer parseConfigurationContainer( XmlPullParser, boolean )
1471 
1472     /**
1473      * Method parseContributor.
1474      * 
1475      * @param parser
1476      * @param strict
1477      * @throws IOException
1478      * @throws XmlPullParserException
1479      * @return Contributor
1480      */
1481     private Contributor parseContributor( XmlPullParser parser, boolean strict )
1482         throws IOException, XmlPullParserException
1483     {
1484         String tagName = parser.getName();
1485         Contributor contributor = new Contributor();
1486         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1487         {
1488             String name = parser.getAttributeName( i );
1489             String value = parser.getAttributeValue( i );
1490 
1491             if ( name.indexOf( ':' ) >= 0 )
1492             {
1493                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1494             }
1495             else
1496             {
1497                 checkUnknownAttribute( parser, name, tagName, strict );
1498             }
1499         }
1500         java.util.Set parsed = new java.util.HashSet();
1501         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1502         {
1503             if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1504             {
1505                 contributor.setName( getTrimmedValue( parser.nextText() ) );
1506             }
1507             else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
1508             {
1509                 contributor.setEmail( getTrimmedValue( parser.nextText() ) );
1510             }
1511             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1512             {
1513                 contributor.setUrl( getTrimmedValue( parser.nextText() ) );
1514             }
1515             else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
1516             {
1517                 contributor.setOrganization( getTrimmedValue( parser.nextText() ) );
1518             }
1519             else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
1520             {
1521                 contributor.setOrganizationUrl( getTrimmedValue( parser.nextText() ) );
1522             }
1523             else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
1524             {
1525                 java.util.List roles = new java.util.ArrayList/*<String>*/();
1526                 contributor.setRoles( roles );
1527                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1528                 {
1529                     if ( "role".equals( parser.getName() ) )
1530                     {
1531                         roles.add( getTrimmedValue( parser.nextText() ) );
1532                     }
1533                     else
1534                     {
1535                         checkUnknownElement( parser, strict );
1536                     }
1537                 }
1538             }
1539             else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
1540             {
1541                 contributor.setTimezone( getTrimmedValue( parser.nextText() ) );
1542             }
1543             else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
1544             {
1545                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1546                 {
1547                     String key = parser.getName();
1548                     String value = parser.nextText().trim();
1549                     contributor.addProperty( key, value );
1550                 }
1551             }
1552             else
1553             {
1554                 checkUnknownElement( parser, strict );
1555             }
1556         }
1557         return contributor;
1558     } //-- Contributor parseContributor( XmlPullParser, boolean )
1559 
1560     /**
1561      * Method parseDependency.
1562      * 
1563      * @param parser
1564      * @param strict
1565      * @throws IOException
1566      * @throws XmlPullParserException
1567      * @return Dependency
1568      */
1569     private Dependency parseDependency( XmlPullParser parser, boolean strict )
1570         throws IOException, XmlPullParserException
1571     {
1572         String tagName = parser.getName();
1573         Dependency dependency = new Dependency();
1574         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1575         {
1576             String name = parser.getAttributeName( i );
1577             String value = parser.getAttributeValue( i );
1578 
1579             if ( name.indexOf( ':' ) >= 0 )
1580             {
1581                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1582             }
1583             else
1584             {
1585                 checkUnknownAttribute( parser, name, tagName, strict );
1586             }
1587         }
1588         java.util.Set parsed = new java.util.HashSet();
1589         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1590         {
1591             if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
1592             {
1593                 dependency.setGroupId( getTrimmedValue( parser.nextText() ) );
1594             }
1595             else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
1596             {
1597                 dependency.setArtifactId( getTrimmedValue( parser.nextText() ) );
1598             }
1599             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
1600             {
1601                 dependency.setVersion( getTrimmedValue( parser.nextText() ) );
1602             }
1603             else if ( checkFieldWithDuplicate( parser, "type", null, parsed ) )
1604             {
1605                 dependency.setType( getTrimmedValue( parser.nextText() ) );
1606             }
1607             else if ( checkFieldWithDuplicate( parser, "classifier", null, parsed ) )
1608             {
1609                 dependency.setClassifier( getTrimmedValue( parser.nextText() ) );
1610             }
1611             else if ( checkFieldWithDuplicate( parser, "scope", null, parsed ) )
1612             {
1613                 dependency.setScope( getTrimmedValue( parser.nextText() ) );
1614             }
1615             else if ( checkFieldWithDuplicate( parser, "systemPath", null, parsed ) )
1616             {
1617                 dependency.setSystemPath( getTrimmedValue( parser.nextText() ) );
1618             }
1619             else if ( checkFieldWithDuplicate( parser, "exclusions", null, parsed ) )
1620             {
1621                 java.util.List exclusions = new java.util.ArrayList/*<Exclusion>*/();
1622                 dependency.setExclusions( exclusions );
1623                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1624                 {
1625                     if ( "exclusion".equals( parser.getName() ) )
1626                     {
1627                         exclusions.add( parseExclusion( parser, strict ) );
1628                     }
1629                     else
1630                     {
1631                         checkUnknownElement( parser, strict );
1632                     }
1633                 }
1634             }
1635             else if ( checkFieldWithDuplicate( parser, "optional", null, parsed ) )
1636             {
1637                 dependency.setOptional( getTrimmedValue( parser.nextText() ) );
1638             }
1639             else
1640             {
1641                 checkUnknownElement( parser, strict );
1642             }
1643         }
1644         return dependency;
1645     } //-- Dependency parseDependency( XmlPullParser, boolean )
1646 
1647     /**
1648      * Method parseDependencyManagement.
1649      * 
1650      * @param parser
1651      * @param strict
1652      * @throws IOException
1653      * @throws XmlPullParserException
1654      * @return DependencyManagement
1655      */
1656     private DependencyManagement parseDependencyManagement( XmlPullParser parser, boolean strict )
1657         throws IOException, XmlPullParserException
1658     {
1659         String tagName = parser.getName();
1660         DependencyManagement dependencyManagement = new DependencyManagement();
1661         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1662         {
1663             String name = parser.getAttributeName( i );
1664             String value = parser.getAttributeValue( i );
1665 
1666             if ( name.indexOf( ':' ) >= 0 )
1667             {
1668                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1669             }
1670             else
1671             {
1672                 checkUnknownAttribute( parser, name, tagName, strict );
1673             }
1674         }
1675         java.util.Set parsed = new java.util.HashSet();
1676         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1677         {
1678             if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
1679             {
1680                 java.util.List dependencies = new java.util.ArrayList/*<Dependency>*/();
1681                 dependencyManagement.setDependencies( dependencies );
1682                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1683                 {
1684                     if ( "dependency".equals( parser.getName() ) )
1685                     {
1686                         dependencies.add( parseDependency( parser, strict ) );
1687                     }
1688                     else
1689                     {
1690                         checkUnknownElement( parser, strict );
1691                     }
1692                 }
1693             }
1694             else
1695             {
1696                 checkUnknownElement( parser, strict );
1697             }
1698         }
1699         return dependencyManagement;
1700     } //-- DependencyManagement parseDependencyManagement( XmlPullParser, boolean )
1701 
1702     /**
1703      * Method parseDeploymentRepository.
1704      * 
1705      * @param parser
1706      * @param strict
1707      * @throws IOException
1708      * @throws XmlPullParserException
1709      * @return DeploymentRepository
1710      */
1711     private DeploymentRepository parseDeploymentRepository( XmlPullParser parser, boolean strict )
1712         throws IOException, XmlPullParserException
1713     {
1714         String tagName = parser.getName();
1715         DeploymentRepository deploymentRepository = new DeploymentRepository();
1716         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1717         {
1718             String name = parser.getAttributeName( i );
1719             String value = parser.getAttributeValue( i );
1720 
1721             if ( name.indexOf( ':' ) >= 0 )
1722             {
1723                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1724             }
1725             else
1726             {
1727                 checkUnknownAttribute( parser, name, tagName, strict );
1728             }
1729         }
1730         java.util.Set parsed = new java.util.HashSet();
1731         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1732         {
1733             if ( checkFieldWithDuplicate( parser, "uniqueVersion", null, parsed ) )
1734             {
1735                 deploymentRepository.setUniqueVersion( getBooleanValue( getTrimmedValue( parser.nextText() ), "uniqueVersion", parser, "true" ) );
1736             }
1737             else if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) )
1738             {
1739                 deploymentRepository.setReleases( parseRepositoryPolicy( parser, strict ) );
1740             }
1741             else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) )
1742             {
1743                 deploymentRepository.setSnapshots( parseRepositoryPolicy( parser, strict ) );
1744             }
1745             else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1746             {
1747                 deploymentRepository.setId( getTrimmedValue( parser.nextText() ) );
1748             }
1749             else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1750             {
1751                 deploymentRepository.setName( getTrimmedValue( parser.nextText() ) );
1752             }
1753             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1754             {
1755                 deploymentRepository.setUrl( getTrimmedValue( parser.nextText() ) );
1756             }
1757             else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
1758             {
1759                 deploymentRepository.setLayout( getTrimmedValue( parser.nextText() ) );
1760             }
1761             else
1762             {
1763                 checkUnknownElement( parser, strict );
1764             }
1765         }
1766         return deploymentRepository;
1767     } //-- DeploymentRepository parseDeploymentRepository( XmlPullParser, boolean )
1768 
1769     /**
1770      * Method parseDeveloper.
1771      * 
1772      * @param parser
1773      * @param strict
1774      * @throws IOException
1775      * @throws XmlPullParserException
1776      * @return Developer
1777      */
1778     private Developer parseDeveloper( XmlPullParser parser, boolean strict )
1779         throws IOException, XmlPullParserException
1780     {
1781         String tagName = parser.getName();
1782         Developer developer = new Developer();
1783         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1784         {
1785             String name = parser.getAttributeName( i );
1786             String value = parser.getAttributeValue( i );
1787 
1788             if ( name.indexOf( ':' ) >= 0 )
1789             {
1790                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1791             }
1792             else
1793             {
1794                 checkUnknownAttribute( parser, name, tagName, strict );
1795             }
1796         }
1797         java.util.Set parsed = new java.util.HashSet();
1798         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1799         {
1800             if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1801             {
1802                 developer.setId( getTrimmedValue( parser.nextText() ) );
1803             }
1804             else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1805             {
1806                 developer.setName( getTrimmedValue( parser.nextText() ) );
1807             }
1808             else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
1809             {
1810                 developer.setEmail( getTrimmedValue( parser.nextText() ) );
1811             }
1812             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1813             {
1814                 developer.setUrl( getTrimmedValue( parser.nextText() ) );
1815             }
1816             else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
1817             {
1818                 developer.setOrganization( getTrimmedValue( parser.nextText() ) );
1819             }
1820             else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
1821             {
1822                 developer.setOrganizationUrl( getTrimmedValue( parser.nextText() ) );
1823             }
1824             else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
1825             {
1826                 java.util.List roles = new java.util.ArrayList/*<String>*/();
1827                 developer.setRoles( roles );
1828                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1829                 {
1830                     if ( "role".equals( parser.getName() ) )
1831                     {
1832                         roles.add( getTrimmedValue( parser.nextText() ) );
1833                     }
1834                     else
1835                     {
1836                         checkUnknownElement( parser, strict );
1837                     }
1838                 }
1839             }
1840             else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
1841             {
1842                 developer.setTimezone( getTrimmedValue( parser.nextText() ) );
1843             }
1844             else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
1845             {
1846                 while ( parser.nextTag() == XmlPullParser.START_TAG )
1847                 {
1848                     String key = parser.getName();
1849                     String value = parser.nextText().trim();
1850                     developer.addProperty( key, value );
1851                 }
1852             }
1853             else
1854             {
1855                 checkUnknownElement( parser, strict );
1856             }
1857         }
1858         return developer;
1859     } //-- Developer parseDeveloper( XmlPullParser, boolean )
1860 
1861     /**
1862      * Method parseDistributionManagement.
1863      * 
1864      * @param parser
1865      * @param strict
1866      * @throws IOException
1867      * @throws XmlPullParserException
1868      * @return DistributionManagement
1869      */
1870     private DistributionManagement parseDistributionManagement( XmlPullParser parser, boolean strict )
1871         throws IOException, XmlPullParserException
1872     {
1873         String tagName = parser.getName();
1874         DistributionManagement distributionManagement = new DistributionManagement();
1875         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1876         {
1877             String name = parser.getAttributeName( i );
1878             String value = parser.getAttributeValue( i );
1879 
1880             if ( name.indexOf( ':' ) >= 0 )
1881             {
1882                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1883             }
1884             else
1885             {
1886                 checkUnknownAttribute( parser, name, tagName, strict );
1887             }
1888         }
1889         java.util.Set parsed = new java.util.HashSet();
1890         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1891         {
1892             if ( checkFieldWithDuplicate( parser, "repository", null, parsed ) )
1893             {
1894                 distributionManagement.setRepository( parseDeploymentRepository( parser, strict ) );
1895             }
1896             else if ( checkFieldWithDuplicate( parser, "snapshotRepository", null, parsed ) )
1897             {
1898                 distributionManagement.setSnapshotRepository( parseDeploymentRepository( parser, strict ) );
1899             }
1900             else if ( checkFieldWithDuplicate( parser, "site", null, parsed ) )
1901             {
1902                 distributionManagement.setSite( parseSite( parser, strict ) );
1903             }
1904             else if ( checkFieldWithDuplicate( parser, "downloadUrl", null, parsed ) )
1905             {
1906                 distributionManagement.setDownloadUrl( getTrimmedValue( parser.nextText() ) );
1907             }
1908             else if ( checkFieldWithDuplicate( parser, "relocation", null, parsed ) )
1909             {
1910                 distributionManagement.setRelocation( parseRelocation( parser, strict ) );
1911             }
1912             else if ( checkFieldWithDuplicate( parser, "status", null, parsed ) )
1913             {
1914                 distributionManagement.setStatus( getTrimmedValue( parser.nextText() ) );
1915             }
1916             else
1917             {
1918                 checkUnknownElement( parser, strict );
1919             }
1920         }
1921         return distributionManagement;
1922     } //-- DistributionManagement parseDistributionManagement( XmlPullParser, boolean )
1923 
1924     /**
1925      * Method parseExclusion.
1926      * 
1927      * @param parser
1928      * @param strict
1929      * @throws IOException
1930      * @throws XmlPullParserException
1931      * @return Exclusion
1932      */
1933     private Exclusion parseExclusion( XmlPullParser parser, boolean strict )
1934         throws IOException, XmlPullParserException
1935     {
1936         String tagName = parser.getName();
1937         Exclusion exclusion = new Exclusion();
1938         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1939         {
1940             String name = parser.getAttributeName( i );
1941             String value = parser.getAttributeValue( i );
1942 
1943             if ( name.indexOf( ':' ) >= 0 )
1944             {
1945                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1946             }
1947             else
1948             {
1949                 checkUnknownAttribute( parser, name, tagName, strict );
1950             }
1951         }
1952         java.util.Set parsed = new java.util.HashSet();
1953         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1954         {
1955             if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
1956             {
1957                 exclusion.setArtifactId( getTrimmedValue( parser.nextText() ) );
1958             }
1959             else if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
1960             {
1961                 exclusion.setGroupId( getTrimmedValue( parser.nextText() ) );
1962             }
1963             else
1964             {
1965                 checkUnknownElement( parser, strict );
1966             }
1967         }
1968         return exclusion;
1969     } //-- Exclusion parseExclusion( XmlPullParser, boolean )
1970 
1971     /**
1972      * Method parseExtension.
1973      * 
1974      * @param parser
1975      * @param strict
1976      * @throws IOException
1977      * @throws XmlPullParserException
1978      * @return Extension
1979      */
1980     private Extension parseExtension( XmlPullParser parser, boolean strict )
1981         throws IOException, XmlPullParserException
1982     {
1983         String tagName = parser.getName();
1984         Extension extension = new Extension();
1985         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1986         {
1987             String name = parser.getAttributeName( i );
1988             String value = parser.getAttributeValue( i );
1989 
1990             if ( name.indexOf( ':' ) >= 0 )
1991             {
1992                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1993             }
1994             else
1995             {
1996                 checkUnknownAttribute( parser, name, tagName, strict );
1997             }
1998         }
1999         java.util.Set parsed = new java.util.HashSet();
2000         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2001         {
2002             if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2003             {
2004                 extension.setGroupId( getTrimmedValue( parser.nextText() ) );
2005             }
2006             else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2007             {
2008                 extension.setArtifactId( getTrimmedValue( parser.nextText() ) );
2009             }
2010             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2011             {
2012                 extension.setVersion( getTrimmedValue( parser.nextText() ) );
2013             }
2014             else
2015             {
2016                 checkUnknownElement( parser, strict );
2017             }
2018         }
2019         return extension;
2020     } //-- Extension parseExtension( XmlPullParser, boolean )
2021 
2022     /**
2023      * Method parseFileSet.
2024      * 
2025      * @param parser
2026      * @param strict
2027      * @throws IOException
2028      * @throws XmlPullParserException
2029      * @return FileSet
2030      */
2031     private FileSet parseFileSet( XmlPullParser parser, boolean strict )
2032         throws IOException, XmlPullParserException
2033     {
2034         String tagName = parser.getName();
2035         FileSet fileSet = new FileSet();
2036         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2037         {
2038             String name = parser.getAttributeName( i );
2039             String value = parser.getAttributeValue( i );
2040 
2041             if ( name.indexOf( ':' ) >= 0 )
2042             {
2043                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2044             }
2045             else
2046             {
2047                 checkUnknownAttribute( parser, name, tagName, strict );
2048             }
2049         }
2050         java.util.Set parsed = new java.util.HashSet();
2051         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2052         {
2053             if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
2054             {
2055                 fileSet.setDirectory( getTrimmedValue( parser.nextText() ) );
2056             }
2057             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
2058             {
2059                 java.util.List includes = new java.util.ArrayList/*<String>*/();
2060                 fileSet.setIncludes( includes );
2061                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2062                 {
2063                     if ( "include".equals( parser.getName() ) )
2064                     {
2065                         includes.add( getTrimmedValue( parser.nextText() ) );
2066                     }
2067                     else
2068                     {
2069                         checkUnknownElement( parser, strict );
2070                     }
2071                 }
2072             }
2073             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
2074             {
2075                 java.util.List excludes = new java.util.ArrayList/*<String>*/();
2076                 fileSet.setExcludes( excludes );
2077                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2078                 {
2079                     if ( "exclude".equals( parser.getName() ) )
2080                     {
2081                         excludes.add( getTrimmedValue( parser.nextText() ) );
2082                     }
2083                     else
2084                     {
2085                         checkUnknownElement( parser, strict );
2086                     }
2087                 }
2088             }
2089             else
2090             {
2091                 checkUnknownElement( parser, strict );
2092             }
2093         }
2094         return fileSet;
2095     } //-- FileSet parseFileSet( XmlPullParser, boolean )
2096 
2097     /**
2098      * Method parseIssueManagement.
2099      * 
2100      * @param parser
2101      * @param strict
2102      * @throws IOException
2103      * @throws XmlPullParserException
2104      * @return IssueManagement
2105      */
2106     private IssueManagement parseIssueManagement( XmlPullParser parser, boolean strict )
2107         throws IOException, XmlPullParserException
2108     {
2109         String tagName = parser.getName();
2110         IssueManagement issueManagement = new IssueManagement();
2111         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2112         {
2113             String name = parser.getAttributeName( i );
2114             String value = parser.getAttributeValue( i );
2115 
2116             if ( name.indexOf( ':' ) >= 0 )
2117             {
2118                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2119             }
2120             else
2121             {
2122                 checkUnknownAttribute( parser, name, tagName, strict );
2123             }
2124         }
2125         java.util.Set parsed = new java.util.HashSet();
2126         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2127         {
2128             if ( checkFieldWithDuplicate( parser, "system", null, parsed ) )
2129             {
2130                 issueManagement.setSystem( getTrimmedValue( parser.nextText() ) );
2131             }
2132             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2133             {
2134                 issueManagement.setUrl( getTrimmedValue( parser.nextText() ) );
2135             }
2136             else
2137             {
2138                 checkUnknownElement( parser, strict );
2139             }
2140         }
2141         return issueManagement;
2142     } //-- IssueManagement parseIssueManagement( XmlPullParser, boolean )
2143 
2144     /**
2145      * Method parseLicense.
2146      * 
2147      * @param parser
2148      * @param strict
2149      * @throws IOException
2150      * @throws XmlPullParserException
2151      * @return License
2152      */
2153     private License parseLicense( XmlPullParser parser, boolean strict )
2154         throws IOException, XmlPullParserException
2155     {
2156         String tagName = parser.getName();
2157         License license = new License();
2158         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2159         {
2160             String name = parser.getAttributeName( i );
2161             String value = parser.getAttributeValue( i );
2162 
2163             if ( name.indexOf( ':' ) >= 0 )
2164             {
2165                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2166             }
2167             else
2168             {
2169                 checkUnknownAttribute( parser, name, tagName, strict );
2170             }
2171         }
2172         java.util.Set parsed = new java.util.HashSet();
2173         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2174         {
2175             if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2176             {
2177                 license.setName( getTrimmedValue( parser.nextText() ) );
2178             }
2179             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2180             {
2181                 license.setUrl( getTrimmedValue( parser.nextText() ) );
2182             }
2183             else if ( checkFieldWithDuplicate( parser, "distribution", null, parsed ) )
2184             {
2185                 license.setDistribution( getTrimmedValue( parser.nextText() ) );
2186             }
2187             else if ( checkFieldWithDuplicate( parser, "comments", null, parsed ) )
2188             {
2189                 license.setComments( getTrimmedValue( parser.nextText() ) );
2190             }
2191             else
2192             {
2193                 checkUnknownElement( parser, strict );
2194             }
2195         }
2196         return license;
2197     } //-- License parseLicense( XmlPullParser, boolean )
2198 
2199     /**
2200      * Method parseMailingList.
2201      * 
2202      * @param parser
2203      * @param strict
2204      * @throws IOException
2205      * @throws XmlPullParserException
2206      * @return MailingList
2207      */
2208     private MailingList parseMailingList( XmlPullParser parser, boolean strict )
2209         throws IOException, XmlPullParserException
2210     {
2211         String tagName = parser.getName();
2212         MailingList mailingList = new MailingList();
2213         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2214         {
2215             String name = parser.getAttributeName( i );
2216             String value = parser.getAttributeValue( i );
2217 
2218             if ( name.indexOf( ':' ) >= 0 )
2219             {
2220                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2221             }
2222             else
2223             {
2224                 checkUnknownAttribute( parser, name, tagName, strict );
2225             }
2226         }
2227         java.util.Set parsed = new java.util.HashSet();
2228         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2229         {
2230             if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2231             {
2232                 mailingList.setName( getTrimmedValue( parser.nextText() ) );
2233             }
2234             else if ( checkFieldWithDuplicate( parser, "subscribe", null, parsed ) )
2235             {
2236                 mailingList.setSubscribe( getTrimmedValue( parser.nextText() ) );
2237             }
2238             else if ( checkFieldWithDuplicate( parser, "unsubscribe", null, parsed ) )
2239             {
2240                 mailingList.setUnsubscribe( getTrimmedValue( parser.nextText() ) );
2241             }
2242             else if ( checkFieldWithDuplicate( parser, "post", null, parsed ) )
2243             {
2244                 mailingList.setPost( getTrimmedValue( parser.nextText() ) );
2245             }
2246             else if ( checkFieldWithDuplicate( parser, "archive", null, parsed ) )
2247             {
2248                 mailingList.setArchive( getTrimmedValue( parser.nextText() ) );
2249             }
2250             else if ( checkFieldWithDuplicate( parser, "otherArchives", null, parsed ) )
2251             {
2252                 java.util.List otherArchives = new java.util.ArrayList/*<String>*/();
2253                 mailingList.setOtherArchives( otherArchives );
2254                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2255                 {
2256                     if ( "otherArchive".equals( parser.getName() ) )
2257                     {
2258                         otherArchives.add( getTrimmedValue( parser.nextText() ) );
2259                     }
2260                     else
2261                     {
2262                         checkUnknownElement( parser, strict );
2263                     }
2264                 }
2265             }
2266             else
2267             {
2268                 checkUnknownElement( parser, strict );
2269             }
2270         }
2271         return mailingList;
2272     } //-- MailingList parseMailingList( XmlPullParser, boolean )
2273 
2274     /**
2275      * Method parseModel.
2276      * 
2277      * @param parser
2278      * @param strict
2279      * @throws IOException
2280      * @throws XmlPullParserException
2281      * @return Model
2282      */
2283     private Model parseModel( XmlPullParser parser, boolean strict )
2284         throws IOException, XmlPullParserException
2285     {
2286         String tagName = parser.getName();
2287         Model model = new Model();
2288         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2289         {
2290             String name = parser.getAttributeName( i );
2291             String value = parser.getAttributeValue( i );
2292 
2293             if ( name.indexOf( ':' ) >= 0 )
2294             {
2295                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2296             }
2297             else if ( "xmlns".equals( name ) )
2298             {
2299                 // ignore xmlns attribute in root class, which is a reserved attribute name
2300             }
2301             else
2302             {
2303                 checkUnknownAttribute( parser, name, tagName, strict );
2304             }
2305         }
2306         java.util.Set parsed = new java.util.HashSet();
2307         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2308         {
2309             if ( checkFieldWithDuplicate( parser, "modelVersion", null, parsed ) )
2310             {
2311                 model.setModelVersion( getTrimmedValue( parser.nextText() ) );
2312             }
2313             else if ( checkFieldWithDuplicate( parser, "parent", null, parsed ) )
2314             {
2315                 model.setParent( parseParent( parser, strict ) );
2316             }
2317             else if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2318             {
2319                 model.setGroupId( getTrimmedValue( parser.nextText() ) );
2320             }
2321             else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2322             {
2323                 model.setArtifactId( getTrimmedValue( parser.nextText() ) );
2324             }
2325             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2326             {
2327                 model.setVersion( getTrimmedValue( parser.nextText() ) );
2328             }
2329             else if ( checkFieldWithDuplicate( parser, "packaging", null, parsed ) )
2330             {
2331                 model.setPackaging( getTrimmedValue( parser.nextText() ) );
2332             }
2333             else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2334             {
2335                 model.setName( getTrimmedValue( parser.nextText() ) );
2336             }
2337             else if ( checkFieldWithDuplicate( parser, "description", null, parsed ) )
2338             {
2339                 model.setDescription( getTrimmedValue( parser.nextText() ) );
2340             }
2341             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2342             {
2343                 model.setUrl( getTrimmedValue( parser.nextText() ) );
2344             }
2345             else if ( checkFieldWithDuplicate( parser, "inceptionYear", null, parsed ) )
2346             {
2347                 model.setInceptionYear( getTrimmedValue( parser.nextText() ) );
2348             }
2349             else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
2350             {
2351                 model.setOrganization( parseOrganization( parser, strict ) );
2352             }
2353             else if ( checkFieldWithDuplicate( parser, "licenses", null, parsed ) )
2354             {
2355                 java.util.List licenses = new java.util.ArrayList/*<License>*/();
2356                 model.setLicenses( licenses );
2357                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2358                 {
2359                     if ( "license".equals( parser.getName() ) )
2360                     {
2361                         licenses.add( parseLicense( parser, strict ) );
2362                     }
2363                     else
2364                     {
2365                         checkUnknownElement( parser, strict );
2366                     }
2367                 }
2368             }
2369             else if ( checkFieldWithDuplicate( parser, "developers", null, parsed ) )
2370             {
2371                 java.util.List developers = new java.util.ArrayList/*<Developer>*/();
2372                 model.setDevelopers( developers );
2373                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2374                 {
2375                     if ( "developer".equals( parser.getName() ) )
2376                     {
2377                         developers.add( parseDeveloper( parser, strict ) );
2378                     }
2379                     else
2380                     {
2381                         checkUnknownElement( parser, strict );
2382                     }
2383                 }
2384             }
2385             else if ( checkFieldWithDuplicate( parser, "contributors", null, parsed ) )
2386             {
2387                 java.util.List contributors = new java.util.ArrayList/*<Contributor>*/();
2388                 model.setContributors( contributors );
2389                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2390                 {
2391                     if ( "contributor".equals( parser.getName() ) )
2392                     {
2393                         contributors.add( parseContributor( parser, strict ) );
2394                     }
2395                     else
2396                     {
2397                         checkUnknownElement( parser, strict );
2398                     }
2399                 }
2400             }
2401             else if ( checkFieldWithDuplicate( parser, "mailingLists", null, parsed ) )
2402             {
2403                 java.util.List mailingLists = new java.util.ArrayList/*<MailingList>*/();
2404                 model.setMailingLists( mailingLists );
2405                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2406                 {
2407                     if ( "mailingList".equals( parser.getName() ) )
2408                     {
2409                         mailingLists.add( parseMailingList( parser, strict ) );
2410                     }
2411                     else
2412                     {
2413                         checkUnknownElement( parser, strict );
2414                     }
2415                 }
2416             }
2417             else if ( checkFieldWithDuplicate( parser, "prerequisites", null, parsed ) )
2418             {
2419                 model.setPrerequisites( parsePrerequisites( parser, strict ) );
2420             }
2421             else if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
2422             {
2423                 java.util.List modules = new java.util.ArrayList/*<String>*/();
2424                 model.setModules( modules );
2425                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2426                 {
2427                     if ( "module".equals( parser.getName() ) )
2428                     {
2429                         modules.add( getTrimmedValue( parser.nextText() ) );
2430                     }
2431                     else
2432                     {
2433                         checkUnknownElement( parser, strict );
2434                     }
2435                 }
2436             }
2437             else if ( checkFieldWithDuplicate( parser, "scm", null, parsed ) )
2438             {
2439                 model.setScm( parseScm( parser, strict ) );
2440             }
2441             else if ( checkFieldWithDuplicate( parser, "issueManagement", null, parsed ) )
2442             {
2443                 model.setIssueManagement( parseIssueManagement( parser, strict ) );
2444             }
2445             else if ( checkFieldWithDuplicate( parser, "ciManagement", null, parsed ) )
2446             {
2447                 model.setCiManagement( parseCiManagement( parser, strict ) );
2448             }
2449             else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
2450             {
2451                 model.setDistributionManagement( parseDistributionManagement( parser, strict ) );
2452             }
2453             else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
2454             {
2455                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2456                 {
2457                     String key = parser.getName();
2458                     String value = parser.nextText().trim();
2459                     model.addProperty( key, value );
2460                 }
2461             }
2462             else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
2463             {
2464                 model.setDependencyManagement( parseDependencyManagement( parser, strict ) );
2465             }
2466             else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
2467             {
2468                 java.util.List dependencies = new java.util.ArrayList/*<Dependency>*/();
2469                 model.setDependencies( dependencies );
2470                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2471                 {
2472                     if ( "dependency".equals( parser.getName() ) )
2473                     {
2474                         dependencies.add( parseDependency( parser, strict ) );
2475                     }
2476                     else
2477                     {
2478                         checkUnknownElement( parser, strict );
2479                     }
2480                 }
2481             }
2482             else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
2483             {
2484                 java.util.List repositories = new java.util.ArrayList/*<Repository>*/();
2485                 model.setRepositories( repositories );
2486                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2487                 {
2488                     if ( "repository".equals( parser.getName() ) )
2489                     {
2490                         repositories.add( parseRepository( parser, strict ) );
2491                     }
2492                     else
2493                     {
2494                         checkUnknownElement( parser, strict );
2495                     }
2496                 }
2497             }
2498             else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
2499             {
2500                 java.util.List pluginRepositories = new java.util.ArrayList/*<Repository>*/();
2501                 model.setPluginRepositories( pluginRepositories );
2502                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2503                 {
2504                     if ( "pluginRepository".equals( parser.getName() ) )
2505                     {
2506                         pluginRepositories.add( parseRepository( parser, strict ) );
2507                     }
2508                     else
2509                     {
2510                         checkUnknownElement( parser, strict );
2511                     }
2512                 }
2513             }
2514             else if ( checkFieldWithDuplicate( parser, "build", null, parsed ) )
2515             {
2516                 model.setBuild( parseBuild( parser, strict ) );
2517             }
2518             else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
2519             {
2520                 model.setReports( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
2521             }
2522             else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
2523             {
2524                 model.setReporting( parseReporting( parser, strict ) );
2525             }
2526             else if ( checkFieldWithDuplicate( parser, "profiles", null, parsed ) )
2527             {
2528                 java.util.List profiles = new java.util.ArrayList/*<Profile>*/();
2529                 model.setProfiles( profiles );
2530                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2531                 {
2532                     if ( "profile".equals( parser.getName() ) )
2533                     {
2534                         profiles.add( parseProfile( parser, strict ) );
2535                     }
2536                     else
2537                     {
2538                         checkUnknownElement( parser, strict );
2539                     }
2540                 }
2541             }
2542             else
2543             {
2544                 checkUnknownElement( parser, strict );
2545             }
2546         }
2547         return model;
2548     } //-- Model parseModel( XmlPullParser, boolean )
2549 
2550     /**
2551      * Method parseModelBase.
2552      * 
2553      * @param parser
2554      * @param strict
2555      * @throws IOException
2556      * @throws XmlPullParserException
2557      * @return ModelBase
2558      */
2559     private ModelBase parseModelBase( XmlPullParser parser, boolean strict )
2560         throws IOException, XmlPullParserException
2561     {
2562         String tagName = parser.getName();
2563         ModelBase modelBase = new ModelBase();
2564         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2565         {
2566             String name = parser.getAttributeName( i );
2567             String value = parser.getAttributeValue( i );
2568 
2569             if ( name.indexOf( ':' ) >= 0 )
2570             {
2571                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2572             }
2573             else
2574             {
2575                 checkUnknownAttribute( parser, name, tagName, strict );
2576             }
2577         }
2578         java.util.Set parsed = new java.util.HashSet();
2579         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2580         {
2581             if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
2582             {
2583                 java.util.List modules = new java.util.ArrayList/*<String>*/();
2584                 modelBase.setModules( modules );
2585                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2586                 {
2587                     if ( "module".equals( parser.getName() ) )
2588                     {
2589                         modules.add( getTrimmedValue( parser.nextText() ) );
2590                     }
2591                     else
2592                     {
2593                         checkUnknownElement( parser, strict );
2594                     }
2595                 }
2596             }
2597             else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
2598             {
2599                 modelBase.setDistributionManagement( parseDistributionManagement( parser, strict ) );
2600             }
2601             else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
2602             {
2603                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2604                 {
2605                     String key = parser.getName();
2606                     String value = parser.nextText().trim();
2607                     modelBase.addProperty( key, value );
2608                 }
2609             }
2610             else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
2611             {
2612                 modelBase.setDependencyManagement( parseDependencyManagement( parser, strict ) );
2613             }
2614             else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
2615             {
2616                 java.util.List dependencies = new java.util.ArrayList/*<Dependency>*/();
2617                 modelBase.setDependencies( dependencies );
2618                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2619                 {
2620                     if ( "dependency".equals( parser.getName() ) )
2621                     {
2622                         dependencies.add( parseDependency( parser, strict ) );
2623                     }
2624                     else
2625                     {
2626                         checkUnknownElement( parser, strict );
2627                     }
2628                 }
2629             }
2630             else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
2631             {
2632                 java.util.List repositories = new java.util.ArrayList/*<Repository>*/();
2633                 modelBase.setRepositories( repositories );
2634                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2635                 {
2636                     if ( "repository".equals( parser.getName() ) )
2637                     {
2638                         repositories.add( parseRepository( parser, strict ) );
2639                     }
2640                     else
2641                     {
2642                         checkUnknownElement( parser, strict );
2643                     }
2644                 }
2645             }
2646             else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
2647             {
2648                 java.util.List pluginRepositories = new java.util.ArrayList/*<Repository>*/();
2649                 modelBase.setPluginRepositories( pluginRepositories );
2650                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2651                 {
2652                     if ( "pluginRepository".equals( parser.getName() ) )
2653                     {
2654                         pluginRepositories.add( parseRepository( parser, strict ) );
2655                     }
2656                     else
2657                     {
2658                         checkUnknownElement( parser, strict );
2659                     }
2660                 }
2661             }
2662             else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
2663             {
2664                 modelBase.setReports( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
2665             }
2666             else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
2667             {
2668                 modelBase.setReporting( parseReporting( parser, strict ) );
2669             }
2670             else
2671             {
2672                 checkUnknownElement( parser, strict );
2673             }
2674         }
2675         return modelBase;
2676     } //-- ModelBase parseModelBase( XmlPullParser, boolean )
2677 
2678     /**
2679      * Method parseNotifier.
2680      * 
2681      * @param parser
2682      * @param strict
2683      * @throws IOException
2684      * @throws XmlPullParserException
2685      * @return Notifier
2686      */
2687     private Notifier parseNotifier( XmlPullParser parser, boolean strict )
2688         throws IOException, XmlPullParserException
2689     {
2690         String tagName = parser.getName();
2691         Notifier notifier = new Notifier();
2692         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2693         {
2694             String name = parser.getAttributeName( i );
2695             String value = parser.getAttributeValue( i );
2696 
2697             if ( name.indexOf( ':' ) >= 0 )
2698             {
2699                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2700             }
2701             else
2702             {
2703                 checkUnknownAttribute( parser, name, tagName, strict );
2704             }
2705         }
2706         java.util.Set parsed = new java.util.HashSet();
2707         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2708         {
2709             if ( checkFieldWithDuplicate( parser, "type", null, parsed ) )
2710             {
2711                 notifier.setType( getTrimmedValue( parser.nextText() ) );
2712             }
2713             else if ( checkFieldWithDuplicate( parser, "sendOnError", null, parsed ) )
2714             {
2715                 notifier.setSendOnError( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnError", parser, "true" ) );
2716             }
2717             else if ( checkFieldWithDuplicate( parser, "sendOnFailure", null, parsed ) )
2718             {
2719                 notifier.setSendOnFailure( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnFailure", parser, "true" ) );
2720             }
2721             else if ( checkFieldWithDuplicate( parser, "sendOnSuccess", null, parsed ) )
2722             {
2723                 notifier.setSendOnSuccess( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnSuccess", parser, "true" ) );
2724             }
2725             else if ( checkFieldWithDuplicate( parser, "sendOnWarning", null, parsed ) )
2726             {
2727                 notifier.setSendOnWarning( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnWarning", parser, "true" ) );
2728             }
2729             else if ( checkFieldWithDuplicate( parser, "address", null, parsed ) )
2730             {
2731                 notifier.setAddress( getTrimmedValue( parser.nextText() ) );
2732             }
2733             else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
2734             {
2735                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2736                 {
2737                     String key = parser.getName();
2738                     String value = parser.nextText().trim();
2739                     notifier.addConfiguration( key, value );
2740                 }
2741             }
2742             else
2743             {
2744                 checkUnknownElement( parser, strict );
2745             }
2746         }
2747         return notifier;
2748     } //-- Notifier parseNotifier( XmlPullParser, boolean )
2749 
2750     /**
2751      * Method parseOrganization.
2752      * 
2753      * @param parser
2754      * @param strict
2755      * @throws IOException
2756      * @throws XmlPullParserException
2757      * @return Organization
2758      */
2759     private Organization parseOrganization( XmlPullParser parser, boolean strict )
2760         throws IOException, XmlPullParserException
2761     {
2762         String tagName = parser.getName();
2763         Organization organization = new Organization();
2764         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2765         {
2766             String name = parser.getAttributeName( i );
2767             String value = parser.getAttributeValue( i );
2768 
2769             if ( name.indexOf( ':' ) >= 0 )
2770             {
2771                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2772             }
2773             else
2774             {
2775                 checkUnknownAttribute( parser, name, tagName, strict );
2776             }
2777         }
2778         java.util.Set parsed = new java.util.HashSet();
2779         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2780         {
2781             if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
2782             {
2783                 organization.setName( getTrimmedValue( parser.nextText() ) );
2784             }
2785             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
2786             {
2787                 organization.setUrl( getTrimmedValue( parser.nextText() ) );
2788             }
2789             else
2790             {
2791                 checkUnknownElement( parser, strict );
2792             }
2793         }
2794         return organization;
2795     } //-- Organization parseOrganization( XmlPullParser, boolean )
2796 
2797     /**
2798      * Method parseParent.
2799      * 
2800      * @param parser
2801      * @param strict
2802      * @throws IOException
2803      * @throws XmlPullParserException
2804      * @return Parent
2805      */
2806     private Parent parseParent( XmlPullParser parser, boolean strict )
2807         throws IOException, XmlPullParserException
2808     {
2809         String tagName = parser.getName();
2810         Parent parent = new Parent();
2811         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2812         {
2813             String name = parser.getAttributeName( i );
2814             String value = parser.getAttributeValue( i );
2815 
2816             if ( name.indexOf( ':' ) >= 0 )
2817             {
2818                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2819             }
2820             else
2821             {
2822                 checkUnknownAttribute( parser, name, tagName, strict );
2823             }
2824         }
2825         java.util.Set parsed = new java.util.HashSet();
2826         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2827         {
2828             if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2829             {
2830                 parent.setGroupId( getTrimmedValue( parser.nextText() ) );
2831             }
2832             else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2833             {
2834                 parent.setArtifactId( getTrimmedValue( parser.nextText() ) );
2835             }
2836             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2837             {
2838                 parent.setVersion( getTrimmedValue( parser.nextText() ) );
2839             }
2840             else if ( checkFieldWithDuplicate( parser, "relativePath", null, parsed ) )
2841             {
2842                 parent.setRelativePath( getTrimmedValue( parser.nextText() ) );
2843             }
2844             else
2845             {
2846                 checkUnknownElement( parser, strict );
2847             }
2848         }
2849         return parent;
2850     } //-- Parent parseParent( XmlPullParser, boolean )
2851 
2852     /**
2853      * Method parsePatternSet.
2854      * 
2855      * @param parser
2856      * @param strict
2857      * @throws IOException
2858      * @throws XmlPullParserException
2859      * @return PatternSet
2860      */
2861     private PatternSet parsePatternSet( XmlPullParser parser, boolean strict )
2862         throws IOException, XmlPullParserException
2863     {
2864         String tagName = parser.getName();
2865         PatternSet patternSet = new PatternSet();
2866         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2867         {
2868             String name = parser.getAttributeName( i );
2869             String value = parser.getAttributeValue( i );
2870 
2871             if ( name.indexOf( ':' ) >= 0 )
2872             {
2873                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2874             }
2875             else
2876             {
2877                 checkUnknownAttribute( parser, name, tagName, strict );
2878             }
2879         }
2880         java.util.Set parsed = new java.util.HashSet();
2881         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2882         {
2883             if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
2884             {
2885                 java.util.List includes = new java.util.ArrayList/*<String>*/();
2886                 patternSet.setIncludes( includes );
2887                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2888                 {
2889                     if ( "include".equals( parser.getName() ) )
2890                     {
2891                         includes.add( getTrimmedValue( parser.nextText() ) );
2892                     }
2893                     else
2894                     {
2895                         checkUnknownElement( parser, strict );
2896                     }
2897                 }
2898             }
2899             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
2900             {
2901                 java.util.List excludes = new java.util.ArrayList/*<String>*/();
2902                 patternSet.setExcludes( excludes );
2903                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2904                 {
2905                     if ( "exclude".equals( parser.getName() ) )
2906                     {
2907                         excludes.add( getTrimmedValue( parser.nextText() ) );
2908                     }
2909                     else
2910                     {
2911                         checkUnknownElement( parser, strict );
2912                     }
2913                 }
2914             }
2915             else
2916             {
2917                 checkUnknownElement( parser, strict );
2918             }
2919         }
2920         return patternSet;
2921     } //-- PatternSet parsePatternSet( XmlPullParser, boolean )
2922 
2923     /**
2924      * Method parsePlugin.
2925      * 
2926      * @param parser
2927      * @param strict
2928      * @throws IOException
2929      * @throws XmlPullParserException
2930      * @return Plugin
2931      */
2932     private Plugin parsePlugin( XmlPullParser parser, boolean strict )
2933         throws IOException, XmlPullParserException
2934     {
2935         String tagName = parser.getName();
2936         Plugin plugin = new Plugin();
2937         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
2938         {
2939             String name = parser.getAttributeName( i );
2940             String value = parser.getAttributeValue( i );
2941 
2942             if ( name.indexOf( ':' ) >= 0 )
2943             {
2944                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
2945             }
2946             else
2947             {
2948                 checkUnknownAttribute( parser, name, tagName, strict );
2949             }
2950         }
2951         java.util.Set parsed = new java.util.HashSet();
2952         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
2953         {
2954             if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
2955             {
2956                 plugin.setGroupId( getTrimmedValue( parser.nextText() ) );
2957             }
2958             else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
2959             {
2960                 plugin.setArtifactId( getTrimmedValue( parser.nextText() ) );
2961             }
2962             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
2963             {
2964                 plugin.setVersion( getTrimmedValue( parser.nextText() ) );
2965             }
2966             else if ( checkFieldWithDuplicate( parser, "extensions", null, parsed ) )
2967             {
2968                 plugin.setExtensions( getTrimmedValue( parser.nextText() ) );
2969             }
2970             else if ( checkFieldWithDuplicate( parser, "executions", null, parsed ) )
2971             {
2972                 java.util.List executions = new java.util.ArrayList/*<PluginExecution>*/();
2973                 plugin.setExecutions( executions );
2974                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2975                 {
2976                     if ( "execution".equals( parser.getName() ) )
2977                     {
2978                         executions.add( parsePluginExecution( parser, strict ) );
2979                     }
2980                     else
2981                     {
2982                         checkUnknownElement( parser, strict );
2983                     }
2984                 }
2985             }
2986             else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
2987             {
2988                 java.util.List dependencies = new java.util.ArrayList/*<Dependency>*/();
2989                 plugin.setDependencies( dependencies );
2990                 while ( parser.nextTag() == XmlPullParser.START_TAG )
2991                 {
2992                     if ( "dependency".equals( parser.getName() ) )
2993                     {
2994                         dependencies.add( parseDependency( parser, strict ) );
2995                     }
2996                     else
2997                     {
2998                         checkUnknownElement( parser, strict );
2999                     }
3000                 }
3001             }
3002             else if ( checkFieldWithDuplicate( parser, "goals", null, parsed ) )
3003             {
3004                 plugin.setGoals( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3005             }
3006             else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3007             {
3008                 plugin.setInherited( getTrimmedValue( parser.nextText() ) );
3009             }
3010             else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3011             {
3012                 plugin.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3013             }
3014             else
3015             {
3016                 checkUnknownElement( parser, strict );
3017             }
3018         }
3019         return plugin;
3020     } //-- Plugin parsePlugin( XmlPullParser, boolean )
3021 
3022     /**
3023      * Method parsePluginConfiguration.
3024      * 
3025      * @param parser
3026      * @param strict
3027      * @throws IOException
3028      * @throws XmlPullParserException
3029      * @return PluginConfiguration
3030      */
3031     private PluginConfiguration parsePluginConfiguration( XmlPullParser parser, boolean strict )
3032         throws IOException, XmlPullParserException
3033     {
3034         String tagName = parser.getName();
3035         PluginConfiguration pluginConfiguration = new PluginConfiguration();
3036         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3037         {
3038             String name = parser.getAttributeName( i );
3039             String value = parser.getAttributeValue( i );
3040 
3041             if ( name.indexOf( ':' ) >= 0 )
3042             {
3043                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3044             }
3045             else
3046             {
3047                 checkUnknownAttribute( parser, name, tagName, strict );
3048             }
3049         }
3050         java.util.Set parsed = new java.util.HashSet();
3051         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3052         {
3053             if ( checkFieldWithDuplicate( parser, "pluginManagement", null, parsed ) )
3054             {
3055                 pluginConfiguration.setPluginManagement( parsePluginManagement( parser, strict ) );
3056             }
3057             else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3058             {
3059                 java.util.List plugins = new java.util.ArrayList/*<Plugin>*/();
3060                 pluginConfiguration.setPlugins( plugins );
3061                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3062                 {
3063                     if ( "plugin".equals( parser.getName() ) )
3064                     {
3065                         plugins.add( parsePlugin( parser, strict ) );
3066                     }
3067                     else
3068                     {
3069                         checkUnknownElement( parser, strict );
3070                     }
3071                 }
3072             }
3073             else
3074             {
3075                 checkUnknownElement( parser, strict );
3076             }
3077         }
3078         return pluginConfiguration;
3079     } //-- PluginConfiguration parsePluginConfiguration( XmlPullParser, boolean )
3080 
3081     /**
3082      * Method parsePluginContainer.
3083      * 
3084      * @param parser
3085      * @param strict
3086      * @throws IOException
3087      * @throws XmlPullParserException
3088      * @return PluginContainer
3089      */
3090     private PluginContainer parsePluginContainer( XmlPullParser parser, boolean strict )
3091         throws IOException, XmlPullParserException
3092     {
3093         String tagName = parser.getName();
3094         PluginContainer pluginContainer = new PluginContainer();
3095         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3096         {
3097             String name = parser.getAttributeName( i );
3098             String value = parser.getAttributeValue( i );
3099 
3100             if ( name.indexOf( ':' ) >= 0 )
3101             {
3102                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3103             }
3104             else
3105             {
3106                 checkUnknownAttribute( parser, name, tagName, strict );
3107             }
3108         }
3109         java.util.Set parsed = new java.util.HashSet();
3110         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3111         {
3112             if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3113             {
3114                 java.util.List plugins = new java.util.ArrayList/*<Plugin>*/();
3115                 pluginContainer.setPlugins( plugins );
3116                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3117                 {
3118                     if ( "plugin".equals( parser.getName() ) )
3119                     {
3120                         plugins.add( parsePlugin( parser, strict ) );
3121                     }
3122                     else
3123                     {
3124                         checkUnknownElement( parser, strict );
3125                     }
3126                 }
3127             }
3128             else
3129             {
3130                 checkUnknownElement( parser, strict );
3131             }
3132         }
3133         return pluginContainer;
3134     } //-- PluginContainer parsePluginContainer( XmlPullParser, boolean )
3135 
3136     /**
3137      * Method parsePluginExecution.
3138      * 
3139      * @param parser
3140      * @param strict
3141      * @throws IOException
3142      * @throws XmlPullParserException
3143      * @return PluginExecution
3144      */
3145     private PluginExecution parsePluginExecution( XmlPullParser parser, boolean strict )
3146         throws IOException, XmlPullParserException
3147     {
3148         String tagName = parser.getName();
3149         PluginExecution pluginExecution = new PluginExecution();
3150         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3151         {
3152             String name = parser.getAttributeName( i );
3153             String value = parser.getAttributeValue( i );
3154 
3155             if ( name.indexOf( ':' ) >= 0 )
3156             {
3157                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3158             }
3159             else
3160             {
3161                 checkUnknownAttribute( parser, name, tagName, strict );
3162             }
3163         }
3164         java.util.Set parsed = new java.util.HashSet();
3165         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3166         {
3167             if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3168             {
3169                 pluginExecution.setId( getTrimmedValue( parser.nextText() ) );
3170             }
3171             else if ( checkFieldWithDuplicate( parser, "phase", null, parsed ) )
3172             {
3173                 pluginExecution.setPhase( getTrimmedValue( parser.nextText() ) );
3174             }
3175             else if ( checkFieldWithDuplicate( parser, "goals", null, parsed ) )
3176             {
3177                 java.util.List goals = new java.util.ArrayList/*<String>*/();
3178                 pluginExecution.setGoals( goals );
3179                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3180                 {
3181                     if ( "goal".equals( parser.getName() ) )
3182                     {
3183                         goals.add( getTrimmedValue( parser.nextText() ) );
3184                     }
3185                     else
3186                     {
3187                         checkUnknownElement( parser, strict );
3188                     }
3189                 }
3190             }
3191             else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3192             {
3193                 pluginExecution.setInherited( getTrimmedValue( parser.nextText() ) );
3194             }
3195             else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3196             {
3197                 pluginExecution.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3198             }
3199             else
3200             {
3201                 checkUnknownElement( parser, strict );
3202             }
3203         }
3204         return pluginExecution;
3205     } //-- PluginExecution parsePluginExecution( XmlPullParser, boolean )
3206 
3207     /**
3208      * Method parsePluginManagement.
3209      * 
3210      * @param parser
3211      * @param strict
3212      * @throws IOException
3213      * @throws XmlPullParserException
3214      * @return PluginManagement
3215      */
3216     private PluginManagement parsePluginManagement( XmlPullParser parser, boolean strict )
3217         throws IOException, XmlPullParserException
3218     {
3219         String tagName = parser.getName();
3220         PluginManagement pluginManagement = new PluginManagement();
3221         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3222         {
3223             String name = parser.getAttributeName( i );
3224             String value = parser.getAttributeValue( i );
3225 
3226             if ( name.indexOf( ':' ) >= 0 )
3227             {
3228                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3229             }
3230             else
3231             {
3232                 checkUnknownAttribute( parser, name, tagName, strict );
3233             }
3234         }
3235         java.util.Set parsed = new java.util.HashSet();
3236         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3237         {
3238             if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3239             {
3240                 java.util.List plugins = new java.util.ArrayList/*<Plugin>*/();
3241                 pluginManagement.setPlugins( plugins );
3242                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3243                 {
3244                     if ( "plugin".equals( parser.getName() ) )
3245                     {
3246                         plugins.add( parsePlugin( parser, strict ) );
3247                     }
3248                     else
3249                     {
3250                         checkUnknownElement( parser, strict );
3251                     }
3252                 }
3253             }
3254             else
3255             {
3256                 checkUnknownElement( parser, strict );
3257             }
3258         }
3259         return pluginManagement;
3260     } //-- PluginManagement parsePluginManagement( XmlPullParser, boolean )
3261 
3262     /**
3263      * Method parsePrerequisites.
3264      * 
3265      * @param parser
3266      * @param strict
3267      * @throws IOException
3268      * @throws XmlPullParserException
3269      * @return Prerequisites
3270      */
3271     private Prerequisites parsePrerequisites( XmlPullParser parser, boolean strict )
3272         throws IOException, XmlPullParserException
3273     {
3274         String tagName = parser.getName();
3275         Prerequisites prerequisites = new Prerequisites();
3276         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3277         {
3278             String name = parser.getAttributeName( i );
3279             String value = parser.getAttributeValue( i );
3280 
3281             if ( name.indexOf( ':' ) >= 0 )
3282             {
3283                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3284             }
3285             else
3286             {
3287                 checkUnknownAttribute( parser, name, tagName, strict );
3288             }
3289         }
3290         java.util.Set parsed = new java.util.HashSet();
3291         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3292         {
3293             if ( checkFieldWithDuplicate( parser, "maven", null, parsed ) )
3294             {
3295                 prerequisites.setMaven( getTrimmedValue( parser.nextText() ) );
3296             }
3297             else
3298             {
3299                 checkUnknownElement( parser, strict );
3300             }
3301         }
3302         return prerequisites;
3303     } //-- Prerequisites parsePrerequisites( XmlPullParser, boolean )
3304 
3305     /**
3306      * Method parseProfile.
3307      * 
3308      * @param parser
3309      * @param strict
3310      * @throws IOException
3311      * @throws XmlPullParserException
3312      * @return Profile
3313      */
3314     private Profile parseProfile( XmlPullParser parser, boolean strict )
3315         throws IOException, XmlPullParserException
3316     {
3317         String tagName = parser.getName();
3318         Profile profile = new Profile();
3319         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3320         {
3321             String name = parser.getAttributeName( i );
3322             String value = parser.getAttributeValue( i );
3323 
3324             if ( name.indexOf( ':' ) >= 0 )
3325             {
3326                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3327             }
3328             else
3329             {
3330                 checkUnknownAttribute( parser, name, tagName, strict );
3331             }
3332         }
3333         java.util.Set parsed = new java.util.HashSet();
3334         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3335         {
3336             if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3337             {
3338                 profile.setId( getTrimmedValue( parser.nextText() ) );
3339             }
3340             else if ( checkFieldWithDuplicate( parser, "activation", null, parsed ) )
3341             {
3342                 profile.setActivation( parseActivation( parser, strict ) );
3343             }
3344             else if ( checkFieldWithDuplicate( parser, "build", null, parsed ) )
3345             {
3346                 profile.setBuild( parseBuildBase( parser, strict ) );
3347             }
3348             else if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
3349             {
3350                 java.util.List modules = new java.util.ArrayList/*<String>*/();
3351                 profile.setModules( modules );
3352                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3353                 {
3354                     if ( "module".equals( parser.getName() ) )
3355                     {
3356                         modules.add( getTrimmedValue( parser.nextText() ) );
3357                     }
3358                     else
3359                     {
3360                         checkUnknownElement( parser, strict );
3361                     }
3362                 }
3363             }
3364             else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
3365             {
3366                 profile.setDistributionManagement( parseDistributionManagement( parser, strict ) );
3367             }
3368             else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
3369             {
3370                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3371                 {
3372                     String key = parser.getName();
3373                     String value = parser.nextText().trim();
3374                     profile.addProperty( key, value );
3375                 }
3376             }
3377             else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
3378             {
3379                 profile.setDependencyManagement( parseDependencyManagement( parser, strict ) );
3380             }
3381             else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
3382             {
3383                 java.util.List dependencies = new java.util.ArrayList/*<Dependency>*/();
3384                 profile.setDependencies( dependencies );
3385                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3386                 {
3387                     if ( "dependency".equals( parser.getName() ) )
3388                     {
3389                         dependencies.add( parseDependency( parser, strict ) );
3390                     }
3391                     else
3392                     {
3393                         checkUnknownElement( parser, strict );
3394                     }
3395                 }
3396             }
3397             else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
3398             {
3399                 java.util.List repositories = new java.util.ArrayList/*<Repository>*/();
3400                 profile.setRepositories( repositories );
3401                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3402                 {
3403                     if ( "repository".equals( parser.getName() ) )
3404                     {
3405                         repositories.add( parseRepository( parser, strict ) );
3406                     }
3407                     else
3408                     {
3409                         checkUnknownElement( parser, strict );
3410                     }
3411                 }
3412             }
3413             else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
3414             {
3415                 java.util.List pluginRepositories = new java.util.ArrayList/*<Repository>*/();
3416                 profile.setPluginRepositories( pluginRepositories );
3417                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3418                 {
3419                     if ( "pluginRepository".equals( parser.getName() ) )
3420                     {
3421                         pluginRepositories.add( parseRepository( parser, strict ) );
3422                     }
3423                     else
3424                     {
3425                         checkUnknownElement( parser, strict );
3426                     }
3427                 }
3428             }
3429             else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
3430             {
3431                 profile.setReports( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3432             }
3433             else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
3434             {
3435                 profile.setReporting( parseReporting( parser, strict ) );
3436             }
3437             else
3438             {
3439                 checkUnknownElement( parser, strict );
3440             }
3441         }
3442         return profile;
3443     } //-- Profile parseProfile( XmlPullParser, boolean )
3444 
3445     /**
3446      * Method parseRelocation.
3447      * 
3448      * @param parser
3449      * @param strict
3450      * @throws IOException
3451      * @throws XmlPullParserException
3452      * @return Relocation
3453      */
3454     private Relocation parseRelocation( XmlPullParser parser, boolean strict )
3455         throws IOException, XmlPullParserException
3456     {
3457         String tagName = parser.getName();
3458         Relocation relocation = new Relocation();
3459         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3460         {
3461             String name = parser.getAttributeName( i );
3462             String value = parser.getAttributeValue( i );
3463 
3464             if ( name.indexOf( ':' ) >= 0 )
3465             {
3466                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3467             }
3468             else
3469             {
3470                 checkUnknownAttribute( parser, name, tagName, strict );
3471             }
3472         }
3473         java.util.Set parsed = new java.util.HashSet();
3474         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3475         {
3476             if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
3477             {
3478                 relocation.setGroupId( getTrimmedValue( parser.nextText() ) );
3479             }
3480             else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
3481             {
3482                 relocation.setArtifactId( getTrimmedValue( parser.nextText() ) );
3483             }
3484             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
3485             {
3486                 relocation.setVersion( getTrimmedValue( parser.nextText() ) );
3487             }
3488             else if ( checkFieldWithDuplicate( parser, "message", null, parsed ) )
3489             {
3490                 relocation.setMessage( getTrimmedValue( parser.nextText() ) );
3491             }
3492             else
3493             {
3494                 checkUnknownElement( parser, strict );
3495             }
3496         }
3497         return relocation;
3498     } //-- Relocation parseRelocation( XmlPullParser, boolean )
3499 
3500     /**
3501      * Method parseReportPlugin.
3502      * 
3503      * @param parser
3504      * @param strict
3505      * @throws IOException
3506      * @throws XmlPullParserException
3507      * @return ReportPlugin
3508      */
3509     private ReportPlugin parseReportPlugin( XmlPullParser parser, boolean strict )
3510         throws IOException, XmlPullParserException
3511     {
3512         String tagName = parser.getName();
3513         ReportPlugin reportPlugin = new ReportPlugin();
3514         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3515         {
3516             String name = parser.getAttributeName( i );
3517             String value = parser.getAttributeValue( i );
3518 
3519             if ( name.indexOf( ':' ) >= 0 )
3520             {
3521                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3522             }
3523             else
3524             {
3525                 checkUnknownAttribute( parser, name, tagName, strict );
3526             }
3527         }
3528         java.util.Set parsed = new java.util.HashSet();
3529         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3530         {
3531             if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
3532             {
3533                 reportPlugin.setGroupId( getTrimmedValue( parser.nextText() ) );
3534             }
3535             else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
3536             {
3537                 reportPlugin.setArtifactId( getTrimmedValue( parser.nextText() ) );
3538             }
3539             else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
3540             {
3541                 reportPlugin.setVersion( getTrimmedValue( parser.nextText() ) );
3542             }
3543             else if ( checkFieldWithDuplicate( parser, "reportSets", null, parsed ) )
3544             {
3545                 java.util.List reportSets = new java.util.ArrayList/*<ReportSet>*/();
3546                 reportPlugin.setReportSets( reportSets );
3547                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3548                 {
3549                     if ( "reportSet".equals( parser.getName() ) )
3550                     {
3551                         reportSets.add( parseReportSet( parser, strict ) );
3552                     }
3553                     else
3554                     {
3555                         checkUnknownElement( parser, strict );
3556                     }
3557                 }
3558             }
3559             else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3560             {
3561                 reportPlugin.setInherited( getTrimmedValue( parser.nextText() ) );
3562             }
3563             else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3564             {
3565                 reportPlugin.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3566             }
3567             else
3568             {
3569                 checkUnknownElement( parser, strict );
3570             }
3571         }
3572         return reportPlugin;
3573     } //-- ReportPlugin parseReportPlugin( XmlPullParser, boolean )
3574 
3575     /**
3576      * Method parseReportSet.
3577      * 
3578      * @param parser
3579      * @param strict
3580      * @throws IOException
3581      * @throws XmlPullParserException
3582      * @return ReportSet
3583      */
3584     private ReportSet parseReportSet( XmlPullParser parser, boolean strict )
3585         throws IOException, XmlPullParserException
3586     {
3587         String tagName = parser.getName();
3588         ReportSet reportSet = new ReportSet();
3589         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3590         {
3591             String name = parser.getAttributeName( i );
3592             String value = parser.getAttributeValue( i );
3593 
3594             if ( name.indexOf( ':' ) >= 0 )
3595             {
3596                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3597             }
3598             else
3599             {
3600                 checkUnknownAttribute( parser, name, tagName, strict );
3601             }
3602         }
3603         java.util.Set parsed = new java.util.HashSet();
3604         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3605         {
3606             if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3607             {
3608                 reportSet.setId( getTrimmedValue( parser.nextText() ) );
3609             }
3610             else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
3611             {
3612                 java.util.List reports = new java.util.ArrayList/*<String>*/();
3613                 reportSet.setReports( reports );
3614                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3615                 {
3616                     if ( "report".equals( parser.getName() ) )
3617                     {
3618                         reports.add( getTrimmedValue( parser.nextText() ) );
3619                     }
3620                     else
3621                     {
3622                         checkUnknownElement( parser, strict );
3623                     }
3624                 }
3625             }
3626             else if ( checkFieldWithDuplicate( parser, "inherited", null, parsed ) )
3627             {
3628                 reportSet.setInherited( getTrimmedValue( parser.nextText() ) );
3629             }
3630             else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
3631             {
3632                 reportSet.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
3633             }
3634             else
3635             {
3636                 checkUnknownElement( parser, strict );
3637             }
3638         }
3639         return reportSet;
3640     } //-- ReportSet parseReportSet( XmlPullParser, boolean )
3641 
3642     /**
3643      * Method parseReporting.
3644      * 
3645      * @param parser
3646      * @param strict
3647      * @throws IOException
3648      * @throws XmlPullParserException
3649      * @return Reporting
3650      */
3651     private Reporting parseReporting( XmlPullParser parser, boolean strict )
3652         throws IOException, XmlPullParserException
3653     {
3654         String tagName = parser.getName();
3655         Reporting reporting = new Reporting();
3656         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3657         {
3658             String name = parser.getAttributeName( i );
3659             String value = parser.getAttributeValue( i );
3660 
3661             if ( name.indexOf( ':' ) >= 0 )
3662             {
3663                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3664             }
3665             else
3666             {
3667                 checkUnknownAttribute( parser, name, tagName, strict );
3668             }
3669         }
3670         java.util.Set parsed = new java.util.HashSet();
3671         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3672         {
3673             if ( checkFieldWithDuplicate( parser, "excludeDefaults", null, parsed ) )
3674             {
3675                 reporting.setExcludeDefaults( getTrimmedValue( parser.nextText() ) );
3676             }
3677             else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
3678             {
3679                 reporting.setOutputDirectory( getTrimmedValue( parser.nextText() ) );
3680             }
3681             else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
3682             {
3683                 java.util.List plugins = new java.util.ArrayList/*<ReportPlugin>*/();
3684                 reporting.setPlugins( plugins );
3685                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3686                 {
3687                     if ( "plugin".equals( parser.getName() ) )
3688                     {
3689                         plugins.add( parseReportPlugin( parser, strict ) );
3690                     }
3691                     else
3692                     {
3693                         checkUnknownElement( parser, strict );
3694                     }
3695                 }
3696             }
3697             else
3698             {
3699                 checkUnknownElement( parser, strict );
3700             }
3701         }
3702         return reporting;
3703     } //-- Reporting parseReporting( XmlPullParser, boolean )
3704 
3705     /**
3706      * Method parseRepository.
3707      * 
3708      * @param parser
3709      * @param strict
3710      * @throws IOException
3711      * @throws XmlPullParserException
3712      * @return Repository
3713      */
3714     private Repository parseRepository( XmlPullParser parser, boolean strict )
3715         throws IOException, XmlPullParserException
3716     {
3717         String tagName = parser.getName();
3718         Repository repository = new Repository();
3719         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3720         {
3721             String name = parser.getAttributeName( i );
3722             String value = parser.getAttributeValue( i );
3723 
3724             if ( name.indexOf( ':' ) >= 0 )
3725             {
3726                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3727             }
3728             else
3729             {
3730                 checkUnknownAttribute( parser, name, tagName, strict );
3731             }
3732         }
3733         java.util.Set parsed = new java.util.HashSet();
3734         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3735         {
3736             if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) )
3737             {
3738                 repository.setReleases( parseRepositoryPolicy( parser, strict ) );
3739             }
3740             else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) )
3741             {
3742                 repository.setSnapshots( parseRepositoryPolicy( parser, strict ) );
3743             }
3744             else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3745             {
3746                 repository.setId( getTrimmedValue( parser.nextText() ) );
3747             }
3748             else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
3749             {
3750                 repository.setName( getTrimmedValue( parser.nextText() ) );
3751             }
3752             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
3753             {
3754                 repository.setUrl( getTrimmedValue( parser.nextText() ) );
3755             }
3756             else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
3757             {
3758                 repository.setLayout( getTrimmedValue( parser.nextText() ) );
3759             }
3760             else
3761             {
3762                 checkUnknownElement( parser, strict );
3763             }
3764         }
3765         return repository;
3766     } //-- Repository parseRepository( XmlPullParser, boolean )
3767 
3768     /**
3769      * Method parseRepositoryBase.
3770      * 
3771      * @param parser
3772      * @param strict
3773      * @throws IOException
3774      * @throws XmlPullParserException
3775      * @return RepositoryBase
3776      */
3777     private RepositoryBase parseRepositoryBase( XmlPullParser parser, boolean strict )
3778         throws IOException, XmlPullParserException
3779     {
3780         String tagName = parser.getName();
3781         RepositoryBase repositoryBase = new RepositoryBase();
3782         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3783         {
3784             String name = parser.getAttributeName( i );
3785             String value = parser.getAttributeValue( i );
3786 
3787             if ( name.indexOf( ':' ) >= 0 )
3788             {
3789                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3790             }
3791             else
3792             {
3793                 checkUnknownAttribute( parser, name, tagName, strict );
3794             }
3795         }
3796         java.util.Set parsed = new java.util.HashSet();
3797         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3798         {
3799             if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
3800             {
3801                 repositoryBase.setId( getTrimmedValue( parser.nextText() ) );
3802             }
3803             else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
3804             {
3805                 repositoryBase.setName( getTrimmedValue( parser.nextText() ) );
3806             }
3807             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
3808             {
3809                 repositoryBase.setUrl( getTrimmedValue( parser.nextText() ) );
3810             }
3811             else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
3812             {
3813                 repositoryBase.setLayout( getTrimmedValue( parser.nextText() ) );
3814             }
3815             else
3816             {
3817                 checkUnknownElement( parser, strict );
3818             }
3819         }
3820         return repositoryBase;
3821     } //-- RepositoryBase parseRepositoryBase( XmlPullParser, boolean )
3822 
3823     /**
3824      * Method parseRepositoryPolicy.
3825      * 
3826      * @param parser
3827      * @param strict
3828      * @throws IOException
3829      * @throws XmlPullParserException
3830      * @return RepositoryPolicy
3831      */
3832     private RepositoryPolicy parseRepositoryPolicy( XmlPullParser parser, boolean strict )
3833         throws IOException, XmlPullParserException
3834     {
3835         String tagName = parser.getName();
3836         RepositoryPolicy repositoryPolicy = new RepositoryPolicy();
3837         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3838         {
3839             String name = parser.getAttributeName( i );
3840             String value = parser.getAttributeValue( i );
3841 
3842             if ( name.indexOf( ':' ) >= 0 )
3843             {
3844                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3845             }
3846             else
3847             {
3848                 checkUnknownAttribute( parser, name, tagName, strict );
3849             }
3850         }
3851         java.util.Set parsed = new java.util.HashSet();
3852         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3853         {
3854             if ( checkFieldWithDuplicate( parser, "enabled", null, parsed ) )
3855             {
3856                 repositoryPolicy.setEnabled( getTrimmedValue( parser.nextText() ) );
3857             }
3858             else if ( checkFieldWithDuplicate( parser, "updatePolicy", null, parsed ) )
3859             {
3860                 repositoryPolicy.setUpdatePolicy( getTrimmedValue( parser.nextText() ) );
3861             }
3862             else if ( checkFieldWithDuplicate( parser, "checksumPolicy", null, parsed ) )
3863             {
3864                 repositoryPolicy.setChecksumPolicy( getTrimmedValue( parser.nextText() ) );
3865             }
3866             else
3867             {
3868                 checkUnknownElement( parser, strict );
3869             }
3870         }
3871         return repositoryPolicy;
3872     } //-- RepositoryPolicy parseRepositoryPolicy( XmlPullParser, boolean )
3873 
3874     /**
3875      * Method parseResource.
3876      * 
3877      * @param parser
3878      * @param strict
3879      * @throws IOException
3880      * @throws XmlPullParserException
3881      * @return Resource
3882      */
3883     private Resource parseResource( XmlPullParser parser, boolean strict )
3884         throws IOException, XmlPullParserException
3885     {
3886         String tagName = parser.getName();
3887         Resource resource = new Resource();
3888         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3889         {
3890             String name = parser.getAttributeName( i );
3891             String value = parser.getAttributeValue( i );
3892 
3893             if ( name.indexOf( ':' ) >= 0 )
3894             {
3895                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3896             }
3897             else
3898             {
3899                 checkUnknownAttribute( parser, name, tagName, strict );
3900             }
3901         }
3902         java.util.Set parsed = new java.util.HashSet();
3903         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3904         {
3905             if ( checkFieldWithDuplicate( parser, "targetPath", null, parsed ) )
3906             {
3907                 resource.setTargetPath( getTrimmedValue( parser.nextText() ) );
3908             }
3909             else if ( checkFieldWithDuplicate( parser, "filtering", null, parsed ) )
3910             {
3911                 resource.setFiltering( getTrimmedValue( parser.nextText() ) );
3912             }
3913             else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
3914             {
3915                 resource.setDirectory( getTrimmedValue( parser.nextText() ) );
3916             }
3917             else if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
3918             {
3919                 java.util.List includes = new java.util.ArrayList/*<String>*/();
3920                 resource.setIncludes( includes );
3921                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3922                 {
3923                     if ( "include".equals( parser.getName() ) )
3924                     {
3925                         includes.add( getTrimmedValue( parser.nextText() ) );
3926                     }
3927                     else
3928                     {
3929                         checkUnknownElement( parser, strict );
3930                     }
3931                 }
3932             }
3933             else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
3934             {
3935                 java.util.List excludes = new java.util.ArrayList/*<String>*/();
3936                 resource.setExcludes( excludes );
3937                 while ( parser.nextTag() == XmlPullParser.START_TAG )
3938                 {
3939                     if ( "exclude".equals( parser.getName() ) )
3940                     {
3941                         excludes.add( getTrimmedValue( parser.nextText() ) );
3942                     }
3943                     else
3944                     {
3945                         checkUnknownElement( parser, strict );
3946                     }
3947                 }
3948             }
3949             else
3950             {
3951                 checkUnknownElement( parser, strict );
3952             }
3953         }
3954         return resource;
3955     } //-- Resource parseResource( XmlPullParser, boolean )
3956 
3957     /**
3958      * Method parseScm.
3959      * 
3960      * @param parser
3961      * @param strict
3962      * @throws IOException
3963      * @throws XmlPullParserException
3964      * @return Scm
3965      */
3966     private Scm parseScm( XmlPullParser parser, boolean strict )
3967         throws IOException, XmlPullParserException
3968     {
3969         String tagName = parser.getName();
3970         Scm scm = new Scm();
3971         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
3972         {
3973             String name = parser.getAttributeName( i );
3974             String value = parser.getAttributeValue( i );
3975 
3976             if ( name.indexOf( ':' ) >= 0 )
3977             {
3978                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
3979             }
3980             else
3981             {
3982                 checkUnknownAttribute( parser, name, tagName, strict );
3983             }
3984         }
3985         java.util.Set parsed = new java.util.HashSet();
3986         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
3987         {
3988             if ( checkFieldWithDuplicate( parser, "connection", null, parsed ) )
3989             {
3990                 scm.setConnection( getTrimmedValue( parser.nextText() ) );
3991             }
3992             else if ( checkFieldWithDuplicate( parser, "developerConnection", null, parsed ) )
3993             {
3994                 scm.setDeveloperConnection( getTrimmedValue( parser.nextText() ) );
3995             }
3996             else if ( checkFieldWithDuplicate( parser, "tag", null, parsed ) )
3997             {
3998                 scm.setTag( getTrimmedValue( parser.nextText() ) );
3999             }
4000             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
4001             {
4002                 scm.setUrl( getTrimmedValue( parser.nextText() ) );
4003             }
4004             else
4005             {
4006                 checkUnknownElement( parser, strict );
4007             }
4008         }
4009         return scm;
4010     } //-- Scm parseScm( XmlPullParser, boolean )
4011 
4012     /**
4013      * Method parseSite.
4014      * 
4015      * @param parser
4016      * @param strict
4017      * @throws IOException
4018      * @throws XmlPullParserException
4019      * @return Site
4020      */
4021     private Site parseSite( XmlPullParser parser, boolean strict )
4022         throws IOException, XmlPullParserException
4023     {
4024         String tagName = parser.getName();
4025         Site site = new Site();
4026         for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
4027         {
4028             String name = parser.getAttributeName( i );
4029             String value = parser.getAttributeValue( i );
4030 
4031             if ( name.indexOf( ':' ) >= 0 )
4032             {
4033                 // just ignore attributes with non-default namespace (for example: xmlns:xsi)
4034             }
4035             else
4036             {
4037                 checkUnknownAttribute( parser, name, tagName, strict );
4038             }
4039         }
4040         java.util.Set parsed = new java.util.HashSet();
4041         while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
4042         {
4043             if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
4044             {
4045                 site.setId( getTrimmedValue( parser.nextText() ) );
4046             }
4047             else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
4048             {
4049                 site.setName( getTrimmedValue( parser.nextText() ) );
4050             }
4051             else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
4052             {
4053                 site.setUrl( getTrimmedValue( parser.nextText() ) );
4054             }
4055             else
4056             {
4057                 checkUnknownElement( parser, strict );
4058             }
4059         }
4060         return site;
4061     } //-- Site parseSite( XmlPullParser, boolean )
4062 
4063     /**
4064      * Method read.
4065      * 
4066      * @param parser
4067      * @param strict
4068      * @throws IOException
4069      * @throws XmlPullParserException
4070      * @return Model
4071      */
4072     private Model read( XmlPullParser parser, boolean strict )
4073         throws IOException, XmlPullParserException
4074     {
4075         int eventType = parser.getEventType();
4076         while ( eventType != XmlPullParser.END_DOCUMENT )
4077         {
4078             if ( eventType == XmlPullParser.START_TAG )
4079             {
4080                 if ( strict && ! "project".equals( parser.getName() ) )
4081                 {
4082                     throw new XmlPullParserException( "Expected root element 'project' but found '" + parser.getName() + "'", parser, null );
4083                 }
4084                 Model model = parseModel( parser, strict );
4085                 model.setModelEncoding( parser.getInputEncoding() );
4086                 return model;
4087             }
4088             eventType = parser.next();
4089         }
4090         throw new XmlPullParserException( "Expected root element 'project' but found no element at all: invalid XML document", parser, null );
4091     } //-- Model read( XmlPullParser, boolean )
4092 
4093     /**
4094      * Sets the state of the "add default entities" flag.
4095      * 
4096      * @param addDefaultEntities
4097      */
4098     public void setAddDefaultEntities( boolean addDefaultEntities )
4099     {
4100         this.addDefaultEntities = addDefaultEntities;
4101     } //-- void setAddDefaultEntities( boolean )
4102 
4103 }