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