View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello
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, "distributedBuildEnabled", null, parsed ) )
593                 {
594                     continuumConfigurationModel.setDistributedBuildEnabled( getBooleanValue( getTrimmedValue( parser.nextText() ), "distributedBuildEnabled", parser, "false" ) );
595                 }
596                 else if ( checkFieldWithDuplicate( parser, "sharedSecretPassword", null, parsed ) )
597                 {
598                     continuumConfigurationModel.setSharedSecretPassword( getTrimmedValue( parser.nextText() ) );
599                 }
600                 else if ( checkFieldWithDuplicate( parser, "buildAgents", null, parsed ) )
601                 {
602                     java.util.List buildAgents = new java.util.ArrayList/*<BuildAgentConfiguration>*/();
603                     continuumConfigurationModel.setBuildAgents( buildAgents );
604                     while ( parser.nextTag() == XmlPullParser.START_TAG )
605                     {
606                         if ( parser.getName().equals( "buildAgent" ) )
607                         {
608                             buildAgents.add( parseBuildAgentConfiguration( "buildAgent", parser, strict ) );
609                         }
610                         else if ( strict )
611                         {
612                             throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
613                         }
614                         else
615                         {
616                             // swallow up to end tag since this is not valid
617                             while ( parser.next() != XmlPullParser.END_TAG ) {}
618                         }
619                     }
620                 }
621                 else if ( checkFieldWithDuplicate( parser, "buildAgentGroups", null, parsed ) )
622                 {
623                     java.util.List buildAgentGroups = new java.util.ArrayList/*<BuildAgentGroupConfiguration>*/();
624                     continuumConfigurationModel.setBuildAgentGroups( buildAgentGroups );
625                     while ( parser.nextTag() == XmlPullParser.START_TAG )
626                     {
627                         if ( parser.getName().equals( "buildAgentGroup" ) )
628                         {
629                             buildAgentGroups.add( parseBuildAgentGroupConfiguration( "buildAgentGroup", parser, strict ) );
630                         }
631                         else if ( strict )
632                         {
633                             throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
634                         }
635                         else
636                         {
637                             // swallow up to end tag since this is not valid
638                             while ( parser.next() != XmlPullParser.END_TAG ) {}
639                         }
640                     }
641                 }
642                 else if ( checkFieldWithDuplicate( parser, "initialized", null, parsed ) )
643                 {
644                     continuumConfigurationModel.setInitialized( getBooleanValue( getTrimmedValue( parser.nextText() ), "initialized", parser, "false" ) );
645                 }
646                 else if ( strict )
647                 {
648                     throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
649                 }
650             }
651             eventType = parser.next();
652         }
653         return continuumConfigurationModel;
654     } //-- ContinuumConfigurationModel parseContinuumConfigurationModel( String, XmlPullParser, boolean )
655 
656     /**
657      * Method parseProxyConfiguration.
658      * 
659      * @param tagName
660      * @param strict
661      * @param parser
662      * @throws IOException
663      * @throws XmlPullParserException
664      * @return ProxyConfiguration
665      */
666     private ProxyConfiguration parseProxyConfiguration( String tagName, XmlPullParser parser, boolean strict )
667         throws IOException, XmlPullParserException
668     {
669         ProxyConfiguration proxyConfiguration = new ProxyConfiguration();
670         java.util.Set parsed = new java.util.HashSet();
671         while ( parser.nextTag() == XmlPullParser.START_TAG )
672         {
673             if ( checkFieldWithDuplicate( parser, "proxyHost", null, parsed ) )
674             {
675                 proxyConfiguration.setProxyHost( getTrimmedValue( parser.nextText() ) );
676             }
677             else if ( checkFieldWithDuplicate( parser, "proxyPort", null, parsed ) )
678             {
679                 proxyConfiguration.setProxyPort( getIntegerValue( getTrimmedValue( parser.nextText() ), "proxyPort", parser, strict ) );
680             }
681             else if ( checkFieldWithDuplicate( parser, "proxyUser", null, parsed ) )
682             {
683                 proxyConfiguration.setProxyUser( getTrimmedValue( parser.nextText() ) );
684             }
685             else if ( checkFieldWithDuplicate( parser, "proxyPassword", null, parsed ) )
686             {
687                 proxyConfiguration.setProxyPassword( getTrimmedValue( parser.nextText() ) );
688             }
689             else
690             {
691                 if ( strict )
692                 {
693                     throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null );
694                 }
695                 else
696                 {
697                     // swallow up to end tag since this is not valid
698                     while ( parser.next() != XmlPullParser.END_TAG ) {}
699                 }
700             }
701         }
702         return proxyConfiguration;
703     } //-- ProxyConfiguration parseProxyConfiguration( String, XmlPullParser, boolean )
704 
705     /**
706      * @see ReaderFactory#newXmlReader
707      * 
708      * @param reader
709      * @param strict
710      * @throws IOException
711      * @throws XmlPullParserException
712      * @return ContinuumConfigurationModel
713      */
714     public ContinuumConfigurationModel read( Reader reader, boolean strict )
715         throws IOException, XmlPullParserException
716     {
717         XmlPullParser parser = new MXParser();
718 
719         parser.setInput( reader );
720 
721         if ( addDefaultEntities )
722         {
723             // ----------------------------------------------------------------------
724             // Latin 1 entities
725             // ----------------------------------------------------------------------
726 
727             parser.defineEntityReplacementText( "nbsp", "\u00a0" );
728             parser.defineEntityReplacementText( "iexcl", "\u00a1" );
729             parser.defineEntityReplacementText( "cent", "\u00a2" );
730             parser.defineEntityReplacementText( "pound", "\u00a3" );
731             parser.defineEntityReplacementText( "curren", "\u00a4" );
732             parser.defineEntityReplacementText( "yen", "\u00a5" );
733             parser.defineEntityReplacementText( "brvbar", "\u00a6" );
734             parser.defineEntityReplacementText( "sect", "\u00a7" );
735             parser.defineEntityReplacementText( "uml", "\u00a8" );
736             parser.defineEntityReplacementText( "copy", "\u00a9" );
737             parser.defineEntityReplacementText( "ordf", "\u00aa" );
738             parser.defineEntityReplacementText( "laquo", "\u00ab" );
739             parser.defineEntityReplacementText( "not", "\u00ac" );
740             parser.defineEntityReplacementText( "shy", "\u00ad" );
741             parser.defineEntityReplacementText( "reg", "\u00ae" );
742             parser.defineEntityReplacementText( "macr", "\u00af" );
743             parser.defineEntityReplacementText( "deg", "\u00b0" );
744             parser.defineEntityReplacementText( "plusmn", "\u00b1" );
745             parser.defineEntityReplacementText( "sup2", "\u00b2" );
746             parser.defineEntityReplacementText( "sup3", "\u00b3" );
747             parser.defineEntityReplacementText( "acute", "\u00b4" );
748             parser.defineEntityReplacementText( "micro", "\u00b5" );
749             parser.defineEntityReplacementText( "para", "\u00b6" );
750             parser.defineEntityReplacementText( "middot", "\u00b7" );
751             parser.defineEntityReplacementText( "cedil", "\u00b8" );
752             parser.defineEntityReplacementText( "sup1", "\u00b9" );
753             parser.defineEntityReplacementText( "ordm", "\u00ba" );
754             parser.defineEntityReplacementText( "raquo", "\u00bb" );
755             parser.defineEntityReplacementText( "frac14", "\u00bc" );
756             parser.defineEntityReplacementText( "frac12", "\u00bd" );
757             parser.defineEntityReplacementText( "frac34", "\u00be" );
758             parser.defineEntityReplacementText( "iquest", "\u00bf" );
759             parser.defineEntityReplacementText( "Agrave", "\u00c0" );
760             parser.defineEntityReplacementText( "Aacute", "\u00c1" );
761             parser.defineEntityReplacementText( "Acirc", "\u00c2" );
762             parser.defineEntityReplacementText( "Atilde", "\u00c3" );
763             parser.defineEntityReplacementText( "Auml", "\u00c4" );
764             parser.defineEntityReplacementText( "Aring", "\u00c5" );
765             parser.defineEntityReplacementText( "AElig", "\u00c6" );
766             parser.defineEntityReplacementText( "Ccedil", "\u00c7" );
767             parser.defineEntityReplacementText( "Egrave", "\u00c8" );
768             parser.defineEntityReplacementText( "Eacute", "\u00c9" );
769             parser.defineEntityReplacementText( "Ecirc", "\u00ca" );
770             parser.defineEntityReplacementText( "Euml", "\u00cb" );
771             parser.defineEntityReplacementText( "Igrave", "\u00cc" );
772             parser.defineEntityReplacementText( "Iacute", "\u00cd" );
773             parser.defineEntityReplacementText( "Icirc", "\u00ce" );
774             parser.defineEntityReplacementText( "Iuml", "\u00cf" );
775             parser.defineEntityReplacementText( "ETH", "\u00d0" );
776             parser.defineEntityReplacementText( "Ntilde", "\u00d1" );
777             parser.defineEntityReplacementText( "Ograve", "\u00d2" );
778             parser.defineEntityReplacementText( "Oacute", "\u00d3" );
779             parser.defineEntityReplacementText( "Ocirc", "\u00d4" );
780             parser.defineEntityReplacementText( "Otilde", "\u00d5" );
781             parser.defineEntityReplacementText( "Ouml", "\u00d6" );
782             parser.defineEntityReplacementText( "times", "\u00d7" );
783             parser.defineEntityReplacementText( "Oslash", "\u00d8" );
784             parser.defineEntityReplacementText( "Ugrave", "\u00d9" );
785             parser.defineEntityReplacementText( "Uacute", "\u00da" );
786             parser.defineEntityReplacementText( "Ucirc", "\u00db" );
787             parser.defineEntityReplacementText( "Uuml", "\u00dc" );
788             parser.defineEntityReplacementText( "Yacute", "\u00dd" );
789             parser.defineEntityReplacementText( "THORN", "\u00de" );
790             parser.defineEntityReplacementText( "szlig", "\u00df" );
791             parser.defineEntityReplacementText( "agrave", "\u00e0" );
792             parser.defineEntityReplacementText( "aacute", "\u00e1" );
793             parser.defineEntityReplacementText( "acirc", "\u00e2" );
794             parser.defineEntityReplacementText( "atilde", "\u00e3" );
795             parser.defineEntityReplacementText( "auml", "\u00e4" );
796             parser.defineEntityReplacementText( "aring", "\u00e5" );
797             parser.defineEntityReplacementText( "aelig", "\u00e6" );
798             parser.defineEntityReplacementText( "ccedil", "\u00e7" );
799             parser.defineEntityReplacementText( "egrave", "\u00e8" );
800             parser.defineEntityReplacementText( "eacute", "\u00e9" );
801             parser.defineEntityReplacementText( "ecirc", "\u00ea" );
802             parser.defineEntityReplacementText( "euml", "\u00eb" );
803             parser.defineEntityReplacementText( "igrave", "\u00ec" );
804             parser.defineEntityReplacementText( "iacute", "\u00ed" );
805             parser.defineEntityReplacementText( "icirc", "\u00ee" );
806             parser.defineEntityReplacementText( "iuml", "\u00ef" );
807             parser.defineEntityReplacementText( "eth", "\u00f0" );
808             parser.defineEntityReplacementText( "ntilde", "\u00f1" );
809             parser.defineEntityReplacementText( "ograve", "\u00f2" );
810             parser.defineEntityReplacementText( "oacute", "\u00f3" );
811             parser.defineEntityReplacementText( "ocirc", "\u00f4" );
812             parser.defineEntityReplacementText( "otilde", "\u00f5" );
813             parser.defineEntityReplacementText( "ouml", "\u00f6" );
814             parser.defineEntityReplacementText( "divide", "\u00f7" );
815             parser.defineEntityReplacementText( "oslash", "\u00f8" );
816             parser.defineEntityReplacementText( "ugrave", "\u00f9" );
817             parser.defineEntityReplacementText( "uacute", "\u00fa" );
818             parser.defineEntityReplacementText( "ucirc", "\u00fb" );
819             parser.defineEntityReplacementText( "uuml", "\u00fc" );
820             parser.defineEntityReplacementText( "yacute", "\u00fd" );
821             parser.defineEntityReplacementText( "thorn", "\u00fe" );
822             parser.defineEntityReplacementText( "yuml", "\u00ff" );
823 
824             // ----------------------------------------------------------------------
825             // Special entities
826             // ----------------------------------------------------------------------
827 
828             parser.defineEntityReplacementText( "OElig", "\u0152" );
829             parser.defineEntityReplacementText( "oelig", "\u0153" );
830             parser.defineEntityReplacementText( "Scaron", "\u0160" );
831             parser.defineEntityReplacementText( "scaron", "\u0161" );
832             parser.defineEntityReplacementText( "Yuml", "\u0178" );
833             parser.defineEntityReplacementText( "circ", "\u02c6" );
834             parser.defineEntityReplacementText( "tilde", "\u02dc" );
835             parser.defineEntityReplacementText( "ensp", "\u2002" );
836             parser.defineEntityReplacementText( "emsp", "\u2003" );
837             parser.defineEntityReplacementText( "thinsp", "\u2009" );
838             parser.defineEntityReplacementText( "zwnj", "\u200c" );
839             parser.defineEntityReplacementText( "zwj", "\u200d" );
840             parser.defineEntityReplacementText( "lrm", "\u200e" );
841             parser.defineEntityReplacementText( "rlm", "\u200f" );
842             parser.defineEntityReplacementText( "ndash", "\u2013" );
843             parser.defineEntityReplacementText( "mdash", "\u2014" );
844             parser.defineEntityReplacementText( "lsquo", "\u2018" );
845             parser.defineEntityReplacementText( "rsquo", "\u2019" );
846             parser.defineEntityReplacementText( "sbquo", "\u201a" );
847             parser.defineEntityReplacementText( "ldquo", "\u201c" );
848             parser.defineEntityReplacementText( "rdquo", "\u201d" );
849             parser.defineEntityReplacementText( "bdquo", "\u201e" );
850             parser.defineEntityReplacementText( "dagger", "\u2020" );
851             parser.defineEntityReplacementText( "Dagger", "\u2021" );
852             parser.defineEntityReplacementText( "permil", "\u2030" );
853             parser.defineEntityReplacementText( "lsaquo", "\u2039" );
854             parser.defineEntityReplacementText( "rsaquo", "\u203a" );
855             parser.defineEntityReplacementText( "euro", "\u20ac" );
856 
857             // ----------------------------------------------------------------------
858             // Symbol entities
859             // ----------------------------------------------------------------------
860 
861             parser.defineEntityReplacementText( "fnof", "\u0192" );
862             parser.defineEntityReplacementText( "Alpha", "\u0391" );
863             parser.defineEntityReplacementText( "Beta", "\u0392" );
864             parser.defineEntityReplacementText( "Gamma", "\u0393" );
865             parser.defineEntityReplacementText( "Delta", "\u0394" );
866             parser.defineEntityReplacementText( "Epsilon", "\u0395" );
867             parser.defineEntityReplacementText( "Zeta", "\u0396" );
868             parser.defineEntityReplacementText( "Eta", "\u0397" );
869             parser.defineEntityReplacementText( "Theta", "\u0398" );
870             parser.defineEntityReplacementText( "Iota", "\u0399" );
871             parser.defineEntityReplacementText( "Kappa", "\u039a" );
872             parser.defineEntityReplacementText( "Lambda", "\u039b" );
873             parser.defineEntityReplacementText( "Mu", "\u039c" );
874             parser.defineEntityReplacementText( "Nu", "\u039d" );
875             parser.defineEntityReplacementText( "Xi", "\u039e" );
876             parser.defineEntityReplacementText( "Omicron", "\u039f" );
877             parser.defineEntityReplacementText( "Pi", "\u03a0" );
878             parser.defineEntityReplacementText( "Rho", "\u03a1" );
879             parser.defineEntityReplacementText( "Sigma", "\u03a3" );
880             parser.defineEntityReplacementText( "Tau", "\u03a4" );
881             parser.defineEntityReplacementText( "Upsilon", "\u03a5" );
882             parser.defineEntityReplacementText( "Phi", "\u03a6" );
883             parser.defineEntityReplacementText( "Chi", "\u03a7" );
884             parser.defineEntityReplacementText( "Psi", "\u03a8" );
885             parser.defineEntityReplacementText( "Omega", "\u03a9" );
886             parser.defineEntityReplacementText( "alpha", "\u03b1" );
887             parser.defineEntityReplacementText( "beta", "\u03b2" );
888             parser.defineEntityReplacementText( "gamma", "\u03b3" );
889             parser.defineEntityReplacementText( "delta", "\u03b4" );
890             parser.defineEntityReplacementText( "epsilon", "\u03b5" );
891             parser.defineEntityReplacementText( "zeta", "\u03b6" );
892             parser.defineEntityReplacementText( "eta", "\u03b7" );
893             parser.defineEntityReplacementText( "theta", "\u03b8" );
894             parser.defineEntityReplacementText( "iota", "\u03b9" );
895             parser.defineEntityReplacementText( "kappa", "\u03ba" );
896             parser.defineEntityReplacementText( "lambda", "\u03bb" );
897             parser.defineEntityReplacementText( "mu", "\u03bc" );
898             parser.defineEntityReplacementText( "nu", "\u03bd" );
899             parser.defineEntityReplacementText( "xi", "\u03be" );
900             parser.defineEntityReplacementText( "omicron", "\u03bf" );
901             parser.defineEntityReplacementText( "pi", "\u03c0" );
902             parser.defineEntityReplacementText( "rho", "\u03c1" );
903             parser.defineEntityReplacementText( "sigmaf", "\u03c2" );
904             parser.defineEntityReplacementText( "sigma", "\u03c3" );
905             parser.defineEntityReplacementText( "tau", "\u03c4" );
906             parser.defineEntityReplacementText( "upsilon", "\u03c5" );
907             parser.defineEntityReplacementText( "phi", "\u03c6" );
908             parser.defineEntityReplacementText( "chi", "\u03c7" );
909             parser.defineEntityReplacementText( "psi", "\u03c8" );
910             parser.defineEntityReplacementText( "omega", "\u03c9" );
911             parser.defineEntityReplacementText( "thetasym", "\u03d1" );
912             parser.defineEntityReplacementText( "upsih", "\u03d2" );
913             parser.defineEntityReplacementText( "piv", "\u03d6" );
914             parser.defineEntityReplacementText( "bull", "\u2022" );
915             parser.defineEntityReplacementText( "hellip", "\u2026" );
916             parser.defineEntityReplacementText( "prime", "\u2032" );
917             parser.defineEntityReplacementText( "Prime", "\u2033" );
918             parser.defineEntityReplacementText( "oline", "\u203e" );
919             parser.defineEntityReplacementText( "frasl", "\u2044" );
920             parser.defineEntityReplacementText( "weierp", "\u2118" );
921             parser.defineEntityReplacementText( "image", "\u2111" );
922             parser.defineEntityReplacementText( "real", "\u211c" );
923             parser.defineEntityReplacementText( "trade", "\u2122" );
924             parser.defineEntityReplacementText( "alefsym", "\u2135" );
925             parser.defineEntityReplacementText( "larr", "\u2190" );
926             parser.defineEntityReplacementText( "uarr", "\u2191" );
927             parser.defineEntityReplacementText( "rarr", "\u2192" );
928             parser.defineEntityReplacementText( "darr", "\u2193" );
929             parser.defineEntityReplacementText( "harr", "\u2194" );
930             parser.defineEntityReplacementText( "crarr", "\u21b5" );
931             parser.defineEntityReplacementText( "lArr", "\u21d0" );
932             parser.defineEntityReplacementText( "uArr", "\u21d1" );
933             parser.defineEntityReplacementText( "rArr", "\u21d2" );
934             parser.defineEntityReplacementText( "dArr", "\u21d3" );
935             parser.defineEntityReplacementText( "hArr", "\u21d4" );
936             parser.defineEntityReplacementText( "forall", "\u2200" );
937             parser.defineEntityReplacementText( "part", "\u2202" );
938             parser.defineEntityReplacementText( "exist", "\u2203" );
939             parser.defineEntityReplacementText( "empty", "\u2205" );
940             parser.defineEntityReplacementText( "nabla", "\u2207" );
941             parser.defineEntityReplacementText( "isin", "\u2208" );
942             parser.defineEntityReplacementText( "notin", "\u2209" );
943             parser.defineEntityReplacementText( "ni", "\u220b" );
944             parser.defineEntityReplacementText( "prod", "\u220f" );
945             parser.defineEntityReplacementText( "sum", "\u2211" );
946             parser.defineEntityReplacementText( "minus", "\u2212" );
947             parser.defineEntityReplacementText( "lowast", "\u2217" );
948             parser.defineEntityReplacementText( "radic", "\u221a" );
949             parser.defineEntityReplacementText( "prop", "\u221d" );
950             parser.defineEntityReplacementText( "infin", "\u221e" );
951             parser.defineEntityReplacementText( "ang", "\u2220" );
952             parser.defineEntityReplacementText( "and", "\u2227" );
953             parser.defineEntityReplacementText( "or", "\u2228" );
954             parser.defineEntityReplacementText( "cap", "\u2229" );
955             parser.defineEntityReplacementText( "cup", "\u222a" );
956             parser.defineEntityReplacementText( "int", "\u222b" );
957             parser.defineEntityReplacementText( "there4", "\u2234" );
958             parser.defineEntityReplacementText( "sim", "\u223c" );
959             parser.defineEntityReplacementText( "cong", "\u2245" );
960             parser.defineEntityReplacementText( "asymp", "\u2248" );
961             parser.defineEntityReplacementText( "ne", "\u2260" );
962             parser.defineEntityReplacementText( "equiv", "\u2261" );
963             parser.defineEntityReplacementText( "le", "\u2264" );
964             parser.defineEntityReplacementText( "ge", "\u2265" );
965             parser.defineEntityReplacementText( "sub", "\u2282" );
966             parser.defineEntityReplacementText( "sup", "\u2283" );
967             parser.defineEntityReplacementText( "nsub", "\u2284" );
968             parser.defineEntityReplacementText( "sube", "\u2286" );
969             parser.defineEntityReplacementText( "supe", "\u2287" );
970             parser.defineEntityReplacementText( "oplus", "\u2295" );
971             parser.defineEntityReplacementText( "otimes", "\u2297" );
972             parser.defineEntityReplacementText( "perp", "\u22a5" );
973             parser.defineEntityReplacementText( "sdot", "\u22c5" );
974             parser.defineEntityReplacementText( "lceil", "\u2308" );
975             parser.defineEntityReplacementText( "rceil", "\u2309" );
976             parser.defineEntityReplacementText( "lfloor", "\u230a" );
977             parser.defineEntityReplacementText( "rfloor", "\u230b" );
978             parser.defineEntityReplacementText( "lang", "\u2329" );
979             parser.defineEntityReplacementText( "rang", "\u232a" );
980             parser.defineEntityReplacementText( "loz", "\u25ca" );
981             parser.defineEntityReplacementText( "spades", "\u2660" );
982             parser.defineEntityReplacementText( "clubs", "\u2663" );
983             parser.defineEntityReplacementText( "hearts", "\u2665" );
984             parser.defineEntityReplacementText( "diams", "\u2666" );
985 
986         }
987 
988         parser.next();
989         return parseContinuumConfigurationModel( "continuum-configuration", parser, strict );
990     } //-- ContinuumConfigurationModel read( Reader, boolean )
991 
992     /**
993      * @see ReaderFactory#newXmlReader
994      * 
995      * @param reader
996      * @throws IOException
997      * @throws XmlPullParserException
998      * @return ContinuumConfigurationModel
999      */
1000     public ContinuumConfigurationModel read( Reader reader )
1001         throws IOException, XmlPullParserException
1002     {
1003         return read( reader, true );
1004     } //-- ContinuumConfigurationModel read( Reader )
1005 
1006     /**
1007      * Method read.
1008      * 
1009      * @param in
1010      * @param strict
1011      * @throws IOException
1012      * @throws XmlPullParserException
1013      * @return ContinuumConfigurationModel
1014      */
1015     public ContinuumConfigurationModel read( InputStream in, boolean strict )
1016         throws IOException, XmlPullParserException
1017     {
1018         Reader reader = ReaderFactory.newXmlReader( in );
1019 
1020         return read( reader, strict );
1021     } //-- ContinuumConfigurationModel read( InputStream, boolean )
1022 
1023     /**
1024      * Method read.
1025      * 
1026      * @param in
1027      * @throws IOException
1028      * @throws XmlPullParserException
1029      * @return ContinuumConfigurationModel
1030      */
1031     public ContinuumConfigurationModel read( InputStream in )
1032         throws IOException, XmlPullParserException
1033     {
1034         Reader reader = ReaderFactory.newXmlReader( in );
1035 
1036         return read( reader );
1037     } //-- ContinuumConfigurationModel read( InputStream )
1038 
1039     /**
1040      * Sets the state of the "add default entities" flag.
1041      * 
1042      * @param addDefaultEntities
1043      */
1044     public void setAddDefaultEntities( boolean addDefaultEntities )
1045     {
1046         this.addDefaultEntities = addDefaultEntities;
1047     } //-- void setAddDefaultEntities( boolean )
1048 
1049 }