View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello 1.1 on 2011-09-18 11:22:02,
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.apache.continuum.configuration.model.io.xpp3;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import java.io.IOException;
15  import java.io.InputStream;
16  import java.io.Reader;
17  import java.text.DateFormat;
18  import java.util.Locale;
19  import org.apache.continuum.configuration.model.BuildAgentConfiguration;
20  import org.apache.continuum.configuration.model.BuildAgentGroupConfiguration;
21  import org.apache.continuum.configuration.model.ContinuumConfigurationModel;
22  import org.apache.continuum.configuration.model.ProxyConfiguration;
23  import org.codehaus.plexus.util.ReaderFactory;
24  import org.codehaus.plexus.util.xml.pull.MXParser;
25  import org.codehaus.plexus.util.xml.pull.XmlPullParser;
26  import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
27  
28  /**
29   * Class ContinuumConfigurationModelXpp3Reader.
30   * 
31   * @version $Revision$ $Date$
32   */
33  @SuppressWarnings( "all" )
34  public class ContinuumConfigurationModelXpp3Reader
35  {
36  
37        //--------------------------/
38       //- Class/Member Variables -/
39      //--------------------------/
40  
41      /**
42       * If set the parser will be loaded with all single characters
43       * from the XHTML specification.
44       * The entities used:
45       * <ul>
46       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li>
47       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li>
48       * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li>
49       * </ul>
50       */
51      private boolean addDefaultEntities = true;
52  
53  
54        //-----------/
55       //- Methods -/
56      //-----------/
57  
58      /**
59       * Method checkFieldWithDuplicate.
60       * 
61       * @param parser
62       * @param parsed
63       * @param alias
64       * @param tagName
65       * @throws XmlPullParserException
66       * @return boolean
67       */
68      private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed )
69          throws XmlPullParserException
70      {
71          if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) )
72          {
73              return false;
74          }
75          if ( parsed.contains( tagName ) )
76          {
77              throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null );
78          }
79          parsed.add( tagName );
80          return true;
81      } //-- boolean checkFieldWithDuplicate( XmlPullParser, String, String, java.util.Set )
82  
83      /**
84       * Returns the state of the "add default entities" flag.
85       * 
86       * @return boolean
87       */
88      public boolean getAddDefaultEntities()
89      {
90          return addDefaultEntities;
91      } //-- boolean getAddDefaultEntities()
92  
93      /**
94       * Method getBooleanValue.
95       * 
96       * @param s
97       * @param parser
98       * @param attribute
99       * @throws XmlPullParserException
100      * @return boolean
101      */
102     private boolean getBooleanValue( String s, String attribute, XmlPullParser parser )
103         throws XmlPullParserException
104     {
105         return getBooleanValue( s, attribute, parser, null );
106     } //-- boolean getBooleanValue( String, String, XmlPullParser )
107 
108     /**
109      * Method getBooleanValue.
110      * 
111      * @param s
112      * @param defaultValue
113      * @param parser
114      * @param attribute
115      * @throws XmlPullParserException
116      * @return boolean
117      */
118     private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue )
119         throws XmlPullParserException
120     {
121         if ( s != null && s.length() != 0 )
122         {
123             return Boolean.valueOf( s ).booleanValue();
124         }
125         if ( defaultValue != null )
126         {
127             return Boolean.valueOf( defaultValue ).booleanValue();
128         }
129         return false;
130     } //-- boolean getBooleanValue( String, String, XmlPullParser, String )
131 
132     /**
133      * Method getByteValue.
134      * 
135      * @param s
136      * @param strict
137      * @param parser
138      * @param attribute
139      * @throws XmlPullParserException
140      * @return byte
141      */
142     private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict )
143         throws XmlPullParserException
144     {
145         if ( s != null )
146         {
147             try
148             {
149                 return Byte.valueOf( s ).byteValue();
150             }
151             catch ( NumberFormatException e )
152             {
153                 if ( strict )
154                 {
155                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, null );
156                 }
157             }
158         }
159         return 0;
160     } //-- byte getByteValue( String, String, XmlPullParser, boolean )
161 
162     /**
163      * Method getCharacterValue.
164      * 
165      * @param s
166      * @param parser
167      * @param attribute
168      * @throws XmlPullParserException
169      * @return char
170      */
171     private char getCharacterValue( String s, String attribute, XmlPullParser parser )
172         throws XmlPullParserException
173     {
174         if ( s != null )
175         {
176             return s.charAt( 0 );
177         }
178         return 0;
179     } //-- char getCharacterValue( String, String, XmlPullParser )
180 
181     /**
182      * Method getDateValue.
183      * 
184      * @param s
185      * @param parser
186      * @param attribute
187      * @throws XmlPullParserException
188      * @return Date
189      */
190     private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser )
191         throws XmlPullParserException
192     {
193         return getDateValue( s, attribute, null, parser );
194     } //-- java.util.Date getDateValue( String, String, XmlPullParser )
195 
196     /**
197      * Method getDateValue.
198      * 
199      * @param s
200      * @param parser
201      * @param dateFormat
202      * @param attribute
203      * @throws XmlPullParserException
204      * @return Date
205      */
206     private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser )
207         throws XmlPullParserException
208     {
209         if ( s != null )
210         {
211             String effectiveDateFormat = dateFormat;
212             if ( dateFormat == null )
213             {
214                 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";
215             }
216             if ( "long".equals( effectiveDateFormat ) )
217             {
218                 try
219                 {
220                     return new java.util.Date( Long.parseLong( s ) );
221                 }
222                 catch ( NumberFormatException e )
223                 {
224                     throw new XmlPullParserException( e.getMessage() );
225                 }
226             }
227             else
228             {
229                 try
230                 {
231                     DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, Locale.US );
232                     return dateParser.parse( s );
233                 }
234                 catch ( java.text.ParseException e )
235                 {
236                     throw new XmlPullParserException( e.getMessage() );
237                 }
238             }
239         }
240         return null;
241     } //-- java.util.Date getDateValue( String, String, String, XmlPullParser )
242 
243     /**
244      * Method getDoubleValue.
245      * 
246      * @param s
247      * @param strict
248      * @param parser
249      * @param attribute
250      * @throws XmlPullParserException
251      * @return double
252      */
253     private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict )
254         throws XmlPullParserException
255     {
256         if ( s != null )
257         {
258             try
259             {
260                 return Double.valueOf( s ).doubleValue();
261             }
262             catch ( NumberFormatException e )
263             {
264                 if ( strict )
265                 {
266                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null );
267                 }
268             }
269         }
270         return 0;
271     } //-- double getDoubleValue( String, String, XmlPullParser, boolean )
272 
273     /**
274      * Method getFloatValue.
275      * 
276      * @param s
277      * @param strict
278      * @param parser
279      * @param attribute
280      * @throws XmlPullParserException
281      * @return float
282      */
283     private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict )
284         throws XmlPullParserException
285     {
286         if ( s != null )
287         {
288             try
289             {
290                 return Float.valueOf( s ).floatValue();
291             }
292             catch ( NumberFormatException e )
293             {
294                 if ( strict )
295                 {
296                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, null );
297                 }
298             }
299         }
300         return 0;
301     } //-- float getFloatValue( String, String, XmlPullParser, boolean )
302 
303     /**
304      * Method getIntegerValue.
305      * 
306      * @param s
307      * @param strict
308      * @param parser
309      * @param attribute
310      * @throws XmlPullParserException
311      * @return int
312      */
313     private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict )
314         throws XmlPullParserException
315     {
316         if ( s != null )
317         {
318             try
319             {
320                 return Integer.valueOf( s ).intValue();
321             }
322             catch ( NumberFormatException e )
323             {
324                 if ( strict )
325                 {
326                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, null );
327                 }
328             }
329         }
330         return 0;
331     } //-- int getIntegerValue( String, String, XmlPullParser, boolean )
332 
333     /**
334      * Method getLongValue.
335      * 
336      * @param s
337      * @param strict
338      * @param parser
339      * @param attribute
340      * @throws XmlPullParserException
341      * @return long
342      */
343     private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict )
344         throws XmlPullParserException
345     {
346         if ( s != null )
347         {
348             try
349             {
350                 return Long.valueOf( s ).longValue();
351             }
352             catch ( NumberFormatException e )
353             {
354                 if ( strict )
355                 {
356                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, null );
357                 }
358             }
359         }
360         return 0;
361     } //-- long getLongValue( String, String, XmlPullParser, boolean )
362 
363     /**
364      * Method getRequiredAttributeValue.
365      * 
366      * @param s
367      * @param strict
368      * @param parser
369      * @param attribute
370      * @throws XmlPullParserException
371      * @return String
372      */
373     private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict )
374         throws XmlPullParserException
375     {
376         if ( s == null )
377         {
378             if ( strict )
379             {
380                 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null );
381             }
382         }
383         return s;
384     } //-- String getRequiredAttributeValue( String, String, XmlPullParser, boolean )
385 
386     /**
387      * Method getShortValue.
388      * 
389      * @param s
390      * @param strict
391      * @param parser
392      * @param attribute
393      * @throws XmlPullParserException
394      * @return short
395      */
396     private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict )
397         throws XmlPullParserException
398     {
399         if ( s != null )
400         {
401             try
402             {
403                 return Short.valueOf( s ).shortValue();
404             }
405             catch ( NumberFormatException e )
406             {
407                 if ( strict )
408                 {
409                     throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, null );
410                 }
411             }
412         }
413         return 0;
414     } //-- short getShortValue( String, String, XmlPullParser, boolean )
415 
416     /**
417      * Method getTrimmedValue.
418      * 
419      * @param s
420      * @return String
421      */
422     private String getTrimmedValue( String s )
423     {
424         if ( s != null )
425         {
426             s = s.trim();
427         }
428         return s;
429     } //-- String getTrimmedValue( String )
430 
431     /**
432      * Method parseBuildAgentConfiguration.
433      * 
434      * @param tagName
435      * @param strict
436      * @param parser
437      * @throws IOException
438      * @throws XmlPullParserException
439      * @return BuildAgentConfiguration
440      */
441     private BuildAgentConfiguration parseBuildAgentConfiguration( String tagName, XmlPullParser parser, boolean strict )
442         throws IOException, XmlPullParserException
443     {
444         BuildAgentConfiguration buildAgentConfiguration = new BuildAgentConfiguration();
445         java.util.Set parsed = new java.util.HashSet();
446         while ( parser.nextTag() == XmlPullParser.START_TAG )
447         {
448             if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
449             {
450                 buildAgentConfiguration.setUrl( getTrimmedValue( parser.nextText() ) );
451             }
452             else if ( checkFieldWithDuplicate( parser, "description", null, parsed ) )
453             {
454                 buildAgentConfiguration.setDescription( getTrimmedValue( parser.nextText() ) );
455             }
456             else if ( checkFieldWithDuplicate( parser, "enabled", null, parsed ) )
457             {
458                 buildAgentConfiguration.setEnabled( getBooleanValue( getTrimmedValue( parser.nextText() ), "enabled", parser, "false" ) );
459             }
460             else
461             {
462                 if ( strict )
463                 {
464                     throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
465                 }
466                 else
467                 {
468                     // swallow up to end tag since this is not valid
469                     while ( parser.next() != XmlPullParser.END_TAG ) {}
470                 }
471             }
472         }
473         return buildAgentConfiguration;
474     } //-- BuildAgentConfiguration parseBuildAgentConfiguration( String, XmlPullParser, boolean )
475 
476     /**
477      * Method parseBuildAgentGroupConfiguration.
478      * 
479      * @param tagName
480      * @param strict
481      * @param parser
482      * @throws IOException
483      * @throws XmlPullParserException
484      * @return BuildAgentGroupConfiguration
485      */
486     private BuildAgentGroupConfiguration parseBuildAgentGroupConfiguration( String tagName, XmlPullParser parser, boolean strict )
487         throws IOException, XmlPullParserException
488     {
489         BuildAgentGroupConfiguration buildAgentGroupConfiguration = new BuildAgentGroupConfiguration();
490         java.util.Set parsed = new java.util.HashSet();
491         while ( parser.nextTag() == XmlPullParser.START_TAG )
492         {
493             if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
494             {
495                 buildAgentGroupConfiguration.setName( getTrimmedValue( parser.nextText() ) );
496             }
497             else if ( checkFieldWithDuplicate( parser, "buildAgents", null, parsed ) )
498             {
499                 java.util.List buildAgents = new java.util.ArrayList/*<BuildAgentConfiguration>*/();
500                 buildAgentGroupConfiguration.setBuildAgents( buildAgents );
501                 while ( parser.nextTag() == XmlPullParser.START_TAG )
502                 {
503                     if ( parser.getName().equals( "buildAgent" ) )
504                     {
505                         buildAgents.add( parseBuildAgentConfiguration( "buildAgent", parser, strict ) );
506                     }
507                     else if ( strict )
508                     {
509                         throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
510                     }
511                     else
512                     {
513                         // swallow up to end tag since this is not valid
514                         while ( parser.next() != XmlPullParser.END_TAG ) {}
515                     }
516                 }
517             }
518             else
519             {
520                 if ( strict )
521                 {
522                     throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
523                 }
524                 else
525                 {
526                     // swallow up to end tag since this is not valid
527                     while ( parser.next() != XmlPullParser.END_TAG ) {}
528                 }
529             }
530         }
531         return buildAgentGroupConfiguration;
532     } //-- BuildAgentGroupConfiguration parseBuildAgentGroupConfiguration( String, XmlPullParser, boolean )
533 
534     /**
535      * Method parseContinuumConfigurationModel.
536      * 
537      * @param tagName
538      * @param strict
539      * @param parser
540      * @throws IOException
541      * @throws XmlPullParserException
542      * @return ContinuumConfigurationModel
543      */
544     private ContinuumConfigurationModel parseContinuumConfigurationModel( String tagName, XmlPullParser parser, boolean strict )
545         throws IOException, XmlPullParserException
546     {
547         ContinuumConfigurationModel continuumConfigurationModel = new ContinuumConfigurationModel();
548         java.util.Set parsed = new java.util.HashSet();
549         int eventType = parser.getEventType();
550         boolean foundRoot = false;
551         continuumConfigurationModel.setModelEncoding( parser.getInputEncoding() );
552         while ( eventType != XmlPullParser.END_DOCUMENT )
553         {
554             if ( eventType == XmlPullParser.START_TAG )
555             {
556                 if ( parser.getName().equals( tagName ) )
557                 {
558                     foundRoot = true;
559                 }
560                 else if ( strict && ! foundRoot )
561                 {
562                     throw new XmlPullParserException( "Expected root element '" + tagName + "' but found '" + parser.getName() + "'", parser, null );
563                 }
564                 else if ( checkFieldWithDuplicate( parser, "baseUrl", null, parsed ) )
565                 {
566                     continuumConfigurationModel.setBaseUrl( getTrimmedValue( parser.nextText() ) );
567                 }
568                 else if ( checkFieldWithDuplicate( parser, "buildOutputDirectory", null, parsed ) )
569                 {
570                     continuumConfigurationModel.setBuildOutputDirectory( getTrimmedValue( parser.nextText() ) );
571                 }
572                 else if ( checkFieldWithDuplicate( parser, "deploymentRepositoryDirectory", null, parsed ) )
573                 {
574                     continuumConfigurationModel.setDeploymentRepositoryDirectory( getTrimmedValue( parser.nextText() ) );
575                 }
576                 else if ( checkFieldWithDuplicate( parser, "workingDirectory", null, parsed ) )
577                 {
578                     continuumConfigurationModel.setWorkingDirectory( getTrimmedValue( parser.nextText() ) );
579                 }
580                 else if ( checkFieldWithDuplicate( parser, "proxyConfiguration", null, parsed ) )
581                 {
582                     continuumConfigurationModel.setProxyConfiguration( parseProxyConfiguration( "proxyConfiguration", parser, strict ) );
583                 }
584                 else if ( checkFieldWithDuplicate( parser, "releaseOutputDirectory", null, parsed ) )
585                 {
586                     continuumConfigurationModel.setReleaseOutputDirectory( getTrimmedValue( parser.nextText() ) );
587                 }
588                 else if ( checkFieldWithDuplicate( parser, "numberOfBuildsInParallel", null, parsed ) )
589                 {
590                     continuumConfigurationModel.setNumberOfBuildsInParallel( getIntegerValue( getTrimmedValue( parser.nextText() ), "numberOfBuildsInParallel", parser, strict ) );
591                 }
592                 else if ( checkFieldWithDuplicate( parser, "buildAgents", null, parsed ) )
593                 {
594                     java.util.List buildAgents = new java.util.ArrayList/*<BuildAgentConfiguration>*/();
595                     continuumConfigurationModel.setBuildAgents( buildAgents );
596                     while ( parser.nextTag() == XmlPullParser.START_TAG )
597                     {
598                         if ( parser.getName().equals( "buildAgent" ) )
599                         {
600                             buildAgents.add( parseBuildAgentConfiguration( "buildAgent", parser, strict ) );
601                         }
602                         else if ( strict )
603                         {
604                             throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
605                         }
606                         else
607                         {
608                             // swallow up to end tag since this is not valid
609                             while ( parser.next() != XmlPullParser.END_TAG ) {}
610                         }
611                     }
612                 }
613                 else if ( checkFieldWithDuplicate( parser, "buildAgentGroups", null, parsed ) )
614                 {
615                     java.util.List buildAgentGroups = new java.util.ArrayList/*<BuildAgentGroupConfiguration>*/();
616                     continuumConfigurationModel.setBuildAgentGroups( buildAgentGroups );
617                     while ( parser.nextTag() == XmlPullParser.START_TAG )
618                     {
619                         if ( parser.getName().equals( "buildAgentGroup" ) )
620                         {
621                             buildAgentGroups.add( parseBuildAgentGroupConfiguration( "buildAgentGroup", parser, strict ) );
622                         }
623                         else if ( strict )
624                         {
625                             throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
626                         }
627                         else
628                         {
629                             // swallow up to end tag since this is not valid
630                             while ( parser.next() != XmlPullParser.END_TAG ) {}
631                         }
632                     }
633                 }
634                 else if ( strict )
635                 {
636                     throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
637                 }
638             }
639             eventType = parser.next();
640         }
641         return continuumConfigurationModel;
642     } //-- ContinuumConfigurationModel parseContinuumConfigurationModel( String, XmlPullParser, boolean )
643 
644     /**
645      * Method parseProxyConfiguration.
646      * 
647      * @param tagName
648      * @param strict
649      * @param parser
650      * @throws IOException
651      * @throws XmlPullParserException
652      * @return ProxyConfiguration
653      */
654     private ProxyConfiguration parseProxyConfiguration( String tagName, XmlPullParser parser, boolean strict )
655         throws IOException, XmlPullParserException
656     {
657         ProxyConfiguration proxyConfiguration = new ProxyConfiguration();
658         java.util.Set parsed = new java.util.HashSet();
659         while ( parser.nextTag() == XmlPullParser.START_TAG )
660         {
661             if ( checkFieldWithDuplicate( parser, "proxyHost", null, parsed ) )
662             {
663                 proxyConfiguration.setProxyHost( getTrimmedValue( parser.nextText() ) );
664             }
665             else if ( checkFieldWithDuplicate( parser, "proxyPort", null, parsed ) )
666             {
667                 proxyConfiguration.setProxyPort( getIntegerValue( getTrimmedValue( parser.nextText() ), "proxyPort", parser, strict ) );
668             }
669             else if ( checkFieldWithDuplicate( parser, "proxyUser", null, parsed ) )
670             {
671                 proxyConfiguration.setProxyUser( getTrimmedValue( parser.nextText() ) );
672             }
673             else if ( checkFieldWithDuplicate( parser, "proxyPassword", null, parsed ) )
674             {
675                 proxyConfiguration.setProxyPassword( getTrimmedValue( parser.nextText() ) );
676             }
677             else
678             {
679                 if ( strict )
680                 {
681                     throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
682                 }
683                 else
684                 {
685                     // swallow up to end tag since this is not valid
686                     while ( parser.next() != XmlPullParser.END_TAG ) {}
687                 }
688             }
689         }
690         return proxyConfiguration;
691     } //-- ProxyConfiguration parseProxyConfiguration( String, XmlPullParser, boolean )
692 
693     /**
694      * @see ReaderFactory#newXmlReader
695      * 
696      * @param reader
697      * @param strict
698      * @throws IOException
699      * @throws XmlPullParserException
700      * @return ContinuumConfigurationModel
701      */
702     public ContinuumConfigurationModel read( Reader reader, boolean strict )
703         throws IOException, XmlPullParserException
704     {
705         XmlPullParser parser = new MXParser();
706 
707         parser.setInput( reader );
708 
709         if ( addDefaultEntities )
710         {
711             // ----------------------------------------------------------------------
712             // Latin 1 entities
713             // ----------------------------------------------------------------------
714 
715             parser.defineEntityReplacementText( "nbsp", "\u00a0" );
716             parser.defineEntityReplacementText( "iexcl", "\u00a1" );
717             parser.defineEntityReplacementText( "cent", "\u00a2" );
718             parser.defineEntityReplacementText( "pound", "\u00a3" );
719             parser.defineEntityReplacementText( "curren", "\u00a4" );
720             parser.defineEntityReplacementText( "yen", "\u00a5" );
721             parser.defineEntityReplacementText( "brvbar", "\u00a6" );
722             parser.defineEntityReplacementText( "sect", "\u00a7" );
723             parser.defineEntityReplacementText( "uml", "\u00a8" );
724             parser.defineEntityReplacementText( "copy", "\u00a9" );
725             parser.defineEntityReplacementText( "ordf", "\u00aa" );
726             parser.defineEntityReplacementText( "laquo", "\u00ab" );
727             parser.defineEntityReplacementText( "not", "\u00ac" );
728             parser.defineEntityReplacementText( "shy", "\u00ad" );
729             parser.defineEntityReplacementText( "reg", "\u00ae" );
730             parser.defineEntityReplacementText( "macr", "\u00af" );
731             parser.defineEntityReplacementText( "deg", "\u00b0" );
732             parser.defineEntityReplacementText( "plusmn", "\u00b1" );
733             parser.defineEntityReplacementText( "sup2", "\u00b2" );
734             parser.defineEntityReplacementText( "sup3", "\u00b3" );
735             parser.defineEntityReplacementText( "acute", "\u00b4" );
736             parser.defineEntityReplacementText( "micro", "\u00b5" );
737             parser.defineEntityReplacementText( "para", "\u00b6" );
738             parser.defineEntityReplacementText( "middot", "\u00b7" );
739             parser.defineEntityReplacementText( "cedil", "\u00b8" );
740             parser.defineEntityReplacementText( "sup1", "\u00b9" );
741             parser.defineEntityReplacementText( "ordm", "\u00ba" );
742             parser.defineEntityReplacementText( "raquo", "\u00bb" );
743             parser.defineEntityReplacementText( "frac14", "\u00bc" );
744             parser.defineEntityReplacementText( "frac12", "\u00bd" );
745             parser.defineEntityReplacementText( "frac34", "\u00be" );
746             parser.defineEntityReplacementText( "iquest", "\u00bf" );
747             parser.defineEntityReplacementText( "Agrave", "\u00c0" );
748             parser.defineEntityReplacementText( "Aacute", "\u00c1" );
749             parser.defineEntityReplacementText( "Acirc", "\u00c2" );
750             parser.defineEntityReplacementText( "Atilde", "\u00c3" );
751             parser.defineEntityReplacementText( "Auml", "\u00c4" );
752             parser.defineEntityReplacementText( "Aring", "\u00c5" );
753             parser.defineEntityReplacementText( "AElig", "\u00c6" );
754             parser.defineEntityReplacementText( "Ccedil", "\u00c7" );
755             parser.defineEntityReplacementText( "Egrave", "\u00c8" );
756             parser.defineEntityReplacementText( "Eacute", "\u00c9" );
757             parser.defineEntityReplacementText( "Ecirc", "\u00ca" );
758             parser.defineEntityReplacementText( "Euml", "\u00cb" );
759             parser.defineEntityReplacementText( "Igrave", "\u00cc" );
760             parser.defineEntityReplacementText( "Iacute", "\u00cd" );
761             parser.defineEntityReplacementText( "Icirc", "\u00ce" );
762             parser.defineEntityReplacementText( "Iuml", "\u00cf" );
763             parser.defineEntityReplacementText( "ETH", "\u00d0" );
764             parser.defineEntityReplacementText( "Ntilde", "\u00d1" );
765             parser.defineEntityReplacementText( "Ograve", "\u00d2" );
766             parser.defineEntityReplacementText( "Oacute", "\u00d3" );
767             parser.defineEntityReplacementText( "Ocirc", "\u00d4" );
768             parser.defineEntityReplacementText( "Otilde", "\u00d5" );
769             parser.defineEntityReplacementText( "Ouml", "\u00d6" );
770             parser.defineEntityReplacementText( "times", "\u00d7" );
771             parser.defineEntityReplacementText( "Oslash", "\u00d8" );
772             parser.defineEntityReplacementText( "Ugrave", "\u00d9" );
773             parser.defineEntityReplacementText( "Uacute", "\u00da" );
774             parser.defineEntityReplacementText( "Ucirc", "\u00db" );
775             parser.defineEntityReplacementText( "Uuml", "\u00dc" );
776             parser.defineEntityReplacementText( "Yacute", "\u00dd" );
777             parser.defineEntityReplacementText( "THORN", "\u00de" );
778             parser.defineEntityReplacementText( "szlig", "\u00df" );
779             parser.defineEntityReplacementText( "agrave", "\u00e0" );
780             parser.defineEntityReplacementText( "aacute", "\u00e1" );
781             parser.defineEntityReplacementText( "acirc", "\u00e2" );
782             parser.defineEntityReplacementText( "atilde", "\u00e3" );
783             parser.defineEntityReplacementText( "auml", "\u00e4" );
784             parser.defineEntityReplacementText( "aring", "\u00e5" );
785             parser.defineEntityReplacementText( "aelig", "\u00e6" );
786             parser.defineEntityReplacementText( "ccedil", "\u00e7" );
787             parser.defineEntityReplacementText( "egrave", "\u00e8" );
788             parser.defineEntityReplacementText( "eacute", "\u00e9" );
789             parser.defineEntityReplacementText( "ecirc", "\u00ea" );
790             parser.defineEntityReplacementText( "euml", "\u00eb" );
791             parser.defineEntityReplacementText( "igrave", "\u00ec" );
792             parser.defineEntityReplacementText( "iacute", "\u00ed" );
793             parser.defineEntityReplacementText( "icirc", "\u00ee" );
794             parser.defineEntityReplacementText( "iuml", "\u00ef" );
795             parser.defineEntityReplacementText( "eth", "\u00f0" );
796             parser.defineEntityReplacementText( "ntilde", "\u00f1" );
797             parser.defineEntityReplacementText( "ograve", "\u00f2" );
798             parser.defineEntityReplacementText( "oacute", "\u00f3" );
799             parser.defineEntityReplacementText( "ocirc", "\u00f4" );
800             parser.defineEntityReplacementText( "otilde", "\u00f5" );
801             parser.defineEntityReplacementText( "ouml", "\u00f6" );
802             parser.defineEntityReplacementText( "divide", "\u00f7" );
803             parser.defineEntityReplacementText( "oslash", "\u00f8" );
804             parser.defineEntityReplacementText( "ugrave", "\u00f9" );
805             parser.defineEntityReplacementText( "uacute", "\u00fa" );
806             parser.defineEntityReplacementText( "ucirc", "\u00fb" );
807             parser.defineEntityReplacementText( "uuml", "\u00fc" );
808             parser.defineEntityReplacementText( "yacute", "\u00fd" );
809             parser.defineEntityReplacementText( "thorn", "\u00fe" );
810             parser.defineEntityReplacementText( "yuml", "\u00ff" );
811 
812             // ----------------------------------------------------------------------
813             // Special entities
814             // ----------------------------------------------------------------------
815 
816             parser.defineEntityReplacementText( "OElig", "\u0152" );
817             parser.defineEntityReplacementText( "oelig", "\u0153" );
818             parser.defineEntityReplacementText( "Scaron", "\u0160" );
819             parser.defineEntityReplacementText( "scaron", "\u0161" );
820             parser.defineEntityReplacementText( "Yuml", "\u0178" );
821             parser.defineEntityReplacementText( "circ", "\u02c6" );
822             parser.defineEntityReplacementText( "tilde", "\u02dc" );
823             parser.defineEntityReplacementText( "ensp", "\u2002" );
824             parser.defineEntityReplacementText( "emsp", "\u2003" );
825             parser.defineEntityReplacementText( "thinsp", "\u2009" );
826             parser.defineEntityReplacementText( "zwnj", "\u200c" );
827             parser.defineEntityReplacementText( "zwj", "\u200d" );
828             parser.defineEntityReplacementText( "lrm", "\u200e" );
829             parser.defineEntityReplacementText( "rlm", "\u200f" );
830             parser.defineEntityReplacementText( "ndash", "\u2013" );
831             parser.defineEntityReplacementText( "mdash", "\u2014" );
832             parser.defineEntityReplacementText( "lsquo", "\u2018" );
833             parser.defineEntityReplacementText( "rsquo", "\u2019" );
834             parser.defineEntityReplacementText( "sbquo", "\u201a" );
835             parser.defineEntityReplacementText( "ldquo", "\u201c" );
836             parser.defineEntityReplacementText( "rdquo", "\u201d" );
837             parser.defineEntityReplacementText( "bdquo", "\u201e" );
838             parser.defineEntityReplacementText( "dagger", "\u2020" );
839             parser.defineEntityReplacementText( "Dagger", "\u2021" );
840             parser.defineEntityReplacementText( "permil", "\u2030" );
841             parser.defineEntityReplacementText( "lsaquo", "\u2039" );
842             parser.defineEntityReplacementText( "rsaquo", "\u203a" );
843             parser.defineEntityReplacementText( "euro", "\u20ac" );
844 
845             // ----------------------------------------------------------------------
846             // Symbol entities
847             // ----------------------------------------------------------------------
848 
849             parser.defineEntityReplacementText( "fnof", "\u0192" );
850             parser.defineEntityReplacementText( "Alpha", "\u0391" );
851             parser.defineEntityReplacementText( "Beta", "\u0392" );
852             parser.defineEntityReplacementText( "Gamma", "\u0393" );
853             parser.defineEntityReplacementText( "Delta", "\u0394" );
854             parser.defineEntityReplacementText( "Epsilon", "\u0395" );
855             parser.defineEntityReplacementText( "Zeta", "\u0396" );
856             parser.defineEntityReplacementText( "Eta", "\u0397" );
857             parser.defineEntityReplacementText( "Theta", "\u0398" );
858             parser.defineEntityReplacementText( "Iota", "\u0399" );
859             parser.defineEntityReplacementText( "Kappa", "\u039a" );
860             parser.defineEntityReplacementText( "Lambda", "\u039b" );
861             parser.defineEntityReplacementText( "Mu", "\u039c" );
862             parser.defineEntityReplacementText( "Nu", "\u039d" );
863             parser.defineEntityReplacementText( "Xi", "\u039e" );
864             parser.defineEntityReplacementText( "Omicron", "\u039f" );
865             parser.defineEntityReplacementText( "Pi", "\u03a0" );
866             parser.defineEntityReplacementText( "Rho", "\u03a1" );
867             parser.defineEntityReplacementText( "Sigma", "\u03a3" );
868             parser.defineEntityReplacementText( "Tau", "\u03a4" );
869             parser.defineEntityReplacementText( "Upsilon", "\u03a5" );
870             parser.defineEntityReplacementText( "Phi", "\u03a6" );
871             parser.defineEntityReplacementText( "Chi", "\u03a7" );
872             parser.defineEntityReplacementText( "Psi", "\u03a8" );
873             parser.defineEntityReplacementText( "Omega", "\u03a9" );
874             parser.defineEntityReplacementText( "alpha", "\u03b1" );
875             parser.defineEntityReplacementText( "beta", "\u03b2" );
876             parser.defineEntityReplacementText( "gamma", "\u03b3" );
877             parser.defineEntityReplacementText( "delta", "\u03b4" );
878             parser.defineEntityReplacementText( "epsilon", "\u03b5" );
879             parser.defineEntityReplacementText( "zeta", "\u03b6" );
880             parser.defineEntityReplacementText( "eta", "\u03b7" );
881             parser.defineEntityReplacementText( "theta", "\u03b8" );
882             parser.defineEntityReplacementText( "iota", "\u03b9" );
883             parser.defineEntityReplacementText( "kappa", "\u03ba" );
884             parser.defineEntityReplacementText( "lambda", "\u03bb" );
885             parser.defineEntityReplacementText( "mu", "\u03bc" );
886             parser.defineEntityReplacementText( "nu", "\u03bd" );
887             parser.defineEntityReplacementText( "xi", "\u03be" );
888             parser.defineEntityReplacementText( "omicron", "\u03bf" );
889             parser.defineEntityReplacementText( "pi", "\u03c0" );
890             parser.defineEntityReplacementText( "rho", "\u03c1" );
891             parser.defineEntityReplacementText( "sigmaf", "\u03c2" );
892             parser.defineEntityReplacementText( "sigma", "\u03c3" );
893             parser.defineEntityReplacementText( "tau", "\u03c4" );
894             parser.defineEntityReplacementText( "upsilon", "\u03c5" );
895             parser.defineEntityReplacementText( "phi", "\u03c6" );
896             parser.defineEntityReplacementText( "chi", "\u03c7" );
897             parser.defineEntityReplacementText( "psi", "\u03c8" );
898             parser.defineEntityReplacementText( "omega", "\u03c9" );
899             parser.defineEntityReplacementText( "thetasym", "\u03d1" );
900             parser.defineEntityReplacementText( "upsih", "\u03d2" );
901             parser.defineEntityReplacementText( "piv", "\u03d6" );
902             parser.defineEntityReplacementText( "bull", "\u2022" );
903             parser.defineEntityReplacementText( "hellip", "\u2026" );
904             parser.defineEntityReplacementText( "prime", "\u2032" );
905             parser.defineEntityReplacementText( "Prime", "\u2033" );
906             parser.defineEntityReplacementText( "oline", "\u203e" );
907             parser.defineEntityReplacementText( "frasl", "\u2044" );
908             parser.defineEntityReplacementText( "weierp", "\u2118" );
909             parser.defineEntityReplacementText( "image", "\u2111" );
910             parser.defineEntityReplacementText( "real", "\u211c" );
911             parser.defineEntityReplacementText( "trade", "\u2122" );
912             parser.defineEntityReplacementText( "alefsym", "\u2135" );
913             parser.defineEntityReplacementText( "larr", "\u2190" );
914             parser.defineEntityReplacementText( "uarr", "\u2191" );
915             parser.defineEntityReplacementText( "rarr", "\u2192" );
916             parser.defineEntityReplacementText( "darr", "\u2193" );
917             parser.defineEntityReplacementText( "harr", "\u2194" );
918             parser.defineEntityReplacementText( "crarr", "\u21b5" );
919             parser.defineEntityReplacementText( "lArr", "\u21d0" );
920             parser.defineEntityReplacementText( "uArr", "\u21d1" );
921             parser.defineEntityReplacementText( "rArr", "\u21d2" );
922             parser.defineEntityReplacementText( "dArr", "\u21d3" );
923             parser.defineEntityReplacementText( "hArr", "\u21d4" );
924             parser.defineEntityReplacementText( "forall", "\u2200" );
925             parser.defineEntityReplacementText( "part", "\u2202" );
926             parser.defineEntityReplacementText( "exist", "\u2203" );
927             parser.defineEntityReplacementText( "empty", "\u2205" );
928             parser.defineEntityReplacementText( "nabla", "\u2207" );
929             parser.defineEntityReplacementText( "isin", "\u2208" );
930             parser.defineEntityReplacementText( "notin", "\u2209" );
931             parser.defineEntityReplacementText( "ni", "\u220b" );
932             parser.defineEntityReplacementText( "prod", "\u220f" );
933             parser.defineEntityReplacementText( "sum", "\u2211" );
934             parser.defineEntityReplacementText( "minus", "\u2212" );
935             parser.defineEntityReplacementText( "lowast", "\u2217" );
936             parser.defineEntityReplacementText( "radic", "\u221a" );
937             parser.defineEntityReplacementText( "prop", "\u221d" );
938             parser.defineEntityReplacementText( "infin", "\u221e" );
939             parser.defineEntityReplacementText( "ang", "\u2220" );
940             parser.defineEntityReplacementText( "and", "\u2227" );
941             parser.defineEntityReplacementText( "or", "\u2228" );
942             parser.defineEntityReplacementText( "cap", "\u2229" );
943             parser.defineEntityReplacementText( "cup", "\u222a" );
944             parser.defineEntityReplacementText( "int", "\u222b" );
945             parser.defineEntityReplacementText( "there4", "\u2234" );
946             parser.defineEntityReplacementText( "sim", "\u223c" );
947             parser.defineEntityReplacementText( "cong", "\u2245" );
948             parser.defineEntityReplacementText( "asymp", "\u2248" );
949             parser.defineEntityReplacementText( "ne", "\u2260" );
950             parser.defineEntityReplacementText( "equiv", "\u2261" );
951             parser.defineEntityReplacementText( "le", "\u2264" );
952             parser.defineEntityReplacementText( "ge", "\u2265" );
953             parser.defineEntityReplacementText( "sub", "\u2282" );
954             parser.defineEntityReplacementText( "sup", "\u2283" );
955             parser.defineEntityReplacementText( "nsub", "\u2284" );
956             parser.defineEntityReplacementText( "sube", "\u2286" );
957             parser.defineEntityReplacementText( "supe", "\u2287" );
958             parser.defineEntityReplacementText( "oplus", "\u2295" );
959             parser.defineEntityReplacementText( "otimes", "\u2297" );
960             parser.defineEntityReplacementText( "perp", "\u22a5" );
961             parser.defineEntityReplacementText( "sdot", "\u22c5" );
962             parser.defineEntityReplacementText( "lceil", "\u2308" );
963             parser.defineEntityReplacementText( "rceil", "\u2309" );
964             parser.defineEntityReplacementText( "lfloor", "\u230a" );
965             parser.defineEntityReplacementText( "rfloor", "\u230b" );
966             parser.defineEntityReplacementText( "lang", "\u2329" );
967             parser.defineEntityReplacementText( "rang", "\u232a" );
968             parser.defineEntityReplacementText( "loz", "\u25ca" );
969             parser.defineEntityReplacementText( "spades", "\u2660" );
970             parser.defineEntityReplacementText( "clubs", "\u2663" );
971             parser.defineEntityReplacementText( "hearts", "\u2665" );
972             parser.defineEntityReplacementText( "diams", "\u2666" );
973 
974         }
975 
976         parser.next();
977         return parseContinuumConfigurationModel( "continuum-configuration", parser, strict );
978     } //-- ContinuumConfigurationModel read( Reader, boolean )
979 
980     /**
981      * @see ReaderFactory#newXmlReader
982      * 
983      * @param reader
984      * @throws IOException
985      * @throws XmlPullParserException
986      * @return ContinuumConfigurationModel
987      */
988     public ContinuumConfigurationModel read( Reader reader )
989         throws IOException, XmlPullParserException
990     {
991         return read( reader, true );
992     } //-- ContinuumConfigurationModel read( Reader )
993 
994     /**
995      * Method read.
996      * 
997      * @param in
998      * @param strict
999      * @throws IOException
1000      * @throws XmlPullParserException
1001      * @return ContinuumConfigurationModel
1002      */
1003     public ContinuumConfigurationModel read( InputStream in, boolean strict )
1004         throws IOException, XmlPullParserException
1005     {
1006         Reader reader = ReaderFactory.newXmlReader( in );
1007 
1008         return read( reader, strict );
1009     } //-- ContinuumConfigurationModel read( InputStream, boolean )
1010 
1011     /**
1012      * Method read.
1013      * 
1014      * @param in
1015      * @throws IOException
1016      * @throws XmlPullParserException
1017      * @return ContinuumConfigurationModel
1018      */
1019     public ContinuumConfigurationModel read( InputStream in )
1020         throws IOException, XmlPullParserException
1021     {
1022         Reader reader = ReaderFactory.newXmlReader( in );
1023 
1024         return read( reader );
1025     } //-- ContinuumConfigurationModel read( InputStream )
1026 
1027     /**
1028      * Sets the state of the "add default entities" flag.
1029      * 
1030      * @param addDefaultEntities
1031      */
1032     public void setAddDefaultEntities( boolean addDefaultEntities )
1033     {
1034         this.addDefaultEntities = addDefaultEntities;
1035     } //-- void setAddDefaultEntities( boolean )
1036 
1037 }