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