001 // =================== DO NOT EDIT THIS FILE ==================== 002 // Generated by Modello 1.7, 003 // any modifications will be overwritten. 004 // ============================================================== 005 006 package org.apache.maven.profiles.io.xpp3; 007 008 //---------------------------------/ 009 //- Imported classes and packages -/ 010 //---------------------------------/ 011 012 import java.io.IOException; 013 import java.io.InputStream; 014 import java.io.Reader; 015 import java.text.DateFormat; 016 import org.apache.maven.profiles.Activation; 017 import org.apache.maven.profiles.ActivationFile; 018 import org.apache.maven.profiles.ActivationOS; 019 import org.apache.maven.profiles.ActivationProperty; 020 import org.apache.maven.profiles.Profile; 021 import org.apache.maven.profiles.ProfilesRoot; 022 import org.apache.maven.profiles.Repository; 023 import org.apache.maven.profiles.RepositoryBase; 024 import org.apache.maven.profiles.RepositoryPolicy; 025 import org.codehaus.plexus.util.ReaderFactory; 026 import org.codehaus.plexus.util.xml.pull.MXParser; 027 import org.codehaus.plexus.util.xml.pull.XmlPullParser; 028 import org.codehaus.plexus.util.xml.pull.XmlPullParserException; 029 030 /** 031 * Class ProfilesXpp3Reader. 032 * 033 * @version $Revision$ $Date$ 034 */ 035 @SuppressWarnings( "all" ) 036 public class ProfilesXpp3Reader 037 { 038 039 //--------------------------/ 040 //- Class/Member Variables -/ 041 //--------------------------/ 042 043 /** 044 * If set the parser will be loaded with all single characters 045 * from the XHTML specification. 046 * The entities used: 047 * <ul> 048 * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</li> 049 * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</li> 050 * <li>http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</li> 051 * </ul> 052 */ 053 private boolean addDefaultEntities = true; 054 055 056 //-----------/ 057 //- Methods -/ 058 //-----------/ 059 060 /** 061 * Method checkFieldWithDuplicate. 062 * 063 * @param parser 064 * @param parsed 065 * @param alias 066 * @param tagName 067 * @throws XmlPullParserException 068 * @return boolean 069 */ 070 private boolean checkFieldWithDuplicate( XmlPullParser parser, String tagName, String alias, java.util.Set parsed ) 071 throws XmlPullParserException 072 { 073 if ( !( parser.getName().equals( tagName ) || parser.getName().equals( alias ) ) ) 074 { 075 return false; 076 } 077 if ( !parsed.add( tagName ) ) 078 { 079 throw new XmlPullParserException( "Duplicated tag: '" + tagName + "'", parser, null ); 080 } 081 return true; 082 } //-- boolean checkFieldWithDuplicate( XmlPullParser, String, String, java.util.Set ) 083 084 /** 085 * Method checkUnknownAttribute. 086 * 087 * @param parser 088 * @param strict 089 * @param tagName 090 * @param attribute 091 * @throws XmlPullParserException 092 * @throws IOException 093 */ 094 private void checkUnknownAttribute( XmlPullParser parser, String attribute, String tagName, boolean strict ) 095 throws XmlPullParserException, IOException 096 { 097 // strictXmlAttributes = true for model: if strict == true, not only elements are checked but attributes too 098 if ( strict ) 099 { 100 throw new XmlPullParserException( "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null ); 101 } 102 } //-- void checkUnknownAttribute( XmlPullParser, String, String, boolean ) 103 104 /** 105 * Method checkUnknownElement. 106 * 107 * @param parser 108 * @param strict 109 * @throws XmlPullParserException 110 * @throws IOException 111 */ 112 private void checkUnknownElement( XmlPullParser parser, boolean strict ) 113 throws XmlPullParserException, IOException 114 { 115 if ( strict ) 116 { 117 throw new XmlPullParserException( "Unrecognised tag: '" + parser.getName() + "'", parser, null ); 118 } 119 120 for ( int unrecognizedTagCount = 1; unrecognizedTagCount > 0; ) 121 { 122 int eventType = parser.next(); 123 if ( eventType == XmlPullParser.START_TAG ) 124 { 125 unrecognizedTagCount++; 126 } 127 else if ( eventType == XmlPullParser.END_TAG ) 128 { 129 unrecognizedTagCount--; 130 } 131 } 132 } //-- void checkUnknownElement( XmlPullParser, boolean ) 133 134 /** 135 * Returns the state of the "add default entities" flag. 136 * 137 * @return boolean 138 */ 139 public boolean getAddDefaultEntities() 140 { 141 return addDefaultEntities; 142 } //-- boolean getAddDefaultEntities() 143 144 /** 145 * Method getBooleanValue. 146 * 147 * @param s 148 * @param parser 149 * @param attribute 150 * @throws XmlPullParserException 151 * @return boolean 152 */ 153 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser ) 154 throws XmlPullParserException 155 { 156 return getBooleanValue( s, attribute, parser, null ); 157 } //-- boolean getBooleanValue( String, String, XmlPullParser ) 158 159 /** 160 * Method getBooleanValue. 161 * 162 * @param s 163 * @param defaultValue 164 * @param parser 165 * @param attribute 166 * @throws XmlPullParserException 167 * @return boolean 168 */ 169 private boolean getBooleanValue( String s, String attribute, XmlPullParser parser, String defaultValue ) 170 throws XmlPullParserException 171 { 172 if ( s != null && s.length() != 0 ) 173 { 174 return Boolean.valueOf( s ).booleanValue(); 175 } 176 if ( defaultValue != null ) 177 { 178 return Boolean.valueOf( defaultValue ).booleanValue(); 179 } 180 return false; 181 } //-- boolean getBooleanValue( String, String, XmlPullParser, String ) 182 183 /** 184 * Method getByteValue. 185 * 186 * @param s 187 * @param strict 188 * @param parser 189 * @param attribute 190 * @throws XmlPullParserException 191 * @return byte 192 */ 193 private byte getByteValue( String s, String attribute, XmlPullParser parser, boolean strict ) 194 throws XmlPullParserException 195 { 196 if ( s != null ) 197 { 198 try 199 { 200 return Byte.valueOf( s ).byteValue(); 201 } 202 catch ( NumberFormatException nfe ) 203 { 204 if ( strict ) 205 { 206 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a byte", parser, nfe ); 207 } 208 } 209 } 210 return 0; 211 } //-- byte getByteValue( String, String, XmlPullParser, boolean ) 212 213 /** 214 * Method getCharacterValue. 215 * 216 * @param s 217 * @param parser 218 * @param attribute 219 * @throws XmlPullParserException 220 * @return char 221 */ 222 private char getCharacterValue( String s, String attribute, XmlPullParser parser ) 223 throws XmlPullParserException 224 { 225 if ( s != null ) 226 { 227 return s.charAt( 0 ); 228 } 229 return 0; 230 } //-- char getCharacterValue( String, String, XmlPullParser ) 231 232 /** 233 * Method getDateValue. 234 * 235 * @param s 236 * @param parser 237 * @param attribute 238 * @throws XmlPullParserException 239 * @return Date 240 */ 241 private java.util.Date getDateValue( String s, String attribute, XmlPullParser parser ) 242 throws XmlPullParserException 243 { 244 return getDateValue( s, attribute, null, parser ); 245 } //-- java.util.Date getDateValue( String, String, XmlPullParser ) 246 247 /** 248 * Method getDateValue. 249 * 250 * @param s 251 * @param parser 252 * @param dateFormat 253 * @param attribute 254 * @throws XmlPullParserException 255 * @return Date 256 */ 257 private java.util.Date getDateValue( String s, String attribute, String dateFormat, XmlPullParser parser ) 258 throws XmlPullParserException 259 { 260 if ( s != null ) 261 { 262 String effectiveDateFormat = dateFormat; 263 if ( dateFormat == null ) 264 { 265 effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"; 266 } 267 if ( "long".equals( effectiveDateFormat ) ) 268 { 269 try 270 { 271 return new java.util.Date( Long.parseLong( s ) ); 272 } 273 catch ( NumberFormatException e ) 274 { 275 throw new XmlPullParserException( e.getMessage(), parser, e ); 276 } 277 } 278 else 279 { 280 try 281 { 282 DateFormat dateParser = new java.text.SimpleDateFormat( effectiveDateFormat, java.util.Locale.US ); 283 return dateParser.parse( s ); 284 } 285 catch ( java.text.ParseException e ) 286 { 287 throw new XmlPullParserException( e.getMessage(), parser, e ); 288 } 289 } 290 } 291 return null; 292 } //-- java.util.Date getDateValue( String, String, String, XmlPullParser ) 293 294 /** 295 * Method getDoubleValue. 296 * 297 * @param s 298 * @param strict 299 * @param parser 300 * @param attribute 301 * @throws XmlPullParserException 302 * @return double 303 */ 304 private double getDoubleValue( String s, String attribute, XmlPullParser parser, boolean strict ) 305 throws XmlPullParserException 306 { 307 if ( s != null ) 308 { 309 try 310 { 311 return Double.valueOf( s ).doubleValue(); 312 } 313 catch ( NumberFormatException nfe ) 314 { 315 if ( strict ) 316 { 317 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe ); 318 } 319 } 320 } 321 return 0; 322 } //-- double getDoubleValue( String, String, XmlPullParser, boolean ) 323 324 /** 325 * Method getFloatValue. 326 * 327 * @param s 328 * @param strict 329 * @param parser 330 * @param attribute 331 * @throws XmlPullParserException 332 * @return float 333 */ 334 private float getFloatValue( String s, String attribute, XmlPullParser parser, boolean strict ) 335 throws XmlPullParserException 336 { 337 if ( s != null ) 338 { 339 try 340 { 341 return Float.valueOf( s ).floatValue(); 342 } 343 catch ( NumberFormatException nfe ) 344 { 345 if ( strict ) 346 { 347 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a floating point number", parser, nfe ); 348 } 349 } 350 } 351 return 0; 352 } //-- float getFloatValue( String, String, XmlPullParser, boolean ) 353 354 /** 355 * Method getIntegerValue. 356 * 357 * @param s 358 * @param strict 359 * @param parser 360 * @param attribute 361 * @throws XmlPullParserException 362 * @return int 363 */ 364 private int getIntegerValue( String s, String attribute, XmlPullParser parser, boolean strict ) 365 throws XmlPullParserException 366 { 367 if ( s != null ) 368 { 369 try 370 { 371 return Integer.valueOf( s ).intValue(); 372 } 373 catch ( NumberFormatException nfe ) 374 { 375 if ( strict ) 376 { 377 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be an integer", parser, nfe ); 378 } 379 } 380 } 381 return 0; 382 } //-- int getIntegerValue( String, String, XmlPullParser, boolean ) 383 384 /** 385 * Method getLongValue. 386 * 387 * @param s 388 * @param strict 389 * @param parser 390 * @param attribute 391 * @throws XmlPullParserException 392 * @return long 393 */ 394 private long getLongValue( String s, String attribute, XmlPullParser parser, boolean strict ) 395 throws XmlPullParserException 396 { 397 if ( s != null ) 398 { 399 try 400 { 401 return Long.valueOf( s ).longValue(); 402 } 403 catch ( NumberFormatException nfe ) 404 { 405 if ( strict ) 406 { 407 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe ); 408 } 409 } 410 } 411 return 0; 412 } //-- long getLongValue( String, String, XmlPullParser, boolean ) 413 414 /** 415 * Method getRequiredAttributeValue. 416 * 417 * @param s 418 * @param strict 419 * @param parser 420 * @param attribute 421 * @throws XmlPullParserException 422 * @return String 423 */ 424 private String getRequiredAttributeValue( String s, String attribute, XmlPullParser parser, boolean strict ) 425 throws XmlPullParserException 426 { 427 if ( s == null ) 428 { 429 if ( strict ) 430 { 431 throw new XmlPullParserException( "Missing required value for attribute '" + attribute + "'", parser, null ); 432 } 433 } 434 return s; 435 } //-- String getRequiredAttributeValue( String, String, XmlPullParser, boolean ) 436 437 /** 438 * Method getShortValue. 439 * 440 * @param s 441 * @param strict 442 * @param parser 443 * @param attribute 444 * @throws XmlPullParserException 445 * @return short 446 */ 447 private short getShortValue( String s, String attribute, XmlPullParser parser, boolean strict ) 448 throws XmlPullParserException 449 { 450 if ( s != null ) 451 { 452 try 453 { 454 return Short.valueOf( s ).shortValue(); 455 } 456 catch ( NumberFormatException nfe ) 457 { 458 if ( strict ) 459 { 460 throw new XmlPullParserException( "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe ); 461 } 462 } 463 } 464 return 0; 465 } //-- short getShortValue( String, String, XmlPullParser, boolean ) 466 467 /** 468 * Method getTrimmedValue. 469 * 470 * @param s 471 * @return String 472 */ 473 private String getTrimmedValue( String s ) 474 { 475 if ( s != null ) 476 { 477 s = s.trim(); 478 } 479 return s; 480 } //-- String getTrimmedValue( String ) 481 482 /** 483 * Method initParser. 484 * 485 * @param parser 486 * @throws XmlPullParserException 487 */ 488 private void initParser( XmlPullParser parser ) 489 throws XmlPullParserException 490 { 491 if ( addDefaultEntities ) 492 { 493 // ---------------------------------------------------------------------- 494 // Latin 1 entities 495 // ---------------------------------------------------------------------- 496 497 parser.defineEntityReplacementText( "nbsp", "\u00a0" ); 498 parser.defineEntityReplacementText( "iexcl", "\u00a1" ); 499 parser.defineEntityReplacementText( "cent", "\u00a2" ); 500 parser.defineEntityReplacementText( "pound", "\u00a3" ); 501 parser.defineEntityReplacementText( "curren", "\u00a4" ); 502 parser.defineEntityReplacementText( "yen", "\u00a5" ); 503 parser.defineEntityReplacementText( "brvbar", "\u00a6" ); 504 parser.defineEntityReplacementText( "sect", "\u00a7" ); 505 parser.defineEntityReplacementText( "uml", "\u00a8" ); 506 parser.defineEntityReplacementText( "copy", "\u00a9" ); 507 parser.defineEntityReplacementText( "ordf", "\u00aa" ); 508 parser.defineEntityReplacementText( "laquo", "\u00ab" ); 509 parser.defineEntityReplacementText( "not", "\u00ac" ); 510 parser.defineEntityReplacementText( "shy", "\u00ad" ); 511 parser.defineEntityReplacementText( "reg", "\u00ae" ); 512 parser.defineEntityReplacementText( "macr", "\u00af" ); 513 parser.defineEntityReplacementText( "deg", "\u00b0" ); 514 parser.defineEntityReplacementText( "plusmn", "\u00b1" ); 515 parser.defineEntityReplacementText( "sup2", "\u00b2" ); 516 parser.defineEntityReplacementText( "sup3", "\u00b3" ); 517 parser.defineEntityReplacementText( "acute", "\u00b4" ); 518 parser.defineEntityReplacementText( "micro", "\u00b5" ); 519 parser.defineEntityReplacementText( "para", "\u00b6" ); 520 parser.defineEntityReplacementText( "middot", "\u00b7" ); 521 parser.defineEntityReplacementText( "cedil", "\u00b8" ); 522 parser.defineEntityReplacementText( "sup1", "\u00b9" ); 523 parser.defineEntityReplacementText( "ordm", "\u00ba" ); 524 parser.defineEntityReplacementText( "raquo", "\u00bb" ); 525 parser.defineEntityReplacementText( "frac14", "\u00bc" ); 526 parser.defineEntityReplacementText( "frac12", "\u00bd" ); 527 parser.defineEntityReplacementText( "frac34", "\u00be" ); 528 parser.defineEntityReplacementText( "iquest", "\u00bf" ); 529 parser.defineEntityReplacementText( "Agrave", "\u00c0" ); 530 parser.defineEntityReplacementText( "Aacute", "\u00c1" ); 531 parser.defineEntityReplacementText( "Acirc", "\u00c2" ); 532 parser.defineEntityReplacementText( "Atilde", "\u00c3" ); 533 parser.defineEntityReplacementText( "Auml", "\u00c4" ); 534 parser.defineEntityReplacementText( "Aring", "\u00c5" ); 535 parser.defineEntityReplacementText( "AElig", "\u00c6" ); 536 parser.defineEntityReplacementText( "Ccedil", "\u00c7" ); 537 parser.defineEntityReplacementText( "Egrave", "\u00c8" ); 538 parser.defineEntityReplacementText( "Eacute", "\u00c9" ); 539 parser.defineEntityReplacementText( "Ecirc", "\u00ca" ); 540 parser.defineEntityReplacementText( "Euml", "\u00cb" ); 541 parser.defineEntityReplacementText( "Igrave", "\u00cc" ); 542 parser.defineEntityReplacementText( "Iacute", "\u00cd" ); 543 parser.defineEntityReplacementText( "Icirc", "\u00ce" ); 544 parser.defineEntityReplacementText( "Iuml", "\u00cf" ); 545 parser.defineEntityReplacementText( "ETH", "\u00d0" ); 546 parser.defineEntityReplacementText( "Ntilde", "\u00d1" ); 547 parser.defineEntityReplacementText( "Ograve", "\u00d2" ); 548 parser.defineEntityReplacementText( "Oacute", "\u00d3" ); 549 parser.defineEntityReplacementText( "Ocirc", "\u00d4" ); 550 parser.defineEntityReplacementText( "Otilde", "\u00d5" ); 551 parser.defineEntityReplacementText( "Ouml", "\u00d6" ); 552 parser.defineEntityReplacementText( "times", "\u00d7" ); 553 parser.defineEntityReplacementText( "Oslash", "\u00d8" ); 554 parser.defineEntityReplacementText( "Ugrave", "\u00d9" ); 555 parser.defineEntityReplacementText( "Uacute", "\u00da" ); 556 parser.defineEntityReplacementText( "Ucirc", "\u00db" ); 557 parser.defineEntityReplacementText( "Uuml", "\u00dc" ); 558 parser.defineEntityReplacementText( "Yacute", "\u00dd" ); 559 parser.defineEntityReplacementText( "THORN", "\u00de" ); 560 parser.defineEntityReplacementText( "szlig", "\u00df" ); 561 parser.defineEntityReplacementText( "agrave", "\u00e0" ); 562 parser.defineEntityReplacementText( "aacute", "\u00e1" ); 563 parser.defineEntityReplacementText( "acirc", "\u00e2" ); 564 parser.defineEntityReplacementText( "atilde", "\u00e3" ); 565 parser.defineEntityReplacementText( "auml", "\u00e4" ); 566 parser.defineEntityReplacementText( "aring", "\u00e5" ); 567 parser.defineEntityReplacementText( "aelig", "\u00e6" ); 568 parser.defineEntityReplacementText( "ccedil", "\u00e7" ); 569 parser.defineEntityReplacementText( "egrave", "\u00e8" ); 570 parser.defineEntityReplacementText( "eacute", "\u00e9" ); 571 parser.defineEntityReplacementText( "ecirc", "\u00ea" ); 572 parser.defineEntityReplacementText( "euml", "\u00eb" ); 573 parser.defineEntityReplacementText( "igrave", "\u00ec" ); 574 parser.defineEntityReplacementText( "iacute", "\u00ed" ); 575 parser.defineEntityReplacementText( "icirc", "\u00ee" ); 576 parser.defineEntityReplacementText( "iuml", "\u00ef" ); 577 parser.defineEntityReplacementText( "eth", "\u00f0" ); 578 parser.defineEntityReplacementText( "ntilde", "\u00f1" ); 579 parser.defineEntityReplacementText( "ograve", "\u00f2" ); 580 parser.defineEntityReplacementText( "oacute", "\u00f3" ); 581 parser.defineEntityReplacementText( "ocirc", "\u00f4" ); 582 parser.defineEntityReplacementText( "otilde", "\u00f5" ); 583 parser.defineEntityReplacementText( "ouml", "\u00f6" ); 584 parser.defineEntityReplacementText( "divide", "\u00f7" ); 585 parser.defineEntityReplacementText( "oslash", "\u00f8" ); 586 parser.defineEntityReplacementText( "ugrave", "\u00f9" ); 587 parser.defineEntityReplacementText( "uacute", "\u00fa" ); 588 parser.defineEntityReplacementText( "ucirc", "\u00fb" ); 589 parser.defineEntityReplacementText( "uuml", "\u00fc" ); 590 parser.defineEntityReplacementText( "yacute", "\u00fd" ); 591 parser.defineEntityReplacementText( "thorn", "\u00fe" ); 592 parser.defineEntityReplacementText( "yuml", "\u00ff" ); 593 594 // ---------------------------------------------------------------------- 595 // Special entities 596 // ---------------------------------------------------------------------- 597 598 parser.defineEntityReplacementText( "OElig", "\u0152" ); 599 parser.defineEntityReplacementText( "oelig", "\u0153" ); 600 parser.defineEntityReplacementText( "Scaron", "\u0160" ); 601 parser.defineEntityReplacementText( "scaron", "\u0161" ); 602 parser.defineEntityReplacementText( "Yuml", "\u0178" ); 603 parser.defineEntityReplacementText( "circ", "\u02c6" ); 604 parser.defineEntityReplacementText( "tilde", "\u02dc" ); 605 parser.defineEntityReplacementText( "ensp", "\u2002" ); 606 parser.defineEntityReplacementText( "emsp", "\u2003" ); 607 parser.defineEntityReplacementText( "thinsp", "\u2009" ); 608 parser.defineEntityReplacementText( "zwnj", "\u200c" ); 609 parser.defineEntityReplacementText( "zwj", "\u200d" ); 610 parser.defineEntityReplacementText( "lrm", "\u200e" ); 611 parser.defineEntityReplacementText( "rlm", "\u200f" ); 612 parser.defineEntityReplacementText( "ndash", "\u2013" ); 613 parser.defineEntityReplacementText( "mdash", "\u2014" ); 614 parser.defineEntityReplacementText( "lsquo", "\u2018" ); 615 parser.defineEntityReplacementText( "rsquo", "\u2019" ); 616 parser.defineEntityReplacementText( "sbquo", "\u201a" ); 617 parser.defineEntityReplacementText( "ldquo", "\u201c" ); 618 parser.defineEntityReplacementText( "rdquo", "\u201d" ); 619 parser.defineEntityReplacementText( "bdquo", "\u201e" ); 620 parser.defineEntityReplacementText( "dagger", "\u2020" ); 621 parser.defineEntityReplacementText( "Dagger", "\u2021" ); 622 parser.defineEntityReplacementText( "permil", "\u2030" ); 623 parser.defineEntityReplacementText( "lsaquo", "\u2039" ); 624 parser.defineEntityReplacementText( "rsaquo", "\u203a" ); 625 parser.defineEntityReplacementText( "euro", "\u20ac" ); 626 627 // ---------------------------------------------------------------------- 628 // Symbol entities 629 // ---------------------------------------------------------------------- 630 631 parser.defineEntityReplacementText( "fnof", "\u0192" ); 632 parser.defineEntityReplacementText( "Alpha", "\u0391" ); 633 parser.defineEntityReplacementText( "Beta", "\u0392" ); 634 parser.defineEntityReplacementText( "Gamma", "\u0393" ); 635 parser.defineEntityReplacementText( "Delta", "\u0394" ); 636 parser.defineEntityReplacementText( "Epsilon", "\u0395" ); 637 parser.defineEntityReplacementText( "Zeta", "\u0396" ); 638 parser.defineEntityReplacementText( "Eta", "\u0397" ); 639 parser.defineEntityReplacementText( "Theta", "\u0398" ); 640 parser.defineEntityReplacementText( "Iota", "\u0399" ); 641 parser.defineEntityReplacementText( "Kappa", "\u039a" ); 642 parser.defineEntityReplacementText( "Lambda", "\u039b" ); 643 parser.defineEntityReplacementText( "Mu", "\u039c" ); 644 parser.defineEntityReplacementText( "Nu", "\u039d" ); 645 parser.defineEntityReplacementText( "Xi", "\u039e" ); 646 parser.defineEntityReplacementText( "Omicron", "\u039f" ); 647 parser.defineEntityReplacementText( "Pi", "\u03a0" ); 648 parser.defineEntityReplacementText( "Rho", "\u03a1" ); 649 parser.defineEntityReplacementText( "Sigma", "\u03a3" ); 650 parser.defineEntityReplacementText( "Tau", "\u03a4" ); 651 parser.defineEntityReplacementText( "Upsilon", "\u03a5" ); 652 parser.defineEntityReplacementText( "Phi", "\u03a6" ); 653 parser.defineEntityReplacementText( "Chi", "\u03a7" ); 654 parser.defineEntityReplacementText( "Psi", "\u03a8" ); 655 parser.defineEntityReplacementText( "Omega", "\u03a9" ); 656 parser.defineEntityReplacementText( "alpha", "\u03b1" ); 657 parser.defineEntityReplacementText( "beta", "\u03b2" ); 658 parser.defineEntityReplacementText( "gamma", "\u03b3" ); 659 parser.defineEntityReplacementText( "delta", "\u03b4" ); 660 parser.defineEntityReplacementText( "epsilon", "\u03b5" ); 661 parser.defineEntityReplacementText( "zeta", "\u03b6" ); 662 parser.defineEntityReplacementText( "eta", "\u03b7" ); 663 parser.defineEntityReplacementText( "theta", "\u03b8" ); 664 parser.defineEntityReplacementText( "iota", "\u03b9" ); 665 parser.defineEntityReplacementText( "kappa", "\u03ba" ); 666 parser.defineEntityReplacementText( "lambda", "\u03bb" ); 667 parser.defineEntityReplacementText( "mu", "\u03bc" ); 668 parser.defineEntityReplacementText( "nu", "\u03bd" ); 669 parser.defineEntityReplacementText( "xi", "\u03be" ); 670 parser.defineEntityReplacementText( "omicron", "\u03bf" ); 671 parser.defineEntityReplacementText( "pi", "\u03c0" ); 672 parser.defineEntityReplacementText( "rho", "\u03c1" ); 673 parser.defineEntityReplacementText( "sigmaf", "\u03c2" ); 674 parser.defineEntityReplacementText( "sigma", "\u03c3" ); 675 parser.defineEntityReplacementText( "tau", "\u03c4" ); 676 parser.defineEntityReplacementText( "upsilon", "\u03c5" ); 677 parser.defineEntityReplacementText( "phi", "\u03c6" ); 678 parser.defineEntityReplacementText( "chi", "\u03c7" ); 679 parser.defineEntityReplacementText( "psi", "\u03c8" ); 680 parser.defineEntityReplacementText( "omega", "\u03c9" ); 681 parser.defineEntityReplacementText( "thetasym", "\u03d1" ); 682 parser.defineEntityReplacementText( "upsih", "\u03d2" ); 683 parser.defineEntityReplacementText( "piv", "\u03d6" ); 684 parser.defineEntityReplacementText( "bull", "\u2022" ); 685 parser.defineEntityReplacementText( "hellip", "\u2026" ); 686 parser.defineEntityReplacementText( "prime", "\u2032" ); 687 parser.defineEntityReplacementText( "Prime", "\u2033" ); 688 parser.defineEntityReplacementText( "oline", "\u203e" ); 689 parser.defineEntityReplacementText( "frasl", "\u2044" ); 690 parser.defineEntityReplacementText( "weierp", "\u2118" ); 691 parser.defineEntityReplacementText( "image", "\u2111" ); 692 parser.defineEntityReplacementText( "real", "\u211c" ); 693 parser.defineEntityReplacementText( "trade", "\u2122" ); 694 parser.defineEntityReplacementText( "alefsym", "\u2135" ); 695 parser.defineEntityReplacementText( "larr", "\u2190" ); 696 parser.defineEntityReplacementText( "uarr", "\u2191" ); 697 parser.defineEntityReplacementText( "rarr", "\u2192" ); 698 parser.defineEntityReplacementText( "darr", "\u2193" ); 699 parser.defineEntityReplacementText( "harr", "\u2194" ); 700 parser.defineEntityReplacementText( "crarr", "\u21b5" ); 701 parser.defineEntityReplacementText( "lArr", "\u21d0" ); 702 parser.defineEntityReplacementText( "uArr", "\u21d1" ); 703 parser.defineEntityReplacementText( "rArr", "\u21d2" ); 704 parser.defineEntityReplacementText( "dArr", "\u21d3" ); 705 parser.defineEntityReplacementText( "hArr", "\u21d4" ); 706 parser.defineEntityReplacementText( "forall", "\u2200" ); 707 parser.defineEntityReplacementText( "part", "\u2202" ); 708 parser.defineEntityReplacementText( "exist", "\u2203" ); 709 parser.defineEntityReplacementText( "empty", "\u2205" ); 710 parser.defineEntityReplacementText( "nabla", "\u2207" ); 711 parser.defineEntityReplacementText( "isin", "\u2208" ); 712 parser.defineEntityReplacementText( "notin", "\u2209" ); 713 parser.defineEntityReplacementText( "ni", "\u220b" ); 714 parser.defineEntityReplacementText( "prod", "\u220f" ); 715 parser.defineEntityReplacementText( "sum", "\u2211" ); 716 parser.defineEntityReplacementText( "minus", "\u2212" ); 717 parser.defineEntityReplacementText( "lowast", "\u2217" ); 718 parser.defineEntityReplacementText( "radic", "\u221a" ); 719 parser.defineEntityReplacementText( "prop", "\u221d" ); 720 parser.defineEntityReplacementText( "infin", "\u221e" ); 721 parser.defineEntityReplacementText( "ang", "\u2220" ); 722 parser.defineEntityReplacementText( "and", "\u2227" ); 723 parser.defineEntityReplacementText( "or", "\u2228" ); 724 parser.defineEntityReplacementText( "cap", "\u2229" ); 725 parser.defineEntityReplacementText( "cup", "\u222a" ); 726 parser.defineEntityReplacementText( "int", "\u222b" ); 727 parser.defineEntityReplacementText( "there4", "\u2234" ); 728 parser.defineEntityReplacementText( "sim", "\u223c" ); 729 parser.defineEntityReplacementText( "cong", "\u2245" ); 730 parser.defineEntityReplacementText( "asymp", "\u2248" ); 731 parser.defineEntityReplacementText( "ne", "\u2260" ); 732 parser.defineEntityReplacementText( "equiv", "\u2261" ); 733 parser.defineEntityReplacementText( "le", "\u2264" ); 734 parser.defineEntityReplacementText( "ge", "\u2265" ); 735 parser.defineEntityReplacementText( "sub", "\u2282" ); 736 parser.defineEntityReplacementText( "sup", "\u2283" ); 737 parser.defineEntityReplacementText( "nsub", "\u2284" ); 738 parser.defineEntityReplacementText( "sube", "\u2286" ); 739 parser.defineEntityReplacementText( "supe", "\u2287" ); 740 parser.defineEntityReplacementText( "oplus", "\u2295" ); 741 parser.defineEntityReplacementText( "otimes", "\u2297" ); 742 parser.defineEntityReplacementText( "perp", "\u22a5" ); 743 parser.defineEntityReplacementText( "sdot", "\u22c5" ); 744 parser.defineEntityReplacementText( "lceil", "\u2308" ); 745 parser.defineEntityReplacementText( "rceil", "\u2309" ); 746 parser.defineEntityReplacementText( "lfloor", "\u230a" ); 747 parser.defineEntityReplacementText( "rfloor", "\u230b" ); 748 parser.defineEntityReplacementText( "lang", "\u2329" ); 749 parser.defineEntityReplacementText( "rang", "\u232a" ); 750 parser.defineEntityReplacementText( "loz", "\u25ca" ); 751 parser.defineEntityReplacementText( "spades", "\u2660" ); 752 parser.defineEntityReplacementText( "clubs", "\u2663" ); 753 parser.defineEntityReplacementText( "hearts", "\u2665" ); 754 parser.defineEntityReplacementText( "diams", "\u2666" ); 755 756 } 757 } //-- void initParser( XmlPullParser ) 758 759 /** 760 * Method nextTag. 761 * 762 * @param parser 763 * @throws IOException 764 * @throws XmlPullParserException 765 * @return int 766 */ 767 private int nextTag( XmlPullParser parser ) 768 throws IOException, XmlPullParserException 769 { 770 int eventType = parser.next(); 771 if ( eventType == XmlPullParser.TEXT ) 772 { 773 eventType = parser.next(); 774 } 775 if ( eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG ) 776 { 777 throw new XmlPullParserException( "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null ); 778 } 779 return eventType; 780 } //-- int nextTag( XmlPullParser ) 781 782 /** 783 * @see ReaderFactory#newXmlReader 784 * 785 * @param reader 786 * @param strict 787 * @throws IOException 788 * @throws XmlPullParserException 789 * @return ProfilesRoot 790 */ 791 public ProfilesRoot read( Reader reader, boolean strict ) 792 throws IOException, XmlPullParserException 793 { 794 XmlPullParser parser = new MXParser(); 795 796 parser.setInput( reader ); 797 798 initParser( parser ); 799 800 return read( parser, strict ); 801 } //-- ProfilesRoot read( Reader, boolean ) 802 803 /** 804 * @see ReaderFactory#newXmlReader 805 * 806 * @param reader 807 * @throws IOException 808 * @throws XmlPullParserException 809 * @return ProfilesRoot 810 */ 811 public ProfilesRoot read( Reader reader ) 812 throws IOException, XmlPullParserException 813 { 814 return read( reader, true ); 815 } //-- ProfilesRoot read( Reader ) 816 817 /** 818 * Method read. 819 * 820 * @param in 821 * @param strict 822 * @throws IOException 823 * @throws XmlPullParserException 824 * @return ProfilesRoot 825 */ 826 public ProfilesRoot read( InputStream in, boolean strict ) 827 throws IOException, XmlPullParserException 828 { 829 return read( ReaderFactory.newXmlReader( in ), strict ); 830 } //-- ProfilesRoot read( InputStream, boolean ) 831 832 /** 833 * Method read. 834 * 835 * @param in 836 * @throws IOException 837 * @throws XmlPullParserException 838 * @return ProfilesRoot 839 */ 840 public ProfilesRoot read( InputStream in ) 841 throws IOException, XmlPullParserException 842 { 843 return read( ReaderFactory.newXmlReader( in ) ); 844 } //-- ProfilesRoot read( InputStream ) 845 846 /** 847 * Method parseActivation. 848 * 849 * @param parser 850 * @param strict 851 * @throws IOException 852 * @throws XmlPullParserException 853 * @return Activation 854 */ 855 private Activation parseActivation( XmlPullParser parser, boolean strict ) 856 throws IOException, XmlPullParserException 857 { 858 String tagName = parser.getName(); 859 Activation activation = new Activation(); 860 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 861 { 862 String name = parser.getAttributeName( i ); 863 String value = parser.getAttributeValue( i ); 864 865 if ( name.indexOf( ':' ) >= 0 ) 866 { 867 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 868 } 869 else 870 { 871 checkUnknownAttribute( parser, name, tagName, strict ); 872 } 873 } 874 java.util.Set parsed = new java.util.HashSet(); 875 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 876 { 877 if ( checkFieldWithDuplicate( parser, "activeByDefault", null, parsed ) ) 878 { 879 activation.setActiveByDefault( getBooleanValue( getTrimmedValue( parser.nextText() ), "activeByDefault", parser, "false" ) ); 880 } 881 else if ( checkFieldWithDuplicate( parser, "jdk", null, parsed ) ) 882 { 883 activation.setJdk( getTrimmedValue( parser.nextText() ) ); 884 } 885 else if ( checkFieldWithDuplicate( parser, "os", null, parsed ) ) 886 { 887 activation.setOs( parseActivationOS( parser, strict ) ); 888 } 889 else if ( checkFieldWithDuplicate( parser, "property", null, parsed ) ) 890 { 891 activation.setProperty( parseActivationProperty( parser, strict ) ); 892 } 893 else if ( checkFieldWithDuplicate( parser, "file", null, parsed ) ) 894 { 895 activation.setFile( parseActivationFile( parser, strict ) ); 896 } 897 else 898 { 899 checkUnknownElement( parser, strict ); 900 } 901 } 902 return activation; 903 } //-- Activation parseActivation( XmlPullParser, boolean ) 904 905 /** 906 * Method parseActivationFile. 907 * 908 * @param parser 909 * @param strict 910 * @throws IOException 911 * @throws XmlPullParserException 912 * @return ActivationFile 913 */ 914 private ActivationFile parseActivationFile( XmlPullParser parser, boolean strict ) 915 throws IOException, XmlPullParserException 916 { 917 String tagName = parser.getName(); 918 ActivationFile activationFile = new ActivationFile(); 919 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 920 { 921 String name = parser.getAttributeName( i ); 922 String value = parser.getAttributeValue( i ); 923 924 if ( name.indexOf( ':' ) >= 0 ) 925 { 926 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 927 } 928 else 929 { 930 checkUnknownAttribute( parser, name, tagName, strict ); 931 } 932 } 933 java.util.Set parsed = new java.util.HashSet(); 934 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 935 { 936 if ( checkFieldWithDuplicate( parser, "missing", null, parsed ) ) 937 { 938 activationFile.setMissing( getTrimmedValue( parser.nextText() ) ); 939 } 940 else if ( checkFieldWithDuplicate( parser, "exists", null, parsed ) ) 941 { 942 activationFile.setExists( getTrimmedValue( parser.nextText() ) ); 943 } 944 else 945 { 946 checkUnknownElement( parser, strict ); 947 } 948 } 949 return activationFile; 950 } //-- ActivationFile parseActivationFile( XmlPullParser, boolean ) 951 952 /** 953 * Method parseActivationOS. 954 * 955 * @param parser 956 * @param strict 957 * @throws IOException 958 * @throws XmlPullParserException 959 * @return ActivationOS 960 */ 961 private ActivationOS parseActivationOS( XmlPullParser parser, boolean strict ) 962 throws IOException, XmlPullParserException 963 { 964 String tagName = parser.getName(); 965 ActivationOS activationOS = new ActivationOS(); 966 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 967 { 968 String name = parser.getAttributeName( i ); 969 String value = parser.getAttributeValue( i ); 970 971 if ( name.indexOf( ':' ) >= 0 ) 972 { 973 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 974 } 975 else 976 { 977 checkUnknownAttribute( parser, name, tagName, strict ); 978 } 979 } 980 java.util.Set parsed = new java.util.HashSet(); 981 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 982 { 983 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) 984 { 985 activationOS.setName( getTrimmedValue( parser.nextText() ) ); 986 } 987 else if ( checkFieldWithDuplicate( parser, "family", null, parsed ) ) 988 { 989 activationOS.setFamily( getTrimmedValue( parser.nextText() ) ); 990 } 991 else if ( checkFieldWithDuplicate( parser, "arch", null, parsed ) ) 992 { 993 activationOS.setArch( getTrimmedValue( parser.nextText() ) ); 994 } 995 else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) ) 996 { 997 activationOS.setVersion( getTrimmedValue( parser.nextText() ) ); 998 } 999 else 1000 { 1001 checkUnknownElement( parser, strict ); 1002 } 1003 } 1004 return activationOS; 1005 } //-- ActivationOS parseActivationOS( XmlPullParser, boolean ) 1006 1007 /** 1008 * Method parseActivationProperty. 1009 * 1010 * @param parser 1011 * @param strict 1012 * @throws IOException 1013 * @throws XmlPullParserException 1014 * @return ActivationProperty 1015 */ 1016 private ActivationProperty parseActivationProperty( XmlPullParser parser, boolean strict ) 1017 throws IOException, XmlPullParserException 1018 { 1019 String tagName = parser.getName(); 1020 ActivationProperty activationProperty = new ActivationProperty(); 1021 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1022 { 1023 String name = parser.getAttributeName( i ); 1024 String value = parser.getAttributeValue( i ); 1025 1026 if ( name.indexOf( ':' ) >= 0 ) 1027 { 1028 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1029 } 1030 else 1031 { 1032 checkUnknownAttribute( parser, name, tagName, strict ); 1033 } 1034 } 1035 java.util.Set parsed = new java.util.HashSet(); 1036 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1037 { 1038 if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) 1039 { 1040 activationProperty.setName( getTrimmedValue( parser.nextText() ) ); 1041 } 1042 else if ( checkFieldWithDuplicate( parser, "value", null, parsed ) ) 1043 { 1044 activationProperty.setValue( getTrimmedValue( parser.nextText() ) ); 1045 } 1046 else 1047 { 1048 checkUnknownElement( parser, strict ); 1049 } 1050 } 1051 return activationProperty; 1052 } //-- ActivationProperty parseActivationProperty( XmlPullParser, boolean ) 1053 1054 /** 1055 * Method parseProfile. 1056 * 1057 * @param parser 1058 * @param strict 1059 * @throws IOException 1060 * @throws XmlPullParserException 1061 * @return Profile 1062 */ 1063 private Profile parseProfile( XmlPullParser parser, boolean strict ) 1064 throws IOException, XmlPullParserException 1065 { 1066 String tagName = parser.getName(); 1067 Profile profile = new Profile(); 1068 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1069 { 1070 String name = parser.getAttributeName( i ); 1071 String value = parser.getAttributeValue( i ); 1072 1073 if ( name.indexOf( ':' ) >= 0 ) 1074 { 1075 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1076 } 1077 else 1078 { 1079 checkUnknownAttribute( parser, name, tagName, strict ); 1080 } 1081 } 1082 java.util.Set parsed = new java.util.HashSet(); 1083 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1084 { 1085 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) 1086 { 1087 profile.setId( getTrimmedValue( parser.nextText() ) ); 1088 } 1089 else if ( checkFieldWithDuplicate( parser, "activation", null, parsed ) ) 1090 { 1091 profile.setActivation( parseActivation( parser, strict ) ); 1092 } 1093 else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) ) 1094 { 1095 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1096 { 1097 String key = parser.getName(); 1098 String value = parser.nextText().trim(); 1099 profile.addProperty( key, value ); 1100 } 1101 } 1102 else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) ) 1103 { 1104 java.util.List repositories = new java.util.ArrayList/*<Repository>*/(); 1105 profile.setRepositories( repositories ); 1106 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1107 { 1108 if ( "repository".equals( parser.getName() ) ) 1109 { 1110 repositories.add( parseRepository( parser, strict ) ); 1111 } 1112 else 1113 { 1114 checkUnknownElement( parser, strict ); 1115 } 1116 } 1117 } 1118 else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) ) 1119 { 1120 java.util.List pluginRepositories = new java.util.ArrayList/*<Repository>*/(); 1121 profile.setPluginRepositories( pluginRepositories ); 1122 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1123 { 1124 if ( "pluginRepository".equals( parser.getName() ) ) 1125 { 1126 pluginRepositories.add( parseRepository( parser, strict ) ); 1127 } 1128 else 1129 { 1130 checkUnknownElement( parser, strict ); 1131 } 1132 } 1133 } 1134 else 1135 { 1136 checkUnknownElement( parser, strict ); 1137 } 1138 } 1139 return profile; 1140 } //-- Profile parseProfile( XmlPullParser, boolean ) 1141 1142 /** 1143 * Method parseProfilesRoot. 1144 * 1145 * @param parser 1146 * @param strict 1147 * @throws IOException 1148 * @throws XmlPullParserException 1149 * @return ProfilesRoot 1150 */ 1151 private ProfilesRoot parseProfilesRoot( XmlPullParser parser, boolean strict ) 1152 throws IOException, XmlPullParserException 1153 { 1154 String tagName = parser.getName(); 1155 ProfilesRoot profilesRoot = new ProfilesRoot(); 1156 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1157 { 1158 String name = parser.getAttributeName( i ); 1159 String value = parser.getAttributeValue( i ); 1160 1161 if ( name.indexOf( ':' ) >= 0 ) 1162 { 1163 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1164 } 1165 else if ( "xmlns".equals( name ) ) 1166 { 1167 // ignore xmlns attribute in root class, which is a reserved attribute name 1168 } 1169 else 1170 { 1171 checkUnknownAttribute( parser, name, tagName, strict ); 1172 } 1173 } 1174 java.util.Set parsed = new java.util.HashSet(); 1175 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1176 { 1177 if ( checkFieldWithDuplicate( parser, "profiles", null, parsed ) ) 1178 { 1179 java.util.List profiles = new java.util.ArrayList/*<Profile>*/(); 1180 profilesRoot.setProfiles( profiles ); 1181 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1182 { 1183 if ( "profile".equals( parser.getName() ) ) 1184 { 1185 profiles.add( parseProfile( parser, strict ) ); 1186 } 1187 else 1188 { 1189 checkUnknownElement( parser, strict ); 1190 } 1191 } 1192 } 1193 else if ( checkFieldWithDuplicate( parser, "activeProfiles", null, parsed ) ) 1194 { 1195 java.util.List activeProfiles = new java.util.ArrayList/*<String>*/(); 1196 profilesRoot.setActiveProfiles( activeProfiles ); 1197 while ( parser.nextTag() == XmlPullParser.START_TAG ) 1198 { 1199 if ( "activeProfile".equals( parser.getName() ) ) 1200 { 1201 activeProfiles.add( getTrimmedValue( parser.nextText() ) ); 1202 } 1203 else 1204 { 1205 checkUnknownElement( parser, strict ); 1206 } 1207 } 1208 } 1209 else 1210 { 1211 checkUnknownElement( parser, strict ); 1212 } 1213 } 1214 return profilesRoot; 1215 } //-- ProfilesRoot parseProfilesRoot( XmlPullParser, boolean ) 1216 1217 /** 1218 * Method parseRepository. 1219 * 1220 * @param parser 1221 * @param strict 1222 * @throws IOException 1223 * @throws XmlPullParserException 1224 * @return Repository 1225 */ 1226 private Repository parseRepository( XmlPullParser parser, boolean strict ) 1227 throws IOException, XmlPullParserException 1228 { 1229 String tagName = parser.getName(); 1230 Repository repository = new Repository(); 1231 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1232 { 1233 String name = parser.getAttributeName( i ); 1234 String value = parser.getAttributeValue( i ); 1235 1236 if ( name.indexOf( ':' ) >= 0 ) 1237 { 1238 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1239 } 1240 else 1241 { 1242 checkUnknownAttribute( parser, name, tagName, strict ); 1243 } 1244 } 1245 java.util.Set parsed = new java.util.HashSet(); 1246 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1247 { 1248 if ( checkFieldWithDuplicate( parser, "releases", null, parsed ) ) 1249 { 1250 repository.setReleases( parseRepositoryPolicy( parser, strict ) ); 1251 } 1252 else if ( checkFieldWithDuplicate( parser, "snapshots", null, parsed ) ) 1253 { 1254 repository.setSnapshots( parseRepositoryPolicy( parser, strict ) ); 1255 } 1256 else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) 1257 { 1258 repository.setId( getTrimmedValue( parser.nextText() ) ); 1259 } 1260 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) 1261 { 1262 repository.setName( getTrimmedValue( parser.nextText() ) ); 1263 } 1264 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) ) 1265 { 1266 repository.setUrl( getTrimmedValue( parser.nextText() ) ); 1267 } 1268 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) ) 1269 { 1270 repository.setLayout( getTrimmedValue( parser.nextText() ) ); 1271 } 1272 else 1273 { 1274 checkUnknownElement( parser, strict ); 1275 } 1276 } 1277 return repository; 1278 } //-- Repository parseRepository( XmlPullParser, boolean ) 1279 1280 /** 1281 * Method parseRepositoryBase. 1282 * 1283 * @param parser 1284 * @param strict 1285 * @throws IOException 1286 * @throws XmlPullParserException 1287 * @return RepositoryBase 1288 */ 1289 private RepositoryBase parseRepositoryBase( XmlPullParser parser, boolean strict ) 1290 throws IOException, XmlPullParserException 1291 { 1292 String tagName = parser.getName(); 1293 RepositoryBase repositoryBase = new RepositoryBase(); 1294 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1295 { 1296 String name = parser.getAttributeName( i ); 1297 String value = parser.getAttributeValue( i ); 1298 1299 if ( name.indexOf( ':' ) >= 0 ) 1300 { 1301 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1302 } 1303 else 1304 { 1305 checkUnknownAttribute( parser, name, tagName, strict ); 1306 } 1307 } 1308 java.util.Set parsed = new java.util.HashSet(); 1309 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1310 { 1311 if ( checkFieldWithDuplicate( parser, "id", null, parsed ) ) 1312 { 1313 repositoryBase.setId( getTrimmedValue( parser.nextText() ) ); 1314 } 1315 else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) ) 1316 { 1317 repositoryBase.setName( getTrimmedValue( parser.nextText() ) ); 1318 } 1319 else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) ) 1320 { 1321 repositoryBase.setUrl( getTrimmedValue( parser.nextText() ) ); 1322 } 1323 else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) ) 1324 { 1325 repositoryBase.setLayout( getTrimmedValue( parser.nextText() ) ); 1326 } 1327 else 1328 { 1329 checkUnknownElement( parser, strict ); 1330 } 1331 } 1332 return repositoryBase; 1333 } //-- RepositoryBase parseRepositoryBase( XmlPullParser, boolean ) 1334 1335 /** 1336 * Method parseRepositoryPolicy. 1337 * 1338 * @param parser 1339 * @param strict 1340 * @throws IOException 1341 * @throws XmlPullParserException 1342 * @return RepositoryPolicy 1343 */ 1344 private RepositoryPolicy parseRepositoryPolicy( XmlPullParser parser, boolean strict ) 1345 throws IOException, XmlPullParserException 1346 { 1347 String tagName = parser.getName(); 1348 RepositoryPolicy repositoryPolicy = new RepositoryPolicy(); 1349 for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) 1350 { 1351 String name = parser.getAttributeName( i ); 1352 String value = parser.getAttributeValue( i ); 1353 1354 if ( name.indexOf( ':' ) >= 0 ) 1355 { 1356 // just ignore attributes with non-default namespace (for example: xmlns:xsi) 1357 } 1358 else 1359 { 1360 checkUnknownAttribute( parser, name, tagName, strict ); 1361 } 1362 } 1363 java.util.Set parsed = new java.util.HashSet(); 1364 while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG ) 1365 { 1366 if ( checkFieldWithDuplicate( parser, "enabled", null, parsed ) ) 1367 { 1368 repositoryPolicy.setEnabled( getBooleanValue( getTrimmedValue( parser.nextText() ), "enabled", parser, "true" ) ); 1369 } 1370 else if ( checkFieldWithDuplicate( parser, "updatePolicy", null, parsed ) ) 1371 { 1372 repositoryPolicy.setUpdatePolicy( getTrimmedValue( parser.nextText() ) ); 1373 } 1374 else if ( checkFieldWithDuplicate( parser, "checksumPolicy", null, parsed ) ) 1375 { 1376 repositoryPolicy.setChecksumPolicy( getTrimmedValue( parser.nextText() ) ); 1377 } 1378 else 1379 { 1380 checkUnknownElement( parser, strict ); 1381 } 1382 } 1383 return repositoryPolicy; 1384 } //-- RepositoryPolicy parseRepositoryPolicy( XmlPullParser, boolean ) 1385 1386 /** 1387 * Method read. 1388 * 1389 * @param parser 1390 * @param strict 1391 * @throws IOException 1392 * @throws XmlPullParserException 1393 * @return ProfilesRoot 1394 */ 1395 private ProfilesRoot read( XmlPullParser parser, boolean strict ) 1396 throws IOException, XmlPullParserException 1397 { 1398 int eventType = parser.getEventType(); 1399 while ( eventType != XmlPullParser.END_DOCUMENT ) 1400 { 1401 if ( eventType == XmlPullParser.START_TAG ) 1402 { 1403 if ( strict && ! "profilesXml".equals( parser.getName() ) ) 1404 { 1405 throw new XmlPullParserException( "Expected root element 'profilesXml' but found '" + parser.getName() + "'", parser, null ); 1406 } 1407 ProfilesRoot profilesRoot = parseProfilesRoot( parser, strict ); 1408 profilesRoot.setModelEncoding( parser.getInputEncoding() ); 1409 return profilesRoot; 1410 } 1411 eventType = parser.next(); 1412 } 1413 throw new XmlPullParserException( "Expected root element 'profilesXml' but found no element at all: invalid XML document", parser, null ); 1414 } //-- ProfilesRoot read( XmlPullParser, boolean ) 1415 1416 /** 1417 * Sets the state of the "add default entities" flag. 1418 * 1419 * @param addDefaultEntities 1420 */ 1421 public void setAddDefaultEntities( boolean addDefaultEntities ) 1422 { 1423 this.addDefaultEntities = addDefaultEntities; 1424 } //-- void setAddDefaultEntities( boolean ) 1425 1426 }