001    // =================== DO NOT EDIT THIS FILE ====================
002    // Generated by Modello 1.7,
003    // any modifications will be overwritten.
004    // ==============================================================
005    
006    package org.apache.maven.settings.io.xpp3;
007    
008      //---------------------------------/
009     //- Imported classes and packages -/
010    //---------------------------------/
011    
012    import java.io.IOException;
013    import java.io.InputStream;
014    import java.io.Reader;
015    import java.text.DateFormat;
016    import org.apache.maven.settings.Activation;
017    import org.apache.maven.settings.ActivationFile;
018    import org.apache.maven.settings.ActivationOS;
019    import org.apache.maven.settings.ActivationProperty;
020    import org.apache.maven.settings.IdentifiableBase;
021    import org.apache.maven.settings.Mirror;
022    import org.apache.maven.settings.Profile;
023    import org.apache.maven.settings.Proxy;
024    import org.apache.maven.settings.Repository;
025    import org.apache.maven.settings.RepositoryBase;
026    import org.apache.maven.settings.RepositoryPolicy;
027    import org.apache.maven.settings.Server;
028    import org.apache.maven.settings.Settings;
029    import org.apache.maven.settings.TrackableBase;
030    import org.codehaus.plexus.util.ReaderFactory;
031    import org.codehaus.plexus.util.xml.pull.MXParser;
032    import org.codehaus.plexus.util.xml.pull.XmlPullParser;
033    import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
034    
035    /**
036     * Class SettingsXpp3Reader.
037     * 
038     * @version $Revision$ $Date$
039     */
040    @SuppressWarnings( "all" )
041    public class SettingsXpp3Reader
042    {
043    
044          //--------------------------/
045         //- Class/Member Variables -/
046        //--------------------------/
047    
048        /**
049         * If set the parser will be loaded with all single characters
050         * from the XHTML specification.
051         * The entities used:
052         * <ul>
053         * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li>
054         * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li>
055         * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li>
056         * </ul>
057         */
058        private boolean addDefaultEntities = true;
059    
060    
061          //-----------/
062         //- Methods -/
063        //-----------/
064    
065        /**
066         * Method checkFieldWithDuplicate.
067         * 
068         * @param parser
069         * @param parsed
070         * @param alias
071         * @param tagName
072         * @throws XmlPullParserException
073         * @return boolean
074         */
075        private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed )
076            throws XmlPullParserException
077        {
078            if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
079            {
080                return false;
081            }
082            if ( !parsed.add( tagName ) )
083            {
084                throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
085            }
086            return true;
087        } //-- boolean checkFieldWithDuplicate( XmlPullParser, String, String, java.util.Set )
088    
089        /**
090         * Method checkUnknownAttribute.
091         * 
092         * @param parser
093         * @param strict
094         * @param tagName
095         * @param attribute
096         * @throws XmlPullParserException
097         * @throws IOException
098         */
099        private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict )
100            throws XmlPullParserException, IOException
101        {
102            // strictXmlAttributes = true for model: if strict == true, not only elements are checked but attributes too
103            if ( strict )
104            {
105                throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null );
106            }
107        } //-- void checkUnknownAttribute( XmlPullParser, String, String, boolean )
108    
109        /**
110         * Method checkUnknownElement.
111         * 
112         * @param parser
113         * @param strict
114         * @throws XmlPullParserException
115         * @throws IOException
116         */
117        private void checkUnknownElement( XmlPullParser parser, boolean strict )
118            throws XmlPullParserException, IOException
119        {
120            if ( strict )
121            {
122                throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
123            }
124    
125            for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; )
126            {
127                int eventType = parser.next();
128                if ( eventType == XmlPullParser.START_TAG )
129                {
130                    unrecognizedTagCount++;
131                }
132                else if ( eventType == XmlPullParser.END_TAG )
133                {
134                    unrecognizedTagCount--;
135                }
136            }
137        } //-- void checkUnknownElement( XmlPullParser, boolean )
138    
139        /**
140         * Returns the state of the "add default entities" flag.
141         * 
142         * @return boolean
143         */
144        public boolean getAddDefaultEntities()
145        {
146            return addDefaultEntities;
147        } //-- boolean getAddDefaultEntities()
148    
149        /**
150         * Method getBooleanValue.
151         * 
152         * @param s
153         * @param parser
154         * @param attribute
155         * @throws XmlPullParserException
156         * @return boolean
157         */
158        private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
159            throws XmlPullParserException
160        {
161            return getBooleanValue( s, attribute, parser, null );
162        } //-- boolean getBooleanValue( String, String, XmlPullParser )
163    
164        /**
165         * Method getBooleanValue.
166         * 
167         * @param s
168         * @param defaultValue
169         * @param parser
170         * @param attribute
171         * @throws XmlPullParserException
172         * @return boolean
173         */
174        private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
175            throws XmlPullParserException
176        {
177            if ( s != null && s.length() != 0 )
178            {
179                return Boolean.valueOf( s ).booleanValue();
180            }
181            if ( defaultValue != null )
182            {
183                return Boolean.valueOf( defaultValue ).booleanValue();
184            }
185            return false;
186        } //-- boolean getBooleanValue( String, String, XmlPullParser, String )
187    
188        /**
189         * Method getByteValue.
190         * 
191         * @param s
192         * @param strict
193         * @param parser
194         * @param attribute
195         * @throws XmlPullParserException
196         * @return byte
197         */
198        private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
199            throws XmlPullParserException
200        {
201            if ( s != null )
202            {
203                try
204                {
205                    return Byte.valueOf( s ).byteValue();
206                }
207                catch ( NumberFormatException nfe )
208                {
209                    if ( strict )
210                    {
211                        throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe );
212                    }
213                }
214            }
215            return 0;
216        } //-- byte getByteValue( String, String, XmlPullParser, boolean )
217    
218        /**
219         * Method getCharacterValue.
220         * 
221         * @param s
222         * @param parser
223         * @param attribute
224         * @throws XmlPullParserException
225         * @return char
226         */
227        private char getCharacterValue( String s, String attribute, XmlPullParser parser )
228            throws XmlPullParserException
229        {
230            if ( s != null )
231            {
232                return s.charAt( 0 );
233            }
234            return 0;
235        } //-- char getCharacterValue( String, String, XmlPullParser )
236    
237        /**
238         * Method getDateValue.
239         * 
240         * @param s
241         * @param parser
242         * @param attribute
243         * @throws XmlPullParserException
244         * @return Date
245         */
246        private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
247            throws XmlPullParserException
248        {
249            return getDateValue( s, attribute, null, parser );
250        } //-- java.util.Date getDateValue( String, String, XmlPullParser )
251    
252        /**
253         * Method getDateValue.
254         * 
255         * @param s
256         * @param parser
257         * @param dateFormat
258         * @param attribute
259         * @throws XmlPullParserException
260         * @return Date
261         */
262        private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
263            throws XmlPullParserException
264        {
265            if ( s != null )
266            {
267                String effectiveDateFormat = dateFormat;
268                if ( dateFormat == null )
269                {
270                    effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
271                }
272                if ( "long".equals( effectiveDateFormat ) )
273                {
274                    try
275                    {
276                        return new java.util.Date( Long.parseLong( s ) );
277                    }
278                    catch ( NumberFormatException e )
279                    {
280                        throw new XmlPullParserException( e.getMessage(), parser, e );
281                    }
282                }
283                else
284                {
285                    try
286                    {
287                        DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, java.util.Locale.US );
288                        return dateParser.parse( s );
289                    }
290                    catch ( java.text.ParseException e )
291                    {
292                        throw new XmlPullParserException( e.getMessage(), parser, e );
293                    }
294                }
295            }
296            return null;
297        } //-- java.util.Date getDateValue( String, String, String, XmlPullParser )
298    
299        /**
300         * Method getDoubleValue.
301         * 
302         * @param s
303         * @param strict
304         * @param parser
305         * @param attribute
306         * @throws XmlPullParserException
307         * @return double
308         */
309        private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
310            throws XmlPullParserException
311        {
312            if ( s != null )
313            {
314                try
315                {
316                    return Double.valueOf( s ).doubleValue();
317                }
318                catch ( NumberFormatException nfe )
319                {
320                    if ( strict )
321                    {
322                        throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
323                    }
324                }
325            }
326            return 0;
327        } //-- double getDoubleValue( String, String, XmlPullParser, boolean )
328    
329        /**
330         * Method getFloatValue.
331         * 
332         * @param s
333         * @param strict
334         * @param parser
335         * @param attribute
336         * @throws XmlPullParserException
337         * @return float
338         */
339        private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
340            throws XmlPullParserException
341        {
342            if ( s != null )
343            {
344                try
345                {
346                    return Float.valueOf( s ).floatValue();
347                }
348                catch ( NumberFormatException nfe )
349                {
350                    if ( strict )
351                    {
352                        throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe );
353                    }
354                }
355            }
356            return 0;
357        } //-- float getFloatValue( String, String, XmlPullParser, boolean )
358    
359        /**
360         * Method getIntegerValue.
361         * 
362         * @param s
363         * @param strict
364         * @param parser
365         * @param attribute
366         * @throws XmlPullParserException
367         * @return int
368         */
369        private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
370            throws XmlPullParserException
371        {
372            if ( s != null )
373            {
374                try
375                {
376                    return Integer.valueOf( s ).intValue();
377                }
378                catch ( NumberFormatException nfe )
379                {
380                    if ( strict )
381                    {
382                        throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe );
383                    }
384                }
385            }
386            return 0;
387        } //-- int getIntegerValue( String, String, XmlPullParser, boolean )
388    
389        /**
390         * Method getLongValue.
391         * 
392         * @param s
393         * @param strict
394         * @param parser
395         * @param attribute
396         * @throws XmlPullParserException
397         * @return long
398         */
399        private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
400            throws XmlPullParserException
401        {
402            if ( s != null )
403            {
404                try
405                {
406                    return Long.valueOf( s ).longValue();
407                }
408                catch ( NumberFormatException nfe )
409                {
410                    if ( strict )
411                    {
412                        throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe );
413                    }
414                }
415            }
416            return 0;
417        } //-- long getLongValue( String, String, XmlPullParser, boolean )
418    
419        /**
420         * Method getRequiredAttributeValue.
421         * 
422         * @param s
423         * @param strict
424         * @param parser
425         * @param attribute
426         * @throws XmlPullParserException
427         * @return String
428         */
429        private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
430            throws XmlPullParserException
431        {
432            if ( s == null )
433            {
434                if ( strict )
435                {
436                    throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
437                }
438            }
439            return s;
440        } //-- String getRequiredAttributeValue( String, String, XmlPullParser, boolean )
441    
442        /**
443         * Method getShortValue.
444         * 
445         * @param s
446         * @param strict
447         * @param parser
448         * @param attribute
449         * @throws XmlPullParserException
450         * @return short
451         */
452        private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
453            throws XmlPullParserException
454        {
455            if ( s != null )
456            {
457                try
458                {
459                    return Short.valueOf( s ).shortValue();
460                }
461                catch ( NumberFormatException nfe )
462                {
463                    if ( strict )
464                    {
465                        throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe );
466                    }
467                }
468            }
469            return 0;
470        } //-- short getShortValue( String, String, XmlPullParser, boolean )
471    
472        /**
473         * Method getTrimmedValue.
474         * 
475         * @param s
476         * @return String
477         */
478        private String getTrimmedValue( String s )
479        {
480            if ( s != null )
481            {
482                s = s.trim();
483            }
484            return s;
485        } //-- String getTrimmedValue( String )
486    
487        /**
488         * Method initParser.
489         * 
490         * @param parser
491         * @throws XmlPullParserException
492         */
493        private void initParser( XmlPullParser parser )
494            throws XmlPullParserException
495        {
496            if ( addDefaultEntities )
497            {
498                // ----------------------------------------------------------------------
499                // Latin 1 entities
500                // ----------------------------------------------------------------------
501    
502                parser.defineEntityReplacementText( "nbsp", "\u00a0" );
503                parser.defineEntityReplacementText( "iexcl", "\u00a1" );
504                parser.defineEntityReplacementText( "cent", "\u00a2" );
505                parser.defineEntityReplacementText( "pound", "\u00a3" );
506                parser.defineEntityReplacementText( "curren", "\u00a4" );
507                parser.defineEntityReplacementText( "yen", "\u00a5" );
508                parser.defineEntityReplacementText( "brvbar", "\u00a6" );
509                parser.defineEntityReplacementText( "sect", "\u00a7" );
510                parser.defineEntityReplacementText( "uml", "\u00a8" );
511                parser.defineEntityReplacementText( "copy", "\u00a9" );
512                parser.defineEntityReplacementText( "ordf", "\u00aa" );
513                parser.defineEntityReplacementText( "laquo", "\u00ab" );
514                parser.defineEntityReplacementText( "not", "\u00ac" );
515                parser.defineEntityReplacementText( "shy", "\u00ad" );
516                parser.defineEntityReplacementText( "reg", "\u00ae" );
517                parser.defineEntityReplacementText( "macr", "\u00af" );
518                parser.defineEntityReplacementText( "deg", "\u00b0" );
519                parser.defineEntityReplacementText( "plusmn", "\u00b1" );
520                parser.defineEntityReplacementText( "sup2", "\u00b2" );
521                parser.defineEntityReplacementText( "sup3", "\u00b3" );
522                parser.defineEntityReplacementText( "acute", "\u00b4" );
523                parser.defineEntityReplacementText( "micro", "\u00b5" );
524                parser.defineEntityReplacementText( "para", "\u00b6" );
525                parser.defineEntityReplacementText( "middot", "\u00b7" );
526                parser.defineEntityReplacementText( "cedil", "\u00b8" );
527                parser.defineEntityReplacementText( "sup1", "\u00b9" );
528                parser.defineEntityReplacementText( "ordm", "\u00ba" );
529                parser.defineEntityReplacementText( "raquo", "\u00bb" );
530                parser.defineEntityReplacementText( "frac14", "\u00bc" );
531                parser.defineEntityReplacementText( "frac12", "\u00bd" );
532                parser.defineEntityReplacementText( "frac34", "\u00be" );
533                parser.defineEntityReplacementText( "iquest", "\u00bf" );
534                parser.defineEntityReplacementText( "Agrave", "\u00c0" );
535                parser.defineEntityReplacementText( "Aacute", "\u00c1" );
536                parser.defineEntityReplacementText( "Acirc", "\u00c2" );
537                parser.defineEntityReplacementText( "Atilde", "\u00c3" );
538                parser.defineEntityReplacementText( "Auml", "\u00c4" );
539                parser.defineEntityReplacementText( "Aring", "\u00c5" );
540                parser.defineEntityReplacementText( "AElig", "\u00c6" );
541                parser.defineEntityReplacementText( "Ccedil", "\u00c7" );
542                parser.defineEntityReplacementText( "Egrave", "\u00c8" );
543                parser.defineEntityReplacementText( "Eacute", "\u00c9" );
544                parser.defineEntityReplacementText( "Ecirc", "\u00ca" );
545                parser.defineEntityReplacementText( "Euml", "\u00cb" );
546                parser.defineEntityReplacementText( "Igrave", "\u00cc" );
547                parser.defineEntityReplacementText( "Iacute", "\u00cd" );
548                parser.defineEntityReplacementText( "Icirc", "\u00ce" );
549                parser.defineEntityReplacementText( "Iuml", "\u00cf" );
550                parser.defineEntityReplacementText( "ETH", "\u00d0" );
551                parser.defineEntityReplacementText( "Ntilde", "\u00d1" );
552                parser.defineEntityReplacementText( "Ograve", "\u00d2" );
553                parser.defineEntityReplacementText( "Oacute", "\u00d3" );
554                parser.defineEntityReplacementText( "Ocirc", "\u00d4" );
555                parser.defineEntityReplacementText( "Otilde", "\u00d5" );
556                parser.defineEntityReplacementText( "Ouml", "\u00d6" );
557                parser.defineEntityReplacementText( "times", "\u00d7" );
558                parser.defineEntityReplacementText( "Oslash", "\u00d8" );
559                parser.defineEntityReplacementText( "Ugrave", "\u00d9" );
560                parser.defineEntityReplacementText( "Uacute", "\u00da" );
561                parser.defineEntityReplacementText( "Ucirc", "\u00db" );
562                parser.defineEntityReplacementText( "Uuml", "\u00dc" );
563                parser.defineEntityReplacementText( "Yacute", "\u00dd" );
564                parser.defineEntityReplacementText( "THORN", "\u00de" );
565                parser.defineEntityReplacementText( "szlig", "\u00df" );
566                parser.defineEntityReplacementText( "agrave", "\u00e0" );
567                parser.defineEntityReplacementText( "aacute", "\u00e1" );
568                parser.defineEntityReplacementText( "acirc", "\u00e2" );
569                parser.defineEntityReplacementText( "atilde", "\u00e3" );
570                parser.defineEntityReplacementText( "auml", "\u00e4" );
571                parser.defineEntityReplacementText( "aring", "\u00e5" );
572                parser.defineEntityReplacementText( "aelig", "\u00e6" );
573                parser.defineEntityReplacementText( "ccedil", "\u00e7" );
574                parser.defineEntityReplacementText( "egrave", "\u00e8" );
575                parser.defineEntityReplacementText( "eacute", "\u00e9" );
576                parser.defineEntityReplacementText( "ecirc", "\u00ea" );
577                parser.defineEntityReplacementText( "euml", "\u00eb" );
578                parser.defineEntityReplacementText( "igrave", "\u00ec" );
579                parser.defineEntityReplacementText( "iacute", "\u00ed" );
580                parser.defineEntityReplacementText( "icirc", "\u00ee" );
581                parser.defineEntityReplacementText( "iuml", "\u00ef" );
582                parser.defineEntityReplacementText( "eth", "\u00f0" );
583                parser.defineEntityReplacementText( "ntilde", "\u00f1" );
584                parser.defineEntityReplacementText( "ograve", "\u00f2" );
585                parser.defineEntityReplacementText( "oacute", "\u00f3" );
586                parser.defineEntityReplacementText( "ocirc", "\u00f4" );
587                parser.defineEntityReplacementText( "otilde", "\u00f5" );
588                parser.defineEntityReplacementText( "ouml", "\u00f6" );
589                parser.defineEntityReplacementText( "divide", "\u00f7" );
590                parser.defineEntityReplacementText( "oslash", "\u00f8" );
591                parser.defineEntityReplacementText( "ugrave", "\u00f9" );
592                parser.defineEntityReplacementText( "uacute", "\u00fa" );
593                parser.defineEntityReplacementText( "ucirc", "\u00fb" );
594                parser.defineEntityReplacementText( "uuml", "\u00fc" );
595                parser.defineEntityReplacementText( "yacute", "\u00fd" );
596                parser.defineEntityReplacementText( "thorn", "\u00fe" );
597                parser.defineEntityReplacementText( "yuml", "\u00ff" );
598    
599                // ----------------------------------------------------------------------
600                // Special entities
601                // ----------------------------------------------------------------------
602    
603                parser.defineEntityReplacementText( "OElig", "\u0152" );
604                parser.defineEntityReplacementText( "oelig", "\u0153" );
605                parser.defineEntityReplacementText( "Scaron", "\u0160" );
606                parser.defineEntityReplacementText( "scaron", "\u0161" );
607                parser.defineEntityReplacementText( "Yuml", "\u0178" );
608                parser.defineEntityReplacementText( "circ", "\u02c6" );
609                parser.defineEntityReplacementText( "tilde", "\u02dc" );
610                parser.defineEntityReplacementText( "ensp", "\u2002" );
611                parser.defineEntityReplacementText( "emsp", "\u2003" );
612                parser.defineEntityReplacementText( "thinsp", "\u2009" );
613                parser.defineEntityReplacementText( "zwnj", "\u200c" );
614                parser.defineEntityReplacementText( "zwj", "\u200d" );
615                parser.defineEntityReplacementText( "lrm", "\u200e" );
616                parser.defineEntityReplacementText( "rlm", "\u200f" );
617                parser.defineEntityReplacementText( "ndash", "\u2013" );
618                parser.defineEntityReplacementText( "mdash", "\u2014" );
619                parser.defineEntityReplacementText( "lsquo", "\u2018" );
620                parser.defineEntityReplacementText( "rsquo", "\u2019" );
621                parser.defineEntityReplacementText( "sbquo", "\u201a" );
622                parser.defineEntityReplacementText( "ldquo", "\u201c" );
623                parser.defineEntityReplacementText( "rdquo", "\u201d" );
624                parser.defineEntityReplacementText( "bdquo", "\u201e" );
625                parser.defineEntityReplacementText( "dagger", "\u2020" );
626                parser.defineEntityReplacementText( "Dagger", "\u2021" );
627                parser.defineEntityReplacementText( "permil", "\u2030" );
628                parser.defineEntityReplacementText( "lsaquo", "\u2039" );
629                parser.defineEntityReplacementText( "rsaquo", "\u203a" );
630                parser.defineEntityReplacementText( "euro", "\u20ac" );
631    
632                // ----------------------------------------------------------------------
633                // Symbol entities
634                // ----------------------------------------------------------------------
635    
636                parser.defineEntityReplacementText( "fnof", "\u0192" );
637                parser.defineEntityReplacementText( "Alpha", "\u0391" );
638                parser.defineEntityReplacementText( "Beta", "\u0392" );
639                parser.defineEntityReplacementText( "Gamma", "\u0393" );
640                parser.defineEntityReplacementText( "Delta", "\u0394" );
641                parser.defineEntityReplacementText( "Epsilon", "\u0395" );
642                parser.defineEntityReplacementText( "Zeta", "\u0396" );
643                parser.defineEntityReplacementText( "Eta", "\u0397" );
644                parser.defineEntityReplacementText( "Theta", "\u0398" );
645                parser.defineEntityReplacementText( "Iota", "\u0399" );
646                parser.defineEntityReplacementText( "Kappa", "\u039a" );
647                parser.defineEntityReplacementText( "Lambda", "\u039b" );
648                parser.defineEntityReplacementText( "Mu", "\u039c" );
649                parser.defineEntityReplacementText( "Nu", "\u039d" );
650                parser.defineEntityReplacementText( "Xi", "\u039e" );
651                parser.defineEntityReplacementText( "Omicron", "\u039f" );
652                parser.defineEntityReplacementText( "Pi", "\u03a0" );
653                parser.defineEntityReplacementText( "Rho", "\u03a1" );
654                parser.defineEntityReplacementText( "Sigma", "\u03a3" );
655                parser.defineEntityReplacementText( "Tau", "\u03a4" );
656                parser.defineEntityReplacementText( "Upsilon", "\u03a5" );
657                parser.defineEntityReplacementText( "Phi", "\u03a6" );
658                parser.defineEntityReplacementText( "Chi", "\u03a7" );
659                parser.defineEntityReplacementText( "Psi", "\u03a8" );
660                parser.defineEntityReplacementText( "Omega", "\u03a9" );
661                parser.defineEntityReplacementText( "alpha", "\u03b1" );
662                parser.defineEntityReplacementText( "beta", "\u03b2" );
663                parser.defineEntityReplacementText( "gamma", "\u03b3" );
664                parser.defineEntityReplacementText( "delta", "\u03b4" );
665                parser.defineEntityReplacementText( "epsilon", "\u03b5" );
666                parser.defineEntityReplacementText( "zeta", "\u03b6" );
667                parser.defineEntityReplacementText( "eta", "\u03b7" );
668                parser.defineEntityReplacementText( "theta", "\u03b8" );
669                parser.defineEntityReplacementText( "iota", "\u03b9" );
670                parser.defineEntityReplacementText( "kappa", "\u03ba" );
671                parser.defineEntityReplacementText( "lambda", "\u03bb" );
672                parser.defineEntityReplacementText( "mu", "\u03bc" );
673                parser.defineEntityReplacementText( "nu", "\u03bd" );
674                parser.defineEntityReplacementText( "xi", "\u03be" );
675                parser.defineEntityReplacementText( "omicron", "\u03bf" );
676                parser.defineEntityReplacementText( "pi", "\u03c0" );
677                parser.defineEntityReplacementText( "rho", "\u03c1" );
678                parser.defineEntityReplacementText( "sigmaf", "\u03c2" );
679                parser.defineEntityReplacementText( "sigma", "\u03c3" );
680                parser.defineEntityReplacementText( "tau", "\u03c4" );
681                parser.defineEntityReplacementText( "upsilon", "\u03c5" );
682                parser.defineEntityReplacementText( "phi", "\u03c6" );
683                parser.defineEntityReplacementText( "chi", "\u03c7" );
684                parser.defineEntityReplacementText( "psi", "\u03c8" );
685                parser.defineEntityReplacementText( "omega", "\u03c9" );
686                parser.defineEntityReplacementText( "thetasym", "\u03d1" );
687                parser.defineEntityReplacementText( "upsih", "\u03d2" );
688                parser.defineEntityReplacementText( "piv", "\u03d6" );
689                parser.defineEntityReplacementText( "bull", "\u2022" );
690                parser.defineEntityReplacementText( "hellip", "\u2026" );
691                parser.defineEntityReplacementText( "prime", "\u2032" );
692                parser.defineEntityReplacementText( "Prime", "\u2033" );
693                parser.defineEntityReplacementText( "oline", "\u203e" );
694                parser.defineEntityReplacementText( "frasl", "\u2044" );
695                parser.defineEntityReplacementText( "weierp", "\u2118" );
696                parser.defineEntityReplacementText( "image", "\u2111" );
697                parser.defineEntityReplacementText( "real", "\u211c" );
698                parser.defineEntityReplacementText( "trade", "\u2122" );
699                parser.defineEntityReplacementText( "alefsym", "\u2135" );
700                parser.defineEntityReplacementText( "larr", "\u2190" );
701                parser.defineEntityReplacementText( "uarr", "\u2191" );
702                parser.defineEntityReplacementText( "rarr", "\u2192" );
703                parser.defineEntityReplacementText( "darr", "\u2193" );
704                parser.defineEntityReplacementText( "harr", "\u2194" );
705                parser.defineEntityReplacementText( "crarr", "\u21b5" );
706                parser.defineEntityReplacementText( "lArr", "\u21d0" );
707                parser.defineEntityReplacementText( "uArr", "\u21d1" );
708                parser.defineEntityReplacementText( "rArr", "\u21d2" );
709                parser.defineEntityReplacementText( "dArr", "\u21d3" );
710                parser.defineEntityReplacementText( "hArr", "\u21d4" );
711                parser.defineEntityReplacementText( "forall", "\u2200" );
712                parser.defineEntityReplacementText( "part", "\u2202" );
713                parser.defineEntityReplacementText( "exist", "\u2203" );
714                parser.defineEntityReplacementText( "empty", "\u2205" );
715                parser.defineEntityReplacementText( "nabla", "\u2207" );
716                parser.defineEntityReplacementText( "isin", "\u2208" );
717                parser.defineEntityReplacementText( "notin", "\u2209" );
718                parser.defineEntityReplacementText( "ni", "\u220b" );
719                parser.defineEntityReplacementText( "prod", "\u220f" );
720                parser.defineEntityReplacementText( "sum", "\u2211" );
721                parser.defineEntityReplacementText( "minus", "\u2212" );
722                parser.defineEntityReplacementText( "lowast", "\u2217" );
723                parser.defineEntityReplacementText( "radic", "\u221a" );
724                parser.defineEntityReplacementText( "prop", "\u221d" );
725                parser.defineEntityReplacementText( "infin", "\u221e" );
726                parser.defineEntityReplacementText( "ang", "\u2220" );
727                parser.defineEntityReplacementText( "and", "\u2227" );
728                parser.defineEntityReplacementText( "or", "\u2228" );
729                parser.defineEntityReplacementText( "cap", "\u2229" );
730                parser.defineEntityReplacementText( "cup", "\u222a" );
731                parser.defineEntityReplacementText( "int", "\u222b" );
732                parser.defineEntityReplacementText( "there4", "\u2234" );
733                parser.defineEntityReplacementText( "sim", "\u223c" );
734                parser.defineEntityReplacementText( "cong", "\u2245" );
735                parser.defineEntityReplacementText( "asymp", "\u2248" );
736                parser.defineEntityReplacementText( "ne", "\u2260" );
737                parser.defineEntityReplacementText( "equiv", "\u2261" );
738                parser.defineEntityReplacementText( "le", "\u2264" );
739                parser.defineEntityReplacementText( "ge", "\u2265" );
740                parser.defineEntityReplacementText( "sub", "\u2282" );
741                parser.defineEntityReplacementText( "sup", "\u2283" );
742                parser.defineEntityReplacementText( "nsub", "\u2284" );
743                parser.defineEntityReplacementText( "sube", "\u2286" );
744                parser.defineEntityReplacementText( "supe", "\u2287" );
745                parser.defineEntityReplacementText( "oplus", "\u2295" );
746                parser.defineEntityReplacementText( "otimes", "\u2297" );
747                parser.defineEntityReplacementText( "perp", "\u22a5" );
748                parser.defineEntityReplacementText( "sdot", "\u22c5" );
749                parser.defineEntityReplacementText( "lceil", "\u2308" );
750                parser.defineEntityReplacementText( "rceil", "\u2309" );
751                parser.defineEntityReplacementText( "lfloor", "\u230a" );
752                parser.defineEntityReplacementText( "rfloor", "\u230b" );
753                parser.defineEntityReplacementText( "lang", "\u2329" );
754                parser.defineEntityReplacementText( "rang", "\u232a" );
755                parser.defineEntityReplacementText( "loz", "\u25ca" );
756                parser.defineEntityReplacementText( "spades", "\u2660" );
757                parser.defineEntityReplacementText( "clubs", "\u2663" );
758                parser.defineEntityReplacementText( "hearts", "\u2665" );
759                parser.defineEntityReplacementText( "diams", "\u2666" );
760    
761            }
762        } //-- void initParser( XmlPullParser )
763    
764        /**
765         * Method nextTag.
766         * 
767         * @param parser
768         * @throws IOException
769         * @throws XmlPullParserException
770         * @return int
771         */
772        private int nextTag( XmlPullParser parser )
773            throws IOException, XmlPullParserException
774        {
775            int eventType = parser.next();
776            if ( eventType == XmlPullParser.TEXT )
777            {
778                eventType = parser.next();
779            }
780            if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG )
781            {
782                throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null );
783            }
784            return eventType;
785        } //-- int nextTag( XmlPullParser )
786    
787        /**
788         * @see ReaderFactory#newXmlReader
789         * 
790         * @param reader
791         * @param strict
792         * @throws IOException
793         * @throws XmlPullParserException
794         * @return Settings
795         */
796        public Settings read( Reader reader, boolean strict )
797            throws IOException, XmlPullParserException
798        {
799            XmlPullParser parser = new MXParser();
800    
801            parser.setInput( reader );
802    
803            initParser( parser );
804    
805            return read( parser, strict );
806        } //-- Settings read( Reader, boolean )
807    
808        /**
809         * @see ReaderFactory#newXmlReader
810         * 
811         * @param reader
812         * @throws IOException
813         * @throws XmlPullParserException
814         * @return Settings
815         */
816        public Settings read( Reader reader )
817            throws IOException, XmlPullParserException
818        {
819            return read( reader, true );
820        } //-- Settings read( Reader )
821    
822        /**
823         * Method read.
824         * 
825         * @param in
826         * @param strict
827         * @throws IOException
828         * @throws XmlPullParserException
829         * @return Settings
830         */
831        public Settings read( InputStream in, boolean strict )
832            throws IOException, XmlPullParserException
833        {
834            return read( ReaderFactory.newXmlReader( in ), strict );
835        } //-- Settings read( InputStream, boolean )
836    
837        /**
838         * Method read.
839         * 
840         * @param in
841         * @throws IOException
842         * @throws XmlPullParserException
843         * @return Settings
844         */
845        public Settings read( InputStream in )
846            throws IOException, XmlPullParserException
847        {
848            return read( ReaderFactory.newXmlReader( in ) );
849        } //-- Settings read( InputStream )
850    
851        /**
852         * Method parseActivation.
853         * 
854         * @param parser
855         * @param strict
856         * @throws IOException
857         * @throws XmlPullParserException
858         * @return Activation
859         */
860        private Activation parseActivation( XmlPullParser parser, boolean strict )
861            throws IOException, XmlPullParserException
862        {
863            String tagName = parser.getName();
864            Activation activation = new Activation();
865            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
866            {
867                String name = parser.getAttributeName( i );
868                String value = parser.getAttributeValue( i );
869    
870                if ( name.indexOf( ':' ) >= 0 )
871                {
872                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
873                }
874                else
875                {
876                    checkUnknownAttribute( parser, name, tagName, strict );
877                }
878            }
879            java.util.Set parsed = new java.util.HashSet();
880            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
881            {
882                if ( checkFieldWithDuplicate( parser, "activeByDefault", null, parsed ) )
883                {
884                    activation.setActiveByDefault( getBooleanValue( getTrimmedValue( parser.nextText() ), "activeByDefault", parser, "false" ) );
885                }
886                else if ( checkFieldWithDuplicate( parser, "jdk", null, parsed ) )
887                {
888                    activation.setJdk( getTrimmedValue( parser.nextText() ) );
889                }
890                else if ( checkFieldWithDuplicate( parser, "os", null, parsed ) )
891                {
892                    activation.setOs( parseActivationOS( parser, strict ) );
893                }
894                else if ( checkFieldWithDuplicate( parser, "property", null, parsed ) )
895                {
896                    activation.setProperty( parseActivationProperty( parser, strict ) );
897                }
898                else if ( checkFieldWithDuplicate( parser, "file", null, parsed ) )
899                {
900                    activation.setFile( parseActivationFile( parser, strict ) );
901                }
902                else
903                {
904                    checkUnknownElement( parser, strict );
905                }
906            }
907            return activation;
908        } //-- Activation parseActivation( XmlPullParser, boolean )
909    
910        /**
911         * Method parseActivationFile.
912         * 
913         * @param parser
914         * @param strict
915         * @throws IOException
916         * @throws XmlPullParserException
917         * @return ActivationFile
918         */
919        private ActivationFile parseActivationFile( XmlPullParser parser, boolean strict )
920            throws IOException, XmlPullParserException
921        {
922            String tagName = parser.getName();
923            ActivationFile activationFile = new ActivationFile();
924            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
925            {
926                String name = parser.getAttributeName( i );
927                String value = parser.getAttributeValue( i );
928    
929                if ( name.indexOf( ':' ) >= 0 )
930                {
931                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
932                }
933                else
934                {
935                    checkUnknownAttribute( parser, name, tagName, strict );
936                }
937            }
938            java.util.Set parsed = new java.util.HashSet();
939            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
940            {
941                if ( checkFieldWithDuplicate( parser, "missing", null, parsed ) )
942                {
943                    activationFile.setMissing( getTrimmedValue( parser.nextText() ) );
944                }
945                else if ( checkFieldWithDuplicate( parser, "exists", null, parsed ) )
946                {
947                    activationFile.setExists( getTrimmedValue( parser.nextText() ) );
948                }
949                else
950                {
951                    checkUnknownElement( parser, strict );
952                }
953            }
954            return activationFile;
955        } //-- ActivationFile parseActivationFile( XmlPullParser, boolean )
956    
957        /**
958         * Method parseActivationOS.
959         * 
960         * @param parser
961         * @param strict
962         * @throws IOException
963         * @throws XmlPullParserException
964         * @return ActivationOS
965         */
966        private ActivationOS parseActivationOS( XmlPullParser parser, boolean strict )
967            throws IOException, XmlPullParserException
968        {
969            String tagName = parser.getName();
970            ActivationOS activationOS = new ActivationOS();
971            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
972            {
973                String name = parser.getAttributeName( i );
974                String value = parser.getAttributeValue( i );
975    
976                if ( name.indexOf( ':' ) >= 0 )
977                {
978                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
979                }
980                else
981                {
982                    checkUnknownAttribute( parser, name, tagName, strict );
983                }
984            }
985            java.util.Set parsed = new java.util.HashSet();
986            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
987            {
988                if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
989                {
990                    activationOS.setName( getTrimmedValue( parser.nextText() ) );
991                }
992                else if ( checkFieldWithDuplicate( parser, "family", null, parsed ) )
993                {
994                    activationOS.setFamily( getTrimmedValue( parser.nextText() ) );
995                }
996                else if ( checkFieldWithDuplicate( parser, "arch", null, parsed ) )
997                {
998                    activationOS.setArch( getTrimmedValue( parser.nextText() ) );
999                }
1000                else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
1001                {
1002                    activationOS.setVersion( getTrimmedValue( parser.nextText() ) );
1003                }
1004                else
1005                {
1006                    checkUnknownElement( parser, strict );
1007                }
1008            }
1009            return activationOS;
1010        } //-- ActivationOS parseActivationOS( XmlPullParser, boolean )
1011    
1012        /**
1013         * Method parseActivationProperty.
1014         * 
1015         * @param parser
1016         * @param strict
1017         * @throws IOException
1018         * @throws XmlPullParserException
1019         * @return ActivationProperty
1020         */
1021        private ActivationProperty parseActivationProperty( XmlPullParser parser, boolean strict )
1022            throws IOException, XmlPullParserException
1023        {
1024            String tagName = parser.getName();
1025            ActivationProperty activationProperty = new ActivationProperty();
1026            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1027            {
1028                String name = parser.getAttributeName( i );
1029                String value = parser.getAttributeValue( i );
1030    
1031                if ( name.indexOf( ':' ) >= 0 )
1032                {
1033                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1034                }
1035                else
1036                {
1037                    checkUnknownAttribute( parser, name, tagName, strict );
1038                }
1039            }
1040            java.util.Set parsed = new java.util.HashSet();
1041            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1042            {
1043                if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1044                {
1045                    activationProperty.setName( getTrimmedValue( parser.nextText() ) );
1046                }
1047                else if ( checkFieldWithDuplicate( parser, "value", null, parsed ) )
1048                {
1049                    activationProperty.setValue( getTrimmedValue( parser.nextText() ) );
1050                }
1051                else
1052                {
1053                    checkUnknownElement( parser, strict );
1054                }
1055            }
1056            return activationProperty;
1057        } //-- ActivationProperty parseActivationProperty( XmlPullParser, boolean )
1058    
1059        /**
1060         * Method parseIdentifiableBase.
1061         * 
1062         * @param parser
1063         * @param strict
1064         * @throws IOException
1065         * @throws XmlPullParserException
1066         * @return IdentifiableBase
1067         */
1068        private IdentifiableBase parseIdentifiableBase( XmlPullParser parser, boolean strict )
1069            throws IOException, XmlPullParserException
1070        {
1071            String tagName = parser.getName();
1072            IdentifiableBase identifiableBase = new IdentifiableBase();
1073            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1074            {
1075                String name = parser.getAttributeName( i );
1076                String value = parser.getAttributeValue( i );
1077    
1078                if ( name.indexOf( ':' ) >= 0 )
1079                {
1080                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1081                }
1082                else
1083                {
1084                    checkUnknownAttribute( parser, name, tagName, strict );
1085                }
1086            }
1087            java.util.Set parsed = new java.util.HashSet();
1088            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1089            {
1090                if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1091                {
1092                    identifiableBase.setId( getTrimmedValue( parser.nextText() ) );
1093                }
1094                else
1095                {
1096                    checkUnknownElement( parser, strict );
1097                }
1098            }
1099            return identifiableBase;
1100        } //-- IdentifiableBase parseIdentifiableBase( XmlPullParser, boolean )
1101    
1102        /**
1103         * Method parseMirror.
1104         * 
1105         * @param parser
1106         * @param strict
1107         * @throws IOException
1108         * @throws XmlPullParserException
1109         * @return Mirror
1110         */
1111        private Mirror parseMirror( XmlPullParser parser, boolean strict )
1112            throws IOException, XmlPullParserException
1113        {
1114            String tagName = parser.getName();
1115            Mirror mirror = new Mirror();
1116            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1117            {
1118                String name = parser.getAttributeName( i );
1119                String value = parser.getAttributeValue( i );
1120    
1121                if ( name.indexOf( ':' ) >= 0 )
1122                {
1123                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1124                }
1125                else
1126                {
1127                    checkUnknownAttribute( parser, name, tagName, strict );
1128                }
1129            }
1130            java.util.Set parsed = new java.util.HashSet();
1131            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1132            {
1133                if ( checkFieldWithDuplicate( parser, "mirrorOf", null, parsed ) )
1134                {
1135                    mirror.setMirrorOf( getTrimmedValue( parser.nextText() ) );
1136                }
1137                else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1138                {
1139                    mirror.setName( getTrimmedValue( parser.nextText() ) );
1140                }
1141                else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1142                {
1143                    mirror.setUrl( getTrimmedValue( parser.nextText() ) );
1144                }
1145                else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
1146                {
1147                    mirror.setLayout( getTrimmedValue( parser.nextText() ) );
1148                }
1149                else if ( checkFieldWithDuplicate( parser, "mirrorOfLayouts", null, parsed ) )
1150                {
1151                    mirror.setMirrorOfLayouts( getTrimmedValue( parser.nextText() ) );
1152                }
1153                else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1154                {
1155                    mirror.setId( getTrimmedValue( parser.nextText() ) );
1156                }
1157                else
1158                {
1159                    checkUnknownElement( parser, strict );
1160                }
1161            }
1162            return mirror;
1163        } //-- Mirror parseMirror( XmlPullParser, boolean )
1164    
1165        /**
1166         * Method parseProfile.
1167         * 
1168         * @param parser
1169         * @param strict
1170         * @throws IOException
1171         * @throws XmlPullParserException
1172         * @return Profile
1173         */
1174        private Profile parseProfile( XmlPullParser parser, boolean strict )
1175            throws IOException, XmlPullParserException
1176        {
1177            String tagName = parser.getName();
1178            Profile profile = new Profile();
1179            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1180            {
1181                String name = parser.getAttributeName( i );
1182                String value = parser.getAttributeValue( i );
1183    
1184                if ( name.indexOf( ':' ) >= 0 )
1185                {
1186                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1187                }
1188                else
1189                {
1190                    checkUnknownAttribute( parser, name, tagName, strict );
1191                }
1192            }
1193            java.util.Set parsed = new java.util.HashSet();
1194            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1195            {
1196                if ( checkFieldWithDuplicate( parser, "activation", null, parsed ) )
1197                {
1198                    profile.setActivation( parseActivation( parser, strict ) );
1199                }
1200                else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
1201                {
1202                    while ( parser.nextTag() == XmlPullParser.START_TAG )
1203                    {
1204                        String key = parser.getName();
1205                        String value = parser.nextText().trim();
1206                        profile.addProperty( key, value );
1207                    }
1208                }
1209                else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
1210                {
1211                    java.util.List repositories = new java.util.ArrayList/*<Repository>*/();
1212                    profile.setRepositories( repositories );
1213                    while ( parser.nextTag() == XmlPullParser.START_TAG )
1214                    {
1215                        if ( "repository".equals( parser.getName() ) )
1216                        {
1217                            repositories.add( parseRepository( parser, strict ) );
1218                        }
1219                        else
1220                        {
1221                            checkUnknownElement( parser, strict );
1222                        }
1223                    }
1224                }
1225                else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
1226                {
1227                    java.util.List pluginRepositories = new java.util.ArrayList/*<Repository>*/();
1228                    profile.setPluginRepositories( pluginRepositories );
1229                    while ( parser.nextTag() == XmlPullParser.START_TAG )
1230                    {
1231                        if ( "pluginRepository".equals( parser.getName() ) )
1232                        {
1233                            pluginRepositories.add( parseRepository( parser, strict ) );
1234                        }
1235                        else
1236                        {
1237                            checkUnknownElement( parser, strict );
1238                        }
1239                    }
1240                }
1241                else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1242                {
1243                    profile.setId( getTrimmedValue( parser.nextText() ) );
1244                }
1245                else
1246                {
1247                    checkUnknownElement( parser, strict );
1248                }
1249            }
1250            return profile;
1251        } //-- Profile parseProfile( XmlPullParser, boolean )
1252    
1253        /**
1254         * Method parseProxy.
1255         * 
1256         * @param parser
1257         * @param strict
1258         * @throws IOException
1259         * @throws XmlPullParserException
1260         * @return Proxy
1261         */
1262        private Proxy parseProxy( XmlPullParser parser, boolean strict )
1263            throws IOException, XmlPullParserException
1264        {
1265            String tagName = parser.getName();
1266            Proxy proxy = new Proxy();
1267            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1268            {
1269                String name = parser.getAttributeName( i );
1270                String value = parser.getAttributeValue( i );
1271    
1272                if ( name.indexOf( ':' ) >= 0 )
1273                {
1274                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1275                }
1276                else
1277                {
1278                    checkUnknownAttribute( parser, name, tagName, strict );
1279                }
1280            }
1281            java.util.Set parsed = new java.util.HashSet();
1282            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1283            {
1284                if ( checkFieldWithDuplicate( parser, "active", null, parsed ) )
1285                {
1286                    proxy.setActive( getBooleanValue( getTrimmedValue( parser.nextText() ), "active", parser, "true" ) );
1287                }
1288                else if ( checkFieldWithDuplicate( parser, "protocol", null, parsed ) )
1289                {
1290                    proxy.setProtocol( getTrimmedValue( parser.nextText() ) );
1291                }
1292                else if ( checkFieldWithDuplicate( parser, "username", null, parsed ) )
1293                {
1294                    proxy.setUsername( getTrimmedValue( parser.nextText() ) );
1295                }
1296                else if ( checkFieldWithDuplicate( parser, "password", null, parsed ) )
1297                {
1298                    proxy.setPassword( getTrimmedValue( parser.nextText() ) );
1299                }
1300                else if ( checkFieldWithDuplicate( parser, "port", null, parsed ) )
1301                {
1302                    proxy.setPort( getIntegerValue( getTrimmedValue( parser.nextText() ), "port", parser, strict ) );
1303                }
1304                else if ( checkFieldWithDuplicate( parser, "host", null, parsed ) )
1305                {
1306                    proxy.setHost( getTrimmedValue( parser.nextText() ) );
1307                }
1308                else if ( checkFieldWithDuplicate( parser, "nonProxyHosts", null, parsed ) )
1309                {
1310                    proxy.setNonProxyHosts( getTrimmedValue( parser.nextText() ) );
1311                }
1312                else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1313                {
1314                    proxy.setId( getTrimmedValue( parser.nextText() ) );
1315                }
1316                else
1317                {
1318                    checkUnknownElement( parser, strict );
1319                }
1320            }
1321            return proxy;
1322        } //-- Proxy parseProxy( XmlPullParser, boolean )
1323    
1324        /**
1325         * Method parseRepository.
1326         * 
1327         * @param parser
1328         * @param strict
1329         * @throws IOException
1330         * @throws XmlPullParserException
1331         * @return Repository
1332         */
1333        private Repository parseRepository( XmlPullParser parser, boolean strict )
1334            throws IOException, XmlPullParserException
1335        {
1336            String tagName = parser.getName();
1337            Repository repository = new Repository();
1338            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1339            {
1340                String name = parser.getAttributeName( i );
1341                String value = parser.getAttributeValue( i );
1342    
1343                if ( name.indexOf( ':' ) >= 0 )
1344                {
1345                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1346                }
1347                else
1348                {
1349                    checkUnknownAttribute( parser, name, tagName, strict );
1350                }
1351            }
1352            java.util.Set parsed = new java.util.HashSet();
1353            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1354            {
1355                if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) )
1356                {
1357                    repository.setReleases( parseRepositoryPolicy( parser, strict ) );
1358                }
1359                else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) )
1360                {
1361                    repository.setSnapshots( parseRepositoryPolicy( parser, strict ) );
1362                }
1363                else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1364                {
1365                    repository.setId( getTrimmedValue( parser.nextText() ) );
1366                }
1367                else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1368                {
1369                    repository.setName( getTrimmedValue( parser.nextText() ) );
1370                }
1371                else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1372                {
1373                    repository.setUrl( getTrimmedValue( parser.nextText() ) );
1374                }
1375                else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
1376                {
1377                    repository.setLayout( getTrimmedValue( parser.nextText() ) );
1378                }
1379                else
1380                {
1381                    checkUnknownElement( parser, strict );
1382                }
1383            }
1384            return repository;
1385        } //-- Repository parseRepository( XmlPullParser, boolean )
1386    
1387        /**
1388         * Method parseRepositoryBase.
1389         * 
1390         * @param parser
1391         * @param strict
1392         * @throws IOException
1393         * @throws XmlPullParserException
1394         * @return RepositoryBase
1395         */
1396        private RepositoryBase parseRepositoryBase( XmlPullParser parser, boolean strict )
1397            throws IOException, XmlPullParserException
1398        {
1399            String tagName = parser.getName();
1400            RepositoryBase repositoryBase = new RepositoryBase();
1401            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1402            {
1403                String name = parser.getAttributeName( i );
1404                String value = parser.getAttributeValue( i );
1405    
1406                if ( name.indexOf( ':' ) >= 0 )
1407                {
1408                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1409                }
1410                else
1411                {
1412                    checkUnknownAttribute( parser, name, tagName, strict );
1413                }
1414            }
1415            java.util.Set parsed = new java.util.HashSet();
1416            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1417            {
1418                if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1419                {
1420                    repositoryBase.setId( getTrimmedValue( parser.nextText() ) );
1421                }
1422                else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
1423                {
1424                    repositoryBase.setName( getTrimmedValue( parser.nextText() ) );
1425                }
1426                else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
1427                {
1428                    repositoryBase.setUrl( getTrimmedValue( parser.nextText() ) );
1429                }
1430                else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
1431                {
1432                    repositoryBase.setLayout( getTrimmedValue( parser.nextText() ) );
1433                }
1434                else
1435                {
1436                    checkUnknownElement( parser, strict );
1437                }
1438            }
1439            return repositoryBase;
1440        } //-- RepositoryBase parseRepositoryBase( XmlPullParser, boolean )
1441    
1442        /**
1443         * Method parseRepositoryPolicy.
1444         * 
1445         * @param parser
1446         * @param strict
1447         * @throws IOException
1448         * @throws XmlPullParserException
1449         * @return RepositoryPolicy
1450         */
1451        private RepositoryPolicy parseRepositoryPolicy( XmlPullParser parser, boolean strict )
1452            throws IOException, XmlPullParserException
1453        {
1454            String tagName = parser.getName();
1455            RepositoryPolicy repositoryPolicy = new RepositoryPolicy();
1456            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1457            {
1458                String name = parser.getAttributeName( i );
1459                String value = parser.getAttributeValue( i );
1460    
1461                if ( name.indexOf( ':' ) >= 0 )
1462                {
1463                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1464                }
1465                else
1466                {
1467                    checkUnknownAttribute( parser, name, tagName, strict );
1468                }
1469            }
1470            java.util.Set parsed = new java.util.HashSet();
1471            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1472            {
1473                if ( checkFieldWithDuplicate( parser, "enabled", null, parsed ) )
1474                {
1475                    repositoryPolicy.setEnabled( getBooleanValue( getTrimmedValue( parser.nextText() ), "enabled", parser, "true" ) );
1476                }
1477                else if ( checkFieldWithDuplicate( parser, "updatePolicy", null, parsed ) )
1478                {
1479                    repositoryPolicy.setUpdatePolicy( getTrimmedValue( parser.nextText() ) );
1480                }
1481                else if ( checkFieldWithDuplicate( parser, "checksumPolicy", null, parsed ) )
1482                {
1483                    repositoryPolicy.setChecksumPolicy( getTrimmedValue( parser.nextText() ) );
1484                }
1485                else
1486                {
1487                    checkUnknownElement( parser, strict );
1488                }
1489            }
1490            return repositoryPolicy;
1491        } //-- RepositoryPolicy parseRepositoryPolicy( XmlPullParser, boolean )
1492    
1493        /**
1494         * Method parseServer.
1495         * 
1496         * @param parser
1497         * @param strict
1498         * @throws IOException
1499         * @throws XmlPullParserException
1500         * @return Server
1501         */
1502        private Server parseServer( XmlPullParser parser, boolean strict )
1503            throws IOException, XmlPullParserException
1504        {
1505            String tagName = parser.getName();
1506            Server server = new Server();
1507            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1508            {
1509                String name = parser.getAttributeName( i );
1510                String value = parser.getAttributeValue( i );
1511    
1512                if ( name.indexOf( ':' ) >= 0 )
1513                {
1514                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1515                }
1516                else
1517                {
1518                    checkUnknownAttribute( parser, name, tagName, strict );
1519                }
1520            }
1521            java.util.Set parsed = new java.util.HashSet();
1522            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1523            {
1524                if ( checkFieldWithDuplicate( parser, "username", null, parsed ) )
1525                {
1526                    server.setUsername( getTrimmedValue( parser.nextText() ) );
1527                }
1528                else if ( checkFieldWithDuplicate( parser, "password", null, parsed ) )
1529                {
1530                    server.setPassword( getTrimmedValue( parser.nextText() ) );
1531                }
1532                else if ( checkFieldWithDuplicate( parser, "privateKey", null, parsed ) )
1533                {
1534                    server.setPrivateKey( getTrimmedValue( parser.nextText() ) );
1535                }
1536                else if ( checkFieldWithDuplicate( parser, "passphrase", null, parsed ) )
1537                {
1538                    server.setPassphrase( getTrimmedValue( parser.nextText() ) );
1539                }
1540                else if ( checkFieldWithDuplicate( parser, "filePermissions", null, parsed ) )
1541                {
1542                    server.setFilePermissions( getTrimmedValue( parser.nextText() ) );
1543                }
1544                else if ( checkFieldWithDuplicate( parser, "directoryPermissions", null, parsed ) )
1545                {
1546                    server.setDirectoryPermissions( getTrimmedValue( parser.nextText() ) );
1547                }
1548                else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
1549                {
1550                    server.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) );
1551                }
1552                else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
1553                {
1554                    server.setId( getTrimmedValue( parser.nextText() ) );
1555                }
1556                else
1557                {
1558                    checkUnknownElement( parser, strict );
1559                }
1560            }
1561            return server;
1562        } //-- Server parseServer( XmlPullParser, boolean )
1563    
1564        /**
1565         * Method parseSettings.
1566         * 
1567         * @param parser
1568         * @param strict
1569         * @throws IOException
1570         * @throws XmlPullParserException
1571         * @return Settings
1572         */
1573        private Settings parseSettings( XmlPullParser parser, boolean strict )
1574            throws IOException, XmlPullParserException
1575        {
1576            String tagName = parser.getName();
1577            Settings settings = new Settings();
1578            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1579            {
1580                String name = parser.getAttributeName( i );
1581                String value = parser.getAttributeValue( i );
1582    
1583                if ( name.indexOf( ':' ) >= 0 )
1584                {
1585                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1586                }
1587                else if ( "xmlns".equals( name ) )
1588                {
1589                    // ignore xmlns attribute in root class, which is a reserved attribute name
1590                }
1591                else
1592                {
1593                    checkUnknownAttribute( parser, name, tagName, strict );
1594                }
1595            }
1596            java.util.Set parsed = new java.util.HashSet();
1597            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1598            {
1599                if ( checkFieldWithDuplicate( parser, "localRepository", null, parsed ) )
1600                {
1601                    settings.setLocalRepository( getTrimmedValue( parser.nextText() ) );
1602                }
1603                else if ( checkFieldWithDuplicate( parser, "interactiveMode", null, parsed ) )
1604                {
1605                    settings.setInteractiveMode( getBooleanValue( getTrimmedValue( parser.nextText() ), "interactiveMode", parser, "true" ) );
1606                }
1607                else if ( checkFieldWithDuplicate( parser, "usePluginRegistry", null, parsed ) )
1608                {
1609                    settings.setUsePluginRegistry( getBooleanValue( getTrimmedValue( parser.nextText() ), "usePluginRegistry", parser, "false" ) );
1610                }
1611                else if ( checkFieldWithDuplicate( parser, "offline", null, parsed ) )
1612                {
1613                    settings.setOffline( getBooleanValue( getTrimmedValue( parser.nextText() ), "offline", parser, "false" ) );
1614                }
1615                else if ( checkFieldWithDuplicate( parser, "proxies", null, parsed ) )
1616                {
1617                    java.util.List proxies = new java.util.ArrayList/*<Proxy>*/();
1618                    settings.setProxies( proxies );
1619                    while ( parser.nextTag() == XmlPullParser.START_TAG )
1620                    {
1621                        if ( "proxy".equals( parser.getName() ) )
1622                        {
1623                            proxies.add( parseProxy( parser, strict ) );
1624                        }
1625                        else
1626                        {
1627                            checkUnknownElement( parser, strict );
1628                        }
1629                    }
1630                }
1631                else if ( checkFieldWithDuplicate( parser, "servers", null, parsed ) )
1632                {
1633                    java.util.List servers = new java.util.ArrayList/*<Server>*/();
1634                    settings.setServers( servers );
1635                    while ( parser.nextTag() == XmlPullParser.START_TAG )
1636                    {
1637                        if ( "server".equals( parser.getName() ) )
1638                        {
1639                            servers.add( parseServer( parser, strict ) );
1640                        }
1641                        else
1642                        {
1643                            checkUnknownElement( parser, strict );
1644                        }
1645                    }
1646                }
1647                else if ( checkFieldWithDuplicate( parser, "mirrors", null, parsed ) )
1648                {
1649                    java.util.List mirrors = new java.util.ArrayList/*<Mirror>*/();
1650                    settings.setMirrors( mirrors );
1651                    while ( parser.nextTag() == XmlPullParser.START_TAG )
1652                    {
1653                        if ( "mirror".equals( parser.getName() ) )
1654                        {
1655                            mirrors.add( parseMirror( parser, strict ) );
1656                        }
1657                        else
1658                        {
1659                            checkUnknownElement( parser, strict );
1660                        }
1661                    }
1662                }
1663                else if ( checkFieldWithDuplicate( parser, "profiles", null, parsed ) )
1664                {
1665                    java.util.List profiles = new java.util.ArrayList/*<Profile>*/();
1666                    settings.setProfiles( profiles );
1667                    while ( parser.nextTag() == XmlPullParser.START_TAG )
1668                    {
1669                        if ( "profile".equals( parser.getName() ) )
1670                        {
1671                            profiles.add( parseProfile( parser, strict ) );
1672                        }
1673                        else
1674                        {
1675                            checkUnknownElement( parser, strict );
1676                        }
1677                    }
1678                }
1679                else if ( checkFieldWithDuplicate( parser, "activeProfiles", null, parsed ) )
1680                {
1681                    java.util.List activeProfiles = new java.util.ArrayList/*<String>*/();
1682                    settings.setActiveProfiles( activeProfiles );
1683                    while ( parser.nextTag() == XmlPullParser.START_TAG )
1684                    {
1685                        if ( "activeProfile".equals( parser.getName() ) )
1686                        {
1687                            activeProfiles.add( getTrimmedValue( parser.nextText() ) );
1688                        }
1689                        else
1690                        {
1691                            checkUnknownElement( parser, strict );
1692                        }
1693                    }
1694                }
1695                else if ( checkFieldWithDuplicate( parser, "pluginGroups", null, parsed ) )
1696                {
1697                    java.util.List pluginGroups = new java.util.ArrayList/*<String>*/();
1698                    settings.setPluginGroups( pluginGroups );
1699                    while ( parser.nextTag() == XmlPullParser.START_TAG )
1700                    {
1701                        if ( "pluginGroup".equals( parser.getName() ) )
1702                        {
1703                            pluginGroups.add( getTrimmedValue( parser.nextText() ) );
1704                        }
1705                        else
1706                        {
1707                            checkUnknownElement( parser, strict );
1708                        }
1709                    }
1710                }
1711                else
1712                {
1713                    checkUnknownElement( parser, strict );
1714                }
1715            }
1716            return settings;
1717        } //-- Settings parseSettings( XmlPullParser, boolean )
1718    
1719        /**
1720         * Method parseTrackableBase.
1721         * 
1722         * @param parser
1723         * @param strict
1724         * @throws IOException
1725         * @throws XmlPullParserException
1726         * @return TrackableBase
1727         */
1728        private TrackableBase parseTrackableBase( XmlPullParser parser, boolean strict )
1729            throws IOException, XmlPullParserException
1730        {
1731            String tagName = parser.getName();
1732            TrackableBase trackableBase = new TrackableBase();
1733            for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
1734            {
1735                String name = parser.getAttributeName( i );
1736                String value = parser.getAttributeValue( i );
1737    
1738                if ( name.indexOf( ':' ) >= 0 )
1739                {
1740                    // just ignore attributes with non-default namespace (for example: xmlns:xsi)
1741                }
1742                else
1743                {
1744                    checkUnknownAttribute( parser, name, tagName, strict );
1745                }
1746            }
1747            java.util.Set parsed = new java.util.HashSet();
1748            while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
1749            {
1750                checkUnknownElement( parser, strict );
1751            }
1752            return trackableBase;
1753        } //-- TrackableBase parseTrackableBase( XmlPullParser, boolean )
1754    
1755        /**
1756         * Method read.
1757         * 
1758         * @param parser
1759         * @param strict
1760         * @throws IOException
1761         * @throws XmlPullParserException
1762         * @return Settings
1763         */
1764        private Settings read( XmlPullParser parser, boolean strict )
1765            throws IOException, XmlPullParserException
1766        {
1767            int eventType = parser.getEventType();
1768            while ( eventType != XmlPullParser.END_DOCUMENT )
1769            {
1770                if ( eventType == XmlPullParser.START_TAG )
1771                {
1772                    if ( strict && ! "settings".equals( parser.getName() ) )
1773                    {
1774                        throw new XmlPullParserException( "Expected root element 'settings' but found '" + parser.getName() + "'", parser, null );
1775                    }
1776                    Settings settings = parseSettings( parser, strict );
1777                    settings.setModelEncoding( parser.getInputEncoding() );
1778                    return settings;
1779                }
1780                eventType = parser.next();
1781            }
1782            throw new XmlPullParserException( "Expected root element 'settings' but found no element at all: invalid XML document", parser, null );
1783        } //-- Settings read( XmlPullParser, boolean )
1784    
1785        /**
1786         * Sets the state of the "add default entities" flag.
1787         * 
1788         * @param addDefaultEntities
1789         */
1790        public void setAddDefaultEntities( boolean addDefaultEntities )
1791        {
1792            this.addDefaultEntities = addDefaultEntities;
1793        } //-- void setAddDefaultEntities( boolean )
1794    
1795    }