001/*
002 =================== DO NOT EDIT THIS FILE ====================
003 Generated by Modello 1.1 on 2014-01-07 00:11:24,
004 any modifications will be overwritten.
005 ==============================================================
006 */
007
008package org.apache.maven.scm.providers.gitlib.settings.io.xpp3;
009
010  //---------------------------------/
011 //- Imported classes and packages -/
012//---------------------------------/
013
014import java.io.IOException;
015import java.io.InputStream;
016import java.io.Reader;
017import java.text.DateFormat;
018import java.util.Locale;
019import org.apache.maven.scm.providers.gitlib.settings.Settings;
020import org.codehaus.plexus.util.ReaderFactory;
021import org.codehaus.plexus.util.xml.pull.MXParser;
022import org.codehaus.plexus.util.xml.pull.XmlPullParser;
023import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
024
025/**
026 * Class GitXpp3Reader.
027 * 
028 * @version $Revision$ $Date$
029 */
030@SuppressWarnings( "all" )
031public class GitXpp3Reader
032{
033
034      //--------------------------/
035     //- Class/Member Variables -/
036    //--------------------------/
037
038    /**
039     * If set the parser will be loaded with all single characters
040     * from the XHTML specification.
041     * The entities used:
042     * <ul>
043     * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li>
044     * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li>
045     * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li>
046     * </ul>
047     */
048    private boolean addDefaultEntities = true;
049
050
051      //-----------/
052     //- Methods -/
053    //-----------/
054
055    /**
056     * Method checkFieldWithDuplicate.
057     * 
058     * @param parser
059     * @param parsed
060     * @param alias
061     * @param tagName
062     * @throws XmlPullParserException
063     * @return boolean
064     */
065    private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed )
066        throws XmlPullParserException
067    {
068        if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
069        {
070            return false;
071        }
072        if ( parsed.contains( tagName ) )
073        {
074            throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
075        }
076        parsed.add( tagName );
077        return true;
078    } //-- boolean checkFieldWithDuplicate( XmlPullParser, String, String, java.util.Set )
079
080    /**
081     * Returns the state of the "add default entities" flag.
082     * 
083     * @return boolean
084     */
085    public boolean getAddDefaultEntities()
086    {
087        return addDefaultEntities;
088    } //-- boolean getAddDefaultEntities()
089
090    /**
091     * Method getBooleanValue.
092     * 
093     * @param s
094     * @param parser
095     * @param attribute
096     * @throws XmlPullParserException
097     * @return boolean
098     */
099    private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
100        throws XmlPullParserException
101    {
102        return getBooleanValue( s, attribute, parser, null );
103    } //-- boolean getBooleanValue( String, String, XmlPullParser )
104
105    /**
106     * Method getBooleanValue.
107     * 
108     * @param s
109     * @param defaultValue
110     * @param parser
111     * @param attribute
112     * @throws XmlPullParserException
113     * @return boolean
114     */
115    private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
116        throws XmlPullParserException
117    {
118        if ( s != null && s.length() != 0 )
119        {
120            return Boolean.valueOf( s ).booleanValue();
121        }
122        if ( defaultValue != null )
123        {
124            return Boolean.valueOf( defaultValue ).booleanValue();
125        }
126        return false;
127    } //-- boolean getBooleanValue( String, String, XmlPullParser, String )
128
129    /**
130     * Method getByteValue.
131     * 
132     * @param s
133     * @param strict
134     * @param parser
135     * @param attribute
136     * @throws XmlPullParserException
137     * @return byte
138     */
139    private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
140        throws XmlPullParserException
141    {
142        if ( s != null )
143        {
144            try
145            {
146                return Byte.valueOf( s ).byteValue();
147            }
148            catch ( NumberFormatException e )
149            {
150                if ( strict )
151                {
152                    throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, null );
153                }
154            }
155        }
156        return 0;
157    } //-- byte getByteValue( String, String, XmlPullParser, boolean )
158
159    /**
160     * Method getCharacterValue.
161     * 
162     * @param s
163     * @param parser
164     * @param attribute
165     * @throws XmlPullParserException
166     * @return char
167     */
168    private char getCharacterValue( String s, String attribute, XmlPullParser parser )
169        throws XmlPullParserException
170    {
171        if ( s != null )
172        {
173            return s.charAt( 0 );
174        }
175        return 0;
176    } //-- char getCharacterValue( String, String, XmlPullParser )
177
178    /**
179     * Method getDateValue.
180     * 
181     * @param s
182     * @param parser
183     * @param attribute
184     * @throws XmlPullParserException
185     * @return Date
186     */
187    private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
188        throws XmlPullParserException
189    {
190        return getDateValue( s, attribute, null, parser );
191    } //-- java.util.Date getDateValue( String, String, XmlPullParser )
192
193    /**
194     * Method getDateValue.
195     * 
196     * @param s
197     * @param parser
198     * @param dateFormat
199     * @param attribute
200     * @throws XmlPullParserException
201     * @return Date
202     */
203    private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
204        throws XmlPullParserException
205    {
206        if ( s != null )
207        {
208            String effectiveDateFormat = dateFormat;
209            if ( dateFormat == null )
210            {
211                effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
212            }
213            if ( "long".equals( effectiveDateFormat ) )
214            {
215                try
216                {
217                    return new java.util.Date( Long.parseLong( s ) );
218                }
219                catch ( NumberFormatException e )
220                {
221                    throw new XmlPullParserException( e.getMessage() );
222                }
223            }
224            else
225            {
226                try
227                {
228                    DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, Locale.US );
229                    return dateParser.parse( s );
230                }
231                catch ( java.text.ParseException e )
232                {
233                    throw new XmlPullParserException( e.getMessage() );
234                }
235            }
236        }
237        return null;
238    } //-- java.util.Date getDateValue( String, String, String, XmlPullParser )
239
240    /**
241     * Method getDoubleValue.
242     * 
243     * @param s
244     * @param strict
245     * @param parser
246     * @param attribute
247     * @throws XmlPullParserException
248     * @return double
249     */
250    private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
251        throws XmlPullParserException
252    {
253        if ( s != null )
254        {
255            try
256            {
257                return Double.valueOf( s ).doubleValue();
258            }
259            catch ( NumberFormatException e )
260            {
261                if ( strict )
262                {
263                    throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null );
264                }
265            }
266        }
267        return 0;
268    } //-- double getDoubleValue( String, String, XmlPullParser, boolean )
269
270    /**
271     * Method getFloatValue.
272     * 
273     * @param s
274     * @param strict
275     * @param parser
276     * @param attribute
277     * @throws XmlPullParserException
278     * @return float
279     */
280    private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
281        throws XmlPullParserException
282    {
283        if ( s != null )
284        {
285            try
286            {
287                return Float.valueOf( s ).floatValue();
288            }
289            catch ( NumberFormatException e )
290            {
291                if ( strict )
292                {
293                    throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null );
294                }
295            }
296        }
297        return 0;
298    } //-- float getFloatValue( String, String, XmlPullParser, boolean )
299
300    /**
301     * Method getIntegerValue.
302     * 
303     * @param s
304     * @param strict
305     * @param parser
306     * @param attribute
307     * @throws XmlPullParserException
308     * @return int
309     */
310    private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
311        throws XmlPullParserException
312    {
313        if ( s != null )
314        {
315            try
316            {
317                return Integer.valueOf( s ).intValue();
318            }
319            catch ( NumberFormatException e )
320            {
321                if ( strict )
322                {
323                    throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, null );
324                }
325            }
326        }
327        return 0;
328    } //-- int getIntegerValue( String, String, XmlPullParser, boolean )
329
330    /**
331     * Method getLongValue.
332     * 
333     * @param s
334     * @param strict
335     * @param parser
336     * @param attribute
337     * @throws XmlPullParserException
338     * @return long
339     */
340    private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
341        throws XmlPullParserException
342    {
343        if ( s != null )
344        {
345            try
346            {
347                return Long.valueOf( s ).longValue();
348            }
349            catch ( NumberFormatException e )
350            {
351                if ( strict )
352                {
353                    throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, null );
354                }
355            }
356        }
357        return 0;
358    } //-- long getLongValue( String, String, XmlPullParser, boolean )
359
360    /**
361     * Method getRequiredAttributeValue.
362     * 
363     * @param s
364     * @param strict
365     * @param parser
366     * @param attribute
367     * @throws XmlPullParserException
368     * @return String
369     */
370    private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
371        throws XmlPullParserException
372    {
373        if ( s == null )
374        {
375            if ( strict )
376            {
377                throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
378            }
379        }
380        return s;
381    } //-- String getRequiredAttributeValue( String, String, XmlPullParser, boolean )
382
383    /**
384     * Method getShortValue.
385     * 
386     * @param s
387     * @param strict
388     * @param parser
389     * @param attribute
390     * @throws XmlPullParserException
391     * @return short
392     */
393    private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
394        throws XmlPullParserException
395    {
396        if ( s != null )
397        {
398            try
399            {
400                return Short.valueOf( s ).shortValue();
401            }
402            catch ( NumberFormatException e )
403            {
404                if ( strict )
405                {
406                    throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, null );
407                }
408            }
409        }
410        return 0;
411    } //-- short getShortValue( String, String, XmlPullParser, boolean )
412
413    /**
414     * Method getTrimmedValue.
415     * 
416     * @param s
417     * @return String
418     */
419    private String getTrimmedValue( String s )
420    {
421        if ( s != null )
422        {
423            s = s.trim();
424        }
425        return s;
426    } //-- String getTrimmedValue( String )
427
428    /**
429     * Method parseSettings.
430     * 
431     * @param tagName
432     * @param strict
433     * @param parser
434     * @throws IOException
435     * @throws XmlPullParserException
436     * @return Settings
437     */
438    private Settings parseSettings( String tagName, XmlPullParser parser, boolean strict )
439        throws IOException, XmlPullParserException
440    {
441        Settings settings = new Settings();
442        java.util.Set parsed = new java.util.HashSet();
443        int eventType = parser.getEventType();
444        boolean foundRoot = false;
445        settings.setModelEncoding( parser.getInputEncoding() );
446        while ( eventType != XmlPullParser.END_DOCUMENT )
447        {
448            if ( eventType == XmlPullParser.START_TAG )
449            {
450                if ( parser.getName().equals( tagName ) )
451                {
452                    foundRoot = true;
453                }
454                else if ( strict && ! foundRoot )
455                {
456                    throw new XmlPullParserException( "Expected root element '" + tagName + "' but found '" + parser.getName() + "'", parser, null );
457                }
458                else if ( checkFieldWithDuplicate( parser, "revParseDateFormat", null, parsed ) )
459                {
460                    settings.setRevParseDateFormat( getTrimmedValue( parser.nextText() ) );
461                }
462                else if ( checkFieldWithDuplicate( parser, "traceGitCommand", null, parsed ) )
463                {
464                    settings.setTraceGitCommand( getTrimmedValue( parser.nextText() ) );
465                }
466                else if ( checkFieldWithDuplicate( parser, "commitNoVerify", null, parsed ) )
467                {
468                    settings.setCommitNoVerify( getBooleanValue( getTrimmedValue( parser.nextText() ), "commitNoVerify", parser, "false" ) );
469                }
470                else if ( strict )
471                {
472                    throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
473                }
474            }
475            eventType = parser.next();
476        }
477        return settings;
478    } //-- Settings parseSettings( String, XmlPullParser, boolean )
479
480    /**
481     * @see ReaderFactory#newXmlReader
482     * 
483     * @param reader
484     * @param strict
485     * @throws IOException
486     * @throws XmlPullParserException
487     * @return Settings
488     */
489    public Settings read( Reader reader, boolean strict )
490        throws IOException, XmlPullParserException
491    {
492        XmlPullParser parser = new MXParser();
493
494        parser.setInput( reader );
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
763        parser.next();
764        return parseSettings( "git-settings", parser, strict );
765    } //-- Settings read( Reader, boolean )
766
767    /**
768     * @see ReaderFactory#newXmlReader
769     * 
770     * @param reader
771     * @throws IOException
772     * @throws XmlPullParserException
773     * @return Settings
774     */
775    public Settings read( Reader reader )
776        throws IOException, XmlPullParserException
777    {
778        return read( reader, true );
779    } //-- Settings read( Reader )
780
781    /**
782     * Method read.
783     * 
784     * @param in
785     * @param strict
786     * @throws IOException
787     * @throws XmlPullParserException
788     * @return Settings
789     */
790    public Settings read( InputStream in, boolean strict )
791        throws IOException, XmlPullParserException
792    {
793        Reader reader = ReaderFactory.newXmlReader( in );
794
795        return read( reader, strict );
796    } //-- Settings read( InputStream, boolean )
797
798    /**
799     * Method read.
800     * 
801     * @param in
802     * @throws IOException
803     * @throws XmlPullParserException
804     * @return Settings
805     */
806    public Settings read( InputStream in )
807        throws IOException, XmlPullParserException
808    {
809        Reader reader = ReaderFactory.newXmlReader( in );
810
811        return read( reader );
812    } //-- Settings read( InputStream )
813
814    /**
815     * Sets the state of the "add default entities" flag.
816     * 
817     * @param addDefaultEntities
818     */
819    public void setAddDefaultEntities( boolean addDefaultEntities )
820    {
821        this.addDefaultEntities = addDefaultEntities;
822    } //-- void setAddDefaultEntities( boolean )
823
824}