001// =================== DO NOT EDIT THIS FILE ==================== 002// Generated by Modello 1.8.1, 003// any modifications will be overwritten. 004// ============================================================== 005 006package org.apache.maven.settings.io.xpp3; 007 008 //---------------------------------/ 009 //- Imported classes and packages -/ 010//---------------------------------/ 011 012import java.io.IOException; 013import java.io.InputStream; 014import java.io.Reader; 015import java.text.DateFormat; 016import org.apache.maven.settings.Activation; 017import org.apache.maven.settings.ActivationFile; 018import org.apache.maven.settings.ActivationOS; 019import org.apache.maven.settings.ActivationProperty; 020import org.apache.maven.settings.IdentifiableBase; 021import org.apache.maven.settings.Mirror; 022import org.apache.maven.settings.Profile; 023import org.apache.maven.settings.Proxy; 024import org.apache.maven.settings.Repository; 025import org.apache.maven.settings.RepositoryBase; 026import org.apache.maven.settings.RepositoryPolicy; 027import org.apache.maven.settings.Server; 028import org.apache.maven.settings.Settings; 029import org.apache.maven.settings.TrackableBase; 030import org.codehaus.plexus.util.ReaderFactory; 031import org.codehaus.plexus.util.xml.pull.EntityReplacementMap; 032import org.codehaus.plexus.util.xml.pull.MXParser; 033import org.codehaus.plexus.util.xml.pull.XmlPullParser; 034import org.codehaus.plexus.util.xml.pull.XmlPullParserException; 035 036/** 037 * Class SettingsXpp3Reader. 038 * 039 * @version $Revision$ $Date$ 040 */ 041@SuppressWarnings( "all" ) 042public class SettingsXpp3Reader 043{ 044 045 //--------------------------/ 046 //- Class/Member Variables -/ 047 //--------------------------/ 048 049 /** 050 * If set the parser will be loaded with all single characters 051 * from the XHTML specification. 052 * The entities used: 053 * <ul> 054 * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li> 055 * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li> 056 * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li> 057 * </ul> 058 */ 059 private boolean addDefaultEntities = true; 060 061 062 //-----------/ 063 //- Methods -/ 064 //-----------/ 065 066 /** 067 * Method checkFieldWithDuplicate. 068 * 069 * @param parser 070 * @param parsed 071 * @param alias 072 * @param tagName 073 * @throws XmlPullParserException 074 * @return boolean 075 */ 076 private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed ) 077 throws XmlPullParserException 078 { 079 if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) ) 080 { 081 return false; 082 } 083 if ( !parsed.add( tagName ) ) 084 { 085 throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null ); 086 } 087 return true; 088 } //-- boolean checkFieldWithDuplicate( XmlPullParser, String, String, java.util.Set ) 089 090 /** 091 * Method checkUnknownAttribute. 092 * 093 * @param parser 094 * @param strict 095 * @param tagName 096 * @param attribute 097 * @throws XmlPullParserException 098 * @throws IOException 099 */ 100 private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict ) 101 throws XmlPullParserException, IOException 102 { 103 // strictXmlAttributes = true for model: if strict == true, not only elements are checked but attributes too 104 if ( strict ) 105 { 106 throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null ); 107 } 108 } //-- void checkUnknownAttribute( XmlPullParser, String, String, boolean ) 109 110 /** 111 * Method checkUnknownElement. 112 * 113 * @param parser 114 * @param strict 115 * @throws XmlPullParserException 116 * @throws IOException 117 */ 118 private void checkUnknownElement( XmlPullParser parser, boolean strict ) 119 throws XmlPullParserException, IOException 120 { 121 if ( strict ) 122 { 123 throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); 124 } 125 126 for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; ) 127 { 128 int eventType = parser.next(); 129 if ( eventType == XmlPullParser.START_TAG ) 130 { 131 unrecognizedTagCount++; 132 } 133 else if ( eventType == XmlPullParser.END_TAG ) 134 { 135 unrecognizedTagCount--; 136 } 137 } 138 } //-- void checkUnknownElement( XmlPullParser, boolean ) 139 140 /** 141 * Returns the state of the "add default entities" flag. 142 * 143 * @return boolean 144 */ 145 public boolean getAddDefaultEntities() 146 { 147 return addDefaultEntities; 148 } //-- boolean getAddDefaultEntities() 149 150 /** 151 * Method getBooleanValue. 152 * 153 * @param s 154 * @param parser 155 * @param attribute 156 * @throws XmlPullParserException 157 * @return boolean 158 */ 159 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser ) 160 throws XmlPullParserException 161 { 162 return getBooleanValue( s, attribute, parser, null ); 163 } //-- boolean getBooleanValue( String, String, XmlPullParser ) 164 165 /** 166 * Method getBooleanValue. 167 * 168 * @param s 169 * @param defaultValue 170 * @param parser 171 * @param attribute 172 * @throws XmlPullParserException 173 * @return boolean 174 */ 175 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue ) 176 throws XmlPullParserException 177 { 178 if ( s != null && s.length() != 0 ) 179 { 180 return Boolean.valueOf( s ).booleanValue(); 181 } 182 if ( defaultValue != null ) 183 { 184 return Boolean.valueOf( defaultValue ).booleanValue(); 185 } 186 return false; 187 } //-- boolean getBooleanValue( String, String, XmlPullParser, String ) 188 189 /** 190 * Method getByteValue. 191 * 192 * @param s 193 * @param strict 194 * @param parser 195 * @param attribute 196 * @throws XmlPullParserException 197 * @return byte 198 */ 199 private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict ) 200 throws XmlPullParserException 201 { 202 if ( s != null ) 203 { 204 try 205 { 206 return Byte.valueOf( s ).byteValue(); 207 } 208 catch ( NumberFormatException nfe ) 209 { 210 if ( strict ) 211 { 212 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe ); 213 } 214 } 215 } 216 return 0; 217 } //-- byte getByteValue( String, String, XmlPullParser, boolean ) 218 219 /** 220 * Method getCharacterValue. 221 * 222 * @param s 223 * @param parser 224 * @param attribute 225 * @throws XmlPullParserException 226 * @return char 227 */ 228 private char getCharacterValue( String s, String attribute, XmlPullParser parser ) 229 throws XmlPullParserException 230 { 231 if ( s != null ) 232 { 233 return s.charAt( 0 ); 234 } 235 return 0; 236 } //-- char getCharacterValue( String, String, XmlPullParser ) 237 238 /** 239 * Method getDateValue. 240 * 241 * @param s 242 * @param parser 243 * @param attribute 244 * @throws XmlPullParserException 245 * @return Date 246 */ 247 private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser ) 248 throws XmlPullParserException 249 { 250 return getDateValue( s, attribute, null, parser ); 251 } //-- java.util.Date getDateValue( String, String, XmlPullParser ) 252 253 /** 254 * Method getDateValue. 255 * 256 * @param s 257 * @param parser 258 * @param dateFormat 259 * @param attribute 260 * @throws XmlPullParserException 261 * @return Date 262 */ 263 private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser ) 264 throws XmlPullParserException 265 { 266 if ( s != null ) 267 { 268 String effectiveDateFormat = dateFormat; 269 if ( dateFormat == null ) 270 { 271 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"; 272 } 273 if ( "long".equals( effectiveDateFormat ) ) 274 { 275 try 276 { 277 return new java.util.Date( Long.parseLong( s ) ); 278 } 279 catch ( NumberFormatException e ) 280 { 281 throw new XmlPullParserException( e.getMessage(), parser, e ); 282 } 283 } 284 else 285 { 286 try 287 { 288 DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, java.util.Locale.US ); 289 return dateParser.parse( s ); 290 } 291 catch ( java.text.ParseException e ) 292 { 293 throw new XmlPullParserException( e.getMessage(), parser, e ); 294 } 295 } 296 } 297 return null; 298 } //-- java.util.Date getDateValue( String, String, String, XmlPullParser ) 299 300 /** 301 * Method getDoubleValue. 302 * 303 * @param s 304 * @param strict 305 * @param parser 306 * @param attribute 307 * @throws XmlPullParserException 308 * @return double 309 */ 310 private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict ) 311 throws XmlPullParserException 312 { 313 if ( s != null ) 314 { 315 try 316 { 317 return Double.valueOf( s ).doubleValue(); 318 } 319 catch ( NumberFormatException nfe ) 320 { 321 if ( strict ) 322 { 323 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe ); 324 } 325 } 326 } 327 return 0; 328 } //-- double getDoubleValue( String, String, XmlPullParser, boolean ) 329 330 /** 331 * Method getFloatValue. 332 * 333 * @param s 334 * @param strict 335 * @param parser 336 * @param attribute 337 * @throws XmlPullParserException 338 * @return float 339 */ 340 private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict ) 341 throws XmlPullParserException 342 { 343 if ( s != null ) 344 { 345 try 346 { 347 return Float.valueOf( s ).floatValue(); 348 } 349 catch ( NumberFormatException nfe ) 350 { 351 if ( strict ) 352 { 353 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe ); 354 } 355 } 356 } 357 return 0; 358 } //-- float getFloatValue( String, String, XmlPullParser, boolean ) 359 360 /** 361 * Method getIntegerValue. 362 * 363 * @param s 364 * @param strict 365 * @param parser 366 * @param attribute 367 * @throws XmlPullParserException 368 * @return int 369 */ 370 private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict ) 371 throws XmlPullParserException 372 { 373 if ( s != null ) 374 { 375 try 376 { 377 return Integer.valueOf( s ).intValue(); 378 } 379 catch ( NumberFormatException nfe ) 380 { 381 if ( strict ) 382 { 383 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe ); 384 } 385 } 386 } 387 return 0; 388 } //-- int getIntegerValue( String, String, XmlPullParser, boolean ) 389 390 /** 391 * Method getLongValue. 392 * 393 * @param s 394 * @param strict 395 * @param parser 396 * @param attribute 397 * @throws XmlPullParserException 398 * @return long 399 */ 400 private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict ) 401 throws XmlPullParserException 402 { 403 if ( s != null ) 404 { 405 try 406 { 407 return Long.valueOf( s ).longValue(); 408 } 409 catch ( NumberFormatException nfe ) 410 { 411 if ( strict ) 412 { 413 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe ); 414 } 415 } 416 } 417 return 0; 418 } //-- long getLongValue( String, String, XmlPullParser, boolean ) 419 420 /** 421 * Method getRequiredAttributeValue. 422 * 423 * @param s 424 * @param strict 425 * @param parser 426 * @param attribute 427 * @throws XmlPullParserException 428 * @return String 429 */ 430 private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict ) 431 throws XmlPullParserException 432 { 433 if ( s == null ) 434 { 435 if ( strict ) 436 { 437 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null ); 438 } 439 } 440 return s; 441 } //-- String getRequiredAttributeValue( String, String, XmlPullParser, boolean ) 442 443 /** 444 * Method getShortValue. 445 * 446 * @param s 447 * @param strict 448 * @param parser 449 * @param attribute 450 * @throws XmlPullParserException 451 * @return short 452 */ 453 private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict ) 454 throws XmlPullParserException 455 { 456 if ( s != null ) 457 { 458 try 459 { 460 return Short.valueOf( s ).shortValue(); 461 } 462 catch ( NumberFormatException nfe ) 463 { 464 if ( strict ) 465 { 466 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe ); 467 } 468 } 469 } 470 return 0; 471 } //-- short getShortValue( String, String, XmlPullParser, boolean ) 472 473 /** 474 * Method getTrimmedValue. 475 * 476 * @param s 477 * @return String 478 */ 479 private String getTrimmedValue( String s ) 480 { 481 if ( s != null ) 482 { 483 s = s.trim(); 484 } 485 return s; 486 } //-- String getTrimmedValue( String ) 487 488 /** 489 * Method nextTag. 490 * 491 * @param parser 492 * @throws IOException 493 * @throws XmlPullParserException 494 * @return int 495 */ 496 private int nextTag( XmlPullParser parser ) 497 throws IOException, XmlPullParserException 498 { 499 int eventType = parser.next(); 500 if ( eventType == XmlPullParser.TEXT ) 501 { 502 eventType = parser.next(); 503 } 504 if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG ) 505 { 506 throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null ); 507 } 508 return eventType; 509 } //-- int nextTag( XmlPullParser ) 510 511 /** 512 * @see ReaderFactory#newXmlReader 513 * 514 * @param reader 515 * @param strict 516 * @throws IOException 517 * @throws XmlPullParserException 518 * @return Settings 519 */ 520 public Settings read( Reader reader, boolean strict ) 521 throws IOException, XmlPullParserException 522 { 523 XmlPullParser parser = addDefaultEntities ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap) : new MXParser( ); 524 525 parser.setInput( reader ); 526 527 528 return read( parser, strict ); 529 } //-- Settings read( Reader, boolean ) 530 531 /** 532 * @see ReaderFactory#newXmlReader 533 * 534 * @param reader 535 * @throws IOException 536 * @throws XmlPullParserException 537 * @return Settings 538 */ 539 public Settings read( Reader reader ) 540 throws IOException, XmlPullParserException 541 { 542 return read( reader, true ); 543 } //-- Settings read( Reader ) 544 545 /** 546 * Method read. 547 * 548 * @param in 549 * @param strict 550 * @throws IOException 551 * @throws XmlPullParserException 552 * @return Settings 553 */ 554 public Settings read( InputStream in, boolean strict ) 555 throws IOException, XmlPullParserException 556 { 557 return read( ReaderFactory.newXmlReader( in ), strict ); 558 } //-- Settings read( InputStream, boolean ) 559 560 /** 561 * Method read. 562 * 563 * @param in 564 * @throws IOException 565 * @throws XmlPullParserException 566 * @return Settings 567 */ 568 public Settings read( InputStream in ) 569 throws IOException, XmlPullParserException 570 { 571 return read( ReaderFactory.newXmlReader( in ) ); 572 } //-- Settings read( InputStream ) 573 574 /** 575 * Method parseActivation. 576 * 577 * @param parser 578 * @param strict 579 * @throws IOException 580 * @throws XmlPullParserException 581 * @return Activation 582 */ 583 private Activation parseActivation( XmlPullParser parser, boolean strict ) 584 throws IOException, XmlPullParserException 585 { 586 String tagName = parser.getName(); 587 Activation activation = new Activation(); 588 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 589 { 590 String name = parser.getAttributeName( i ); 591 String value = parser.getAttributeValue( i ); 592 593 if ( name.indexOf( ':' ) >= 0 ) 594 { 595 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 596 } 597 else 598 { 599 checkUnknownAttribute( parser, name, tagName, strict ); 600 } 601 } 602 java.util.Set parsed = new java.util.HashSet(); 603 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 604 { 605 if ( checkFieldWithDuplicate( parser, "activeByDefault", null, parsed ) ) 606 { 607 activation.setActiveByDefault( getBooleanValue( getTrimmedValue( parser.nextText() ), "activeByDefault", parser, "false" ) ); 608 } 609 else if ( checkFieldWithDuplicate( parser, "jdk", null, parsed ) ) 610 { 611 activation.setJdk( getTrimmedValue( parser.nextText() ) ); 612 } 613 else if ( checkFieldWithDuplicate( parser, "os", null, parsed ) ) 614 { 615 activation.setOs( parseActivationOS( parser, strict ) ); 616 } 617 else if ( checkFieldWithDuplicate( parser, "property", null, parsed ) ) 618 { 619 activation.setProperty( parseActivationProperty( parser, strict ) ); 620 } 621 else if ( checkFieldWithDuplicate( parser, "file", null, parsed ) ) 622 { 623 activation.setFile( parseActivationFile( parser, strict ) ); 624 } 625 else 626 { 627 checkUnknownElement( parser, strict ); 628 } 629 } 630 return activation; 631 } //-- Activation parseActivation( XmlPullParser, boolean ) 632 633 /** 634 * Method parseActivationFile. 635 * 636 * @param parser 637 * @param strict 638 * @throws IOException 639 * @throws XmlPullParserException 640 * @return ActivationFile 641 */ 642 private ActivationFile parseActivationFile( XmlPullParser parser, boolean strict ) 643 throws IOException, XmlPullParserException 644 { 645 String tagName = parser.getName(); 646 ActivationFile activationFile = new ActivationFile(); 647 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 648 { 649 String name = parser.getAttributeName( i ); 650 String value = parser.getAttributeValue( i ); 651 652 if ( name.indexOf( ':' ) >= 0 ) 653 { 654 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 655 } 656 else 657 { 658 checkUnknownAttribute( parser, name, tagName, strict ); 659 } 660 } 661 java.util.Set parsed = new java.util.HashSet(); 662 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 663 { 664 if ( checkFieldWithDuplicate( parser, "missing", null, parsed ) ) 665 { 666 activationFile.setMissing( getTrimmedValue( parser.nextText() ) ); 667 } 668 else if ( checkFieldWithDuplicate( parser, "exists", null, parsed ) ) 669 { 670 activationFile.setExists( getTrimmedValue( parser.nextText() ) ); 671 } 672 else 673 { 674 checkUnknownElement( parser, strict ); 675 } 676 } 677 return activationFile; 678 } //-- ActivationFile parseActivationFile( XmlPullParser, boolean ) 679 680 /** 681 * Method parseActivationOS. 682 * 683 * @param parser 684 * @param strict 685 * @throws IOException 686 * @throws XmlPullParserException 687 * @return ActivationOS 688 */ 689 private ActivationOS parseActivationOS( XmlPullParser parser, boolean strict ) 690 throws IOException, XmlPullParserException 691 { 692 String tagName = parser.getName(); 693 ActivationOS activationOS = new ActivationOS(); 694 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 695 { 696 String name = parser.getAttributeName( i ); 697 String value = parser.getAttributeValue( i ); 698 699 if ( name.indexOf( ':' ) >= 0 ) 700 { 701 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 702 } 703 else 704 { 705 checkUnknownAttribute( parser, name, tagName, strict ); 706 } 707 } 708 java.util.Set parsed = new java.util.HashSet(); 709 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 710 { 711 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) 712 { 713 activationOS.setName( getTrimmedValue( parser.nextText() ) ); 714 } 715 else if ( checkFieldWithDuplicate( parser, "family", null, parsed ) ) 716 { 717 activationOS.setFamily( getTrimmedValue( parser.nextText() ) ); 718 } 719 else if ( checkFieldWithDuplicate( parser, "arch", null, parsed ) ) 720 { 721 activationOS.setArch( getTrimmedValue( parser.nextText() ) ); 722 } 723 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) ) 724 { 725 activationOS.setVersion( getTrimmedValue( parser.nextText() ) ); 726 } 727 else 728 { 729 checkUnknownElement( parser, strict ); 730 } 731 } 732 return activationOS; 733 } //-- ActivationOS parseActivationOS( XmlPullParser, boolean ) 734 735 /** 736 * Method parseActivationProperty. 737 * 738 * @param parser 739 * @param strict 740 * @throws IOException 741 * @throws XmlPullParserException 742 * @return ActivationProperty 743 */ 744 private ActivationProperty parseActivationProperty( XmlPullParser parser, boolean strict ) 745 throws IOException, XmlPullParserException 746 { 747 String tagName = parser.getName(); 748 ActivationProperty activationProperty = new ActivationProperty(); 749 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 750 { 751 String name = parser.getAttributeName( i ); 752 String value = parser.getAttributeValue( i ); 753 754 if ( name.indexOf( ':' ) >= 0 ) 755 { 756 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 757 } 758 else 759 { 760 checkUnknownAttribute( parser, name, tagName, strict ); 761 } 762 } 763 java.util.Set parsed = new java.util.HashSet(); 764 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 765 { 766 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) 767 { 768 activationProperty.setName( getTrimmedValue( parser.nextText() ) ); 769 } 770 else if ( checkFieldWithDuplicate( parser, "value", null, parsed ) ) 771 { 772 activationProperty.setValue( getTrimmedValue( parser.nextText() ) ); 773 } 774 else 775 { 776 checkUnknownElement( parser, strict ); 777 } 778 } 779 return activationProperty; 780 } //-- ActivationProperty parseActivationProperty( XmlPullParser, boolean ) 781 782 /** 783 * Method parseIdentifiableBase. 784 * 785 * @param parser 786 * @param strict 787 * @throws IOException 788 * @throws XmlPullParserException 789 * @return IdentifiableBase 790 */ 791 private IdentifiableBase parseIdentifiableBase( XmlPullParser parser, boolean strict ) 792 throws IOException, XmlPullParserException 793 { 794 String tagName = parser.getName(); 795 IdentifiableBase identifiableBase = new IdentifiableBase(); 796 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 797 { 798 String name = parser.getAttributeName( i ); 799 String value = parser.getAttributeValue( i ); 800 801 if ( name.indexOf( ':' ) >= 0 ) 802 { 803 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 804 } 805 else 806 { 807 checkUnknownAttribute( parser, name, tagName, strict ); 808 } 809 } 810 java.util.Set parsed = new java.util.HashSet(); 811 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 812 { 813 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) 814 { 815 identifiableBase.setId( getTrimmedValue( parser.nextText() ) ); 816 } 817 else 818 { 819 checkUnknownElement( parser, strict ); 820 } 821 } 822 return identifiableBase; 823 } //-- IdentifiableBase parseIdentifiableBase( XmlPullParser, boolean ) 824 825 /** 826 * Method parseMirror. 827 * 828 * @param parser 829 * @param strict 830 * @throws IOException 831 * @throws XmlPullParserException 832 * @return Mirror 833 */ 834 private Mirror parseMirror( XmlPullParser parser, boolean strict ) 835 throws IOException, XmlPullParserException 836 { 837 String tagName = parser.getName(); 838 Mirror mirror = new Mirror(); 839 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 840 { 841 String name = parser.getAttributeName( i ); 842 String value = parser.getAttributeValue( i ); 843 844 if ( name.indexOf( ':' ) >= 0 ) 845 { 846 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 847 } 848 else 849 { 850 checkUnknownAttribute( parser, name, tagName, strict ); 851 } 852 } 853 java.util.Set parsed = new java.util.HashSet(); 854 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 855 { 856 if ( checkFieldWithDuplicate( parser, "mirrorOf", null, parsed ) ) 857 { 858 mirror.setMirrorOf( getTrimmedValue( parser.nextText() ) ); 859 } 860 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) 861 { 862 mirror.setName( getTrimmedValue( parser.nextText() ) ); 863 } 864 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) ) 865 { 866 mirror.setUrl( getTrimmedValue( parser.nextText() ) ); 867 } 868 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) ) 869 { 870 mirror.setLayout( getTrimmedValue( parser.nextText() ) ); 871 } 872 else if ( checkFieldWithDuplicate( parser, "mirrorOfLayouts", null, parsed ) ) 873 { 874 mirror.setMirrorOfLayouts( getTrimmedValue( parser.nextText() ) ); 875 } 876 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) 877 { 878 mirror.setId( getTrimmedValue( parser.nextText() ) ); 879 } 880 else 881 { 882 checkUnknownElement( parser, strict ); 883 } 884 } 885 return mirror; 886 } //-- Mirror parseMirror( XmlPullParser, boolean ) 887 888 /** 889 * Method parseProfile. 890 * 891 * @param parser 892 * @param strict 893 * @throws IOException 894 * @throws XmlPullParserException 895 * @return Profile 896 */ 897 private Profile parseProfile( XmlPullParser parser, boolean strict ) 898 throws IOException, XmlPullParserException 899 { 900 String tagName = parser.getName(); 901 Profile profile = new Profile(); 902 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 903 { 904 String name = parser.getAttributeName( i ); 905 String value = parser.getAttributeValue( i ); 906 907 if ( name.indexOf( ':' ) >= 0 ) 908 { 909 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 910 } 911 else 912 { 913 checkUnknownAttribute( parser, name, tagName, strict ); 914 } 915 } 916 java.util.Set parsed = new java.util.HashSet(); 917 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 918 { 919 if ( checkFieldWithDuplicate( parser, "activation", null, parsed ) ) 920 { 921 profile.setActivation( parseActivation( parser, strict ) ); 922 } 923 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) ) 924 { 925 while ( parser.nextTag() == XmlPullParser.START_TAG ) 926 { 927 String key = parser.getName(); 928 String value = parser.nextText().trim(); 929 profile.addProperty( key, value ); 930 } 931 } 932 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) ) 933 { 934 java.util.List repositories = new java.util.ArrayList/*<Repository>*/(); 935 profile.setRepositories( repositories ); 936 while ( parser.nextTag() == XmlPullParser.START_TAG ) 937 { 938 if ( "repository".equals( parser.getName() ) ) 939 { 940 repositories.add( parseRepository( parser, strict ) ); 941 } 942 else 943 { 944 checkUnknownElement( parser, strict ); 945 } 946 } 947 } 948 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) ) 949 { 950 java.util.List pluginRepositories = new java.util.ArrayList/*<Repository>*/(); 951 profile.setPluginRepositories( pluginRepositories ); 952 while ( parser.nextTag() == XmlPullParser.START_TAG ) 953 { 954 if ( "pluginRepository".equals( parser.getName() ) ) 955 { 956 pluginRepositories.add( parseRepository( parser, strict ) ); 957 } 958 else 959 { 960 checkUnknownElement( parser, strict ); 961 } 962 } 963 } 964 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) 965 { 966 profile.setId( getTrimmedValue( parser.nextText() ) ); 967 } 968 else 969 { 970 checkUnknownElement( parser, strict ); 971 } 972 } 973 return profile; 974 } //-- Profile parseProfile( XmlPullParser, boolean ) 975 976 /** 977 * Method parseProxy. 978 * 979 * @param parser 980 * @param strict 981 * @throws IOException 982 * @throws XmlPullParserException 983 * @return Proxy 984 */ 985 private Proxy parseProxy( XmlPullParser parser, boolean strict ) 986 throws IOException, XmlPullParserException 987 { 988 String tagName = parser.getName(); 989 Proxy proxy = new Proxy(); 990 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 991 { 992 String name = parser.getAttributeName( i ); 993 String value = parser.getAttributeValue( i ); 994 995 if ( name.indexOf( ':' ) >= 0 ) 996 { 997 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 998 } 999 else 1000 { 1001 checkUnknownAttribute( parser, name, tagName, strict ); 1002 } 1003 } 1004 java.util.Set parsed = new java.util.HashSet(); 1005 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1006 { 1007 if ( checkFieldWithDuplicate( parser, "active", null, parsed ) ) 1008 { 1009 proxy.setActive( getBooleanValue( getTrimmedValue( parser.nextText() ), "active", parser, "true" ) ); 1010 } 1011 else if ( checkFieldWithDuplicate( parser, "protocol", null, parsed ) ) 1012 { 1013 proxy.setProtocol( getTrimmedValue( parser.nextText() ) ); 1014 } 1015 else if ( checkFieldWithDuplicate( parser, "username", null, parsed ) ) 1016 { 1017 proxy.setUsername( getTrimmedValue( parser.nextText() ) ); 1018 } 1019 else if ( checkFieldWithDuplicate( parser, "password", null, parsed ) ) 1020 { 1021 proxy.setPassword( getTrimmedValue( parser.nextText() ) ); 1022 } 1023 else if ( checkFieldWithDuplicate( parser, "port", null, parsed ) ) 1024 { 1025 proxy.setPort( getIntegerValue( getTrimmedValue( parser.nextText() ), "port", parser, strict ) ); 1026 } 1027 else if ( checkFieldWithDuplicate( parser, "host", null, parsed ) ) 1028 { 1029 proxy.setHost( getTrimmedValue( parser.nextText() ) ); 1030 } 1031 else if ( checkFieldWithDuplicate( parser, "nonProxyHosts", null, parsed ) ) 1032 { 1033 proxy.setNonProxyHosts( getTrimmedValue( parser.nextText() ) ); 1034 } 1035 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) 1036 { 1037 proxy.setId( getTrimmedValue( parser.nextText() ) ); 1038 } 1039 else 1040 { 1041 checkUnknownElement( parser, strict ); 1042 } 1043 } 1044 return proxy; 1045 } //-- Proxy parseProxy( XmlPullParser, boolean ) 1046 1047 /** 1048 * Method parseRepository. 1049 * 1050 * @param parser 1051 * @param strict 1052 * @throws IOException 1053 * @throws XmlPullParserException 1054 * @return Repository 1055 */ 1056 private Repository parseRepository( XmlPullParser parser, boolean strict ) 1057 throws IOException, XmlPullParserException 1058 { 1059 String tagName = parser.getName(); 1060 Repository repository = new Repository(); 1061 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1062 { 1063 String name = parser.getAttributeName( i ); 1064 String value = parser.getAttributeValue( i ); 1065 1066 if ( name.indexOf( ':' ) >= 0 ) 1067 { 1068 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1069 } 1070 else 1071 { 1072 checkUnknownAttribute( parser, name, tagName, strict ); 1073 } 1074 } 1075 java.util.Set parsed = new java.util.HashSet(); 1076 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1077 { 1078 if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) ) 1079 { 1080 repository.setReleases( parseRepositoryPolicy( parser, strict ) ); 1081 } 1082 else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) ) 1083 { 1084 repository.setSnapshots( parseRepositoryPolicy( parser, strict ) ); 1085 } 1086 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) 1087 { 1088 repository.setId( getTrimmedValue( parser.nextText() ) ); 1089 } 1090 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) 1091 { 1092 repository.setName( getTrimmedValue( parser.nextText() ) ); 1093 } 1094 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) ) 1095 { 1096 repository.setUrl( getTrimmedValue( parser.nextText() ) ); 1097 } 1098 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) ) 1099 { 1100 repository.setLayout( getTrimmedValue( parser.nextText() ) ); 1101 } 1102 else 1103 { 1104 checkUnknownElement( parser, strict ); 1105 } 1106 } 1107 return repository; 1108 } //-- Repository parseRepository( XmlPullParser, boolean ) 1109 1110 /** 1111 * Method parseRepositoryBase. 1112 * 1113 * @param parser 1114 * @param strict 1115 * @throws IOException 1116 * @throws XmlPullParserException 1117 * @return RepositoryBase 1118 */ 1119 private RepositoryBase parseRepositoryBase( XmlPullParser parser, boolean strict ) 1120 throws IOException, XmlPullParserException 1121 { 1122 String tagName = parser.getName(); 1123 RepositoryBase repositoryBase = new RepositoryBase(); 1124 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1125 { 1126 String name = parser.getAttributeName( i ); 1127 String value = parser.getAttributeValue( i ); 1128 1129 if ( name.indexOf( ':' ) >= 0 ) 1130 { 1131 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1132 } 1133 else 1134 { 1135 checkUnknownAttribute( parser, name, tagName, strict ); 1136 } 1137 } 1138 java.util.Set parsed = new java.util.HashSet(); 1139 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1140 { 1141 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) 1142 { 1143 repositoryBase.setId( getTrimmedValue( parser.nextText() ) ); 1144 } 1145 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) 1146 { 1147 repositoryBase.setName( getTrimmedValue( parser.nextText() ) ); 1148 } 1149 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) ) 1150 { 1151 repositoryBase.setUrl( getTrimmedValue( parser.nextText() ) ); 1152 } 1153 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) ) 1154 { 1155 repositoryBase.setLayout( getTrimmedValue( parser.nextText() ) ); 1156 } 1157 else 1158 { 1159 checkUnknownElement( parser, strict ); 1160 } 1161 } 1162 return repositoryBase; 1163 } //-- RepositoryBase parseRepositoryBase( XmlPullParser, boolean ) 1164 1165 /** 1166 * Method parseRepositoryPolicy. 1167 * 1168 * @param parser 1169 * @param strict 1170 * @throws IOException 1171 * @throws XmlPullParserException 1172 * @return RepositoryPolicy 1173 */ 1174 private RepositoryPolicy parseRepositoryPolicy( XmlPullParser parser, boolean strict ) 1175 throws IOException, XmlPullParserException 1176 { 1177 String tagName = parser.getName(); 1178 RepositoryPolicy repositoryPolicy = new RepositoryPolicy(); 1179 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1180 { 1181 String name = parser.getAttributeName( i ); 1182 String value = parser.getAttributeValue( i ); 1183 1184 if ( name.indexOf( ':' ) >= 0 ) 1185 { 1186 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1187 } 1188 else 1189 { 1190 checkUnknownAttribute( parser, name, tagName, strict ); 1191 } 1192 } 1193 java.util.Set parsed = new java.util.HashSet(); 1194 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1195 { 1196 if ( checkFieldWithDuplicate( parser, "enabled", null, parsed ) ) 1197 { 1198 repositoryPolicy.setEnabled( getBooleanValue( getTrimmedValue( parser.nextText() ), "enabled", parser, "true" ) ); 1199 } 1200 else if ( checkFieldWithDuplicate( parser, "updatePolicy", null, parsed ) ) 1201 { 1202 repositoryPolicy.setUpdatePolicy( getTrimmedValue( parser.nextText() ) ); 1203 } 1204 else if ( checkFieldWithDuplicate( parser, "checksumPolicy", null, parsed ) ) 1205 { 1206 repositoryPolicy.setChecksumPolicy( getTrimmedValue( parser.nextText() ) ); 1207 } 1208 else 1209 { 1210 checkUnknownElement( parser, strict ); 1211 } 1212 } 1213 return repositoryPolicy; 1214 } //-- RepositoryPolicy parseRepositoryPolicy( XmlPullParser, boolean ) 1215 1216 /** 1217 * Method parseServer. 1218 * 1219 * @param parser 1220 * @param strict 1221 * @throws IOException 1222 * @throws XmlPullParserException 1223 * @return Server 1224 */ 1225 private Server parseServer( XmlPullParser parser, boolean strict ) 1226 throws IOException, XmlPullParserException 1227 { 1228 String tagName = parser.getName(); 1229 Server server = new Server(); 1230 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1231 { 1232 String name = parser.getAttributeName( i ); 1233 String value = parser.getAttributeValue( i ); 1234 1235 if ( name.indexOf( ':' ) >= 0 ) 1236 { 1237 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1238 } 1239 else 1240 { 1241 checkUnknownAttribute( parser, name, tagName, strict ); 1242 } 1243 } 1244 java.util.Set parsed = new java.util.HashSet(); 1245 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1246 { 1247 if ( checkFieldWithDuplicate( parser, "username", null, parsed ) ) 1248 { 1249 server.setUsername( getTrimmedValue( parser.nextText() ) ); 1250 } 1251 else if ( checkFieldWithDuplicate( parser, "password", null, parsed ) ) 1252 { 1253 server.setPassword( getTrimmedValue( parser.nextText() ) ); 1254 } 1255 else if ( checkFieldWithDuplicate( parser, "privateKey", null, parsed ) ) 1256 { 1257 server.setPrivateKey( getTrimmedValue( parser.nextText() ) ); 1258 } 1259 else if ( checkFieldWithDuplicate( parser, "passphrase", null, parsed ) ) 1260 { 1261 server.setPassphrase( getTrimmedValue( parser.nextText() ) ); 1262 } 1263 else if ( checkFieldWithDuplicate( parser, "filePermissions", null, parsed ) ) 1264 { 1265 server.setFilePermissions( getTrimmedValue( parser.nextText() ) ); 1266 } 1267 else if ( checkFieldWithDuplicate( parser, "directoryPermissions", null, parsed ) ) 1268 { 1269 server.setDirectoryPermissions( getTrimmedValue( parser.nextText() ) ); 1270 } 1271 else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) ) 1272 { 1273 server.setConfiguration( org.codehaus.plexus.util.xml.Xpp3DomBuilder.build( parser, true ) ); 1274 } 1275 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) 1276 { 1277 server.setId( getTrimmedValue( parser.nextText() ) ); 1278 } 1279 else 1280 { 1281 checkUnknownElement( parser, strict ); 1282 } 1283 } 1284 return server; 1285 } //-- Server parseServer( XmlPullParser, boolean ) 1286 1287 /** 1288 * Method parseSettings. 1289 * 1290 * @param parser 1291 * @param strict 1292 * @throws IOException 1293 * @throws XmlPullParserException 1294 * @return Settings 1295 */ 1296 private Settings parseSettings( XmlPullParser parser, boolean strict ) 1297 throws IOException, XmlPullParserException 1298 { 1299 String tagName = parser.getName(); 1300 Settings settings = new Settings(); 1301 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1302 { 1303 String name = parser.getAttributeName( i ); 1304 String value = parser.getAttributeValue( i ); 1305 1306 if ( name.indexOf( ':' ) >= 0 ) 1307 { 1308 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1309 } 1310 else if ( "xmlns".equals( name ) ) 1311 { 1312 // ignore xmlns attribute in root class, which is a reserved attribute name 1313 } 1314 else 1315 { 1316 checkUnknownAttribute( parser, name, tagName, strict ); 1317 } 1318 } 1319 java.util.Set parsed = new java.util.HashSet(); 1320 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1321 { 1322 if ( checkFieldWithDuplicate( parser, "localRepository", null, parsed ) ) 1323 { 1324 settings.setLocalRepository( getTrimmedValue( parser.nextText() ) ); 1325 } 1326 else if ( checkFieldWithDuplicate( parser, "interactiveMode", null, parsed ) ) 1327 { 1328 settings.setInteractiveMode( getBooleanValue( getTrimmedValue( parser.nextText() ), "interactiveMode", parser, "true" ) ); 1329 } 1330 else if ( checkFieldWithDuplicate( parser, "usePluginRegistry", null, parsed ) ) 1331 { 1332 settings.setUsePluginRegistry( getBooleanValue( getTrimmedValue( parser.nextText() ), "usePluginRegistry", parser, "false" ) ); 1333 } 1334 else if ( checkFieldWithDuplicate( parser, "offline", null, parsed ) ) 1335 { 1336 settings.setOffline( getBooleanValue( getTrimmedValue( parser.nextText() ), "offline", parser, "false" ) ); 1337 } 1338 else if ( checkFieldWithDuplicate( parser, "proxies", null, parsed ) ) 1339 { 1340 java.util.List proxies = new java.util.ArrayList/*<Proxy>*/(); 1341 settings.setProxies( proxies ); 1342 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1343 { 1344 if ( "proxy".equals( parser.getName() ) ) 1345 { 1346 proxies.add( parseProxy( parser, strict ) ); 1347 } 1348 else 1349 { 1350 checkUnknownElement( parser, strict ); 1351 } 1352 } 1353 } 1354 else if ( checkFieldWithDuplicate( parser, "servers", null, parsed ) ) 1355 { 1356 java.util.List servers = new java.util.ArrayList/*<Server>*/(); 1357 settings.setServers( servers ); 1358 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1359 { 1360 if ( "server".equals( parser.getName() ) ) 1361 { 1362 servers.add( parseServer( parser, strict ) ); 1363 } 1364 else 1365 { 1366 checkUnknownElement( parser, strict ); 1367 } 1368 } 1369 } 1370 else if ( checkFieldWithDuplicate( parser, "mirrors", null, parsed ) ) 1371 { 1372 java.util.List mirrors = new java.util.ArrayList/*<Mirror>*/(); 1373 settings.setMirrors( mirrors ); 1374 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1375 { 1376 if ( "mirror".equals( parser.getName() ) ) 1377 { 1378 mirrors.add( parseMirror( parser, strict ) ); 1379 } 1380 else 1381 { 1382 checkUnknownElement( parser, strict ); 1383 } 1384 } 1385 } 1386 else if ( checkFieldWithDuplicate( parser, "profiles", null, parsed ) ) 1387 { 1388 java.util.List profiles = new java.util.ArrayList/*<Profile>*/(); 1389 settings.setProfiles( profiles ); 1390 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1391 { 1392 if ( "profile".equals( parser.getName() ) ) 1393 { 1394 profiles.add( parseProfile( parser, strict ) ); 1395 } 1396 else 1397 { 1398 checkUnknownElement( parser, strict ); 1399 } 1400 } 1401 } 1402 else if ( checkFieldWithDuplicate( parser, "activeProfiles", null, parsed ) ) 1403 { 1404 java.util.List activeProfiles = new java.util.ArrayList/*<String>*/(); 1405 settings.setActiveProfiles( activeProfiles ); 1406 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1407 { 1408 if ( "activeProfile".equals( parser.getName() ) ) 1409 { 1410 activeProfiles.add( getTrimmedValue( parser.nextText() ) ); 1411 } 1412 else 1413 { 1414 checkUnknownElement( parser, strict ); 1415 } 1416 } 1417 } 1418 else if ( checkFieldWithDuplicate( parser, "pluginGroups", null, parsed ) ) 1419 { 1420 java.util.List pluginGroups = new java.util.ArrayList/*<String>*/(); 1421 settings.setPluginGroups( pluginGroups ); 1422 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1423 { 1424 if ( "pluginGroup".equals( parser.getName() ) ) 1425 { 1426 pluginGroups.add( getTrimmedValue( parser.nextText() ) ); 1427 } 1428 else 1429 { 1430 checkUnknownElement( parser, strict ); 1431 } 1432 } 1433 } 1434 else 1435 { 1436 checkUnknownElement( parser, strict ); 1437 } 1438 } 1439 return settings; 1440 } //-- Settings parseSettings( XmlPullParser, boolean ) 1441 1442 /** 1443 * Method parseTrackableBase. 1444 * 1445 * @param parser 1446 * @param strict 1447 * @throws IOException 1448 * @throws XmlPullParserException 1449 * @return TrackableBase 1450 */ 1451 private TrackableBase parseTrackableBase( XmlPullParser parser, boolean strict ) 1452 throws IOException, XmlPullParserException 1453 { 1454 String tagName = parser.getName(); 1455 TrackableBase trackableBase = new TrackableBase(); 1456 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1457 { 1458 String name = parser.getAttributeName( i ); 1459 String value = parser.getAttributeValue( i ); 1460 1461 if ( name.indexOf( ':' ) >= 0 ) 1462 { 1463 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1464 } 1465 else 1466 { 1467 checkUnknownAttribute( parser, name, tagName, strict ); 1468 } 1469 } 1470 java.util.Set parsed = new java.util.HashSet(); 1471 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1472 { 1473 checkUnknownElement( parser, strict ); 1474 } 1475 return trackableBase; 1476 } //-- TrackableBase parseTrackableBase( XmlPullParser, boolean ) 1477 1478 /** 1479 * Method read. 1480 * 1481 * @param parser 1482 * @param strict 1483 * @throws IOException 1484 * @throws XmlPullParserException 1485 * @return Settings 1486 */ 1487 private Settings read( XmlPullParser parser, boolean strict ) 1488 throws IOException, XmlPullParserException 1489 { 1490 int eventType = parser.getEventType(); 1491 while ( eventType != XmlPullParser.END_DOCUMENT ) 1492 { 1493 if ( eventType == XmlPullParser.START_TAG ) 1494 { 1495 if ( strict && ! "settings".equals( parser.getName() ) ) 1496 { 1497 throw new XmlPullParserException( "Expected root element 'settings' but found '" + parser.getName() + "'", parser, null ); 1498 } 1499 Settings settings = parseSettings( parser, strict ); 1500 settings.setModelEncoding( parser.getInputEncoding() ); 1501 return settings; 1502 } 1503 eventType = parser.next(); 1504 } 1505 throw new XmlPullParserException( "Expected root element 'settings' but found no element at all: invalid XML document", parser, null ); 1506 } //-- Settings read( XmlPullParser, boolean ) 1507 1508 /** 1509 * Sets the state of the "add default entities" flag. 1510 * 1511 * @param addDefaultEntities 1512 */ 1513 public void setAddDefaultEntities( boolean addDefaultEntities ) 1514 { 1515 this.addDefaultEntities = addDefaultEntities; 1516 } //-- void setAddDefaultEntities( boolean ) 1517 1518}