1 21 package au.id.jericho.lib.html; 22 23 import java.util.*; 24 25 57 public class CharacterEntityReference extends CharacterReference { 58 private String name; 59 60 61 public static final char _nbsp='\u00A0'; 62 63 public static final char _iexcl='\u00A1'; 64 65 public static final char _cent='\u00A2'; 66 67 public static final char _pound='\u00A3'; 68 69 public static final char _curren='\u00A4'; 70 71 public static final char _yen='\u00A5'; 72 73 public static final char _brvbar='\u00A6'; 74 75 public static final char _sect='\u00A7'; 76 77 public static final char _uml='\u00A8'; 78 79 public static final char _copy='\u00A9'; 80 81 public static final char _ordf='\u00AA'; 82 83 public static final char _laquo='\u00AB'; 84 85 public static final char _not='\u00AC'; 86 87 public static final char _shy='\u00AD'; 88 89 public static final char _reg='\u00AE'; 90 91 public static final char _macr='\u00AF'; 92 93 public static final char _deg='\u00B0'; 94 95 public static final char _plusmn='\u00B1'; 96 97 public static final char _sup2='\u00B2'; 98 99 public static final char _sup3='\u00B3'; 100 101 public static final char _acute='\u00B4'; 102 103 public static final char _micro='\u00B5'; 104 105 public static final char _para='\u00B6'; 106 107 public static final char _middot='\u00B7'; 108 109 public static final char _cedil='\u00B8'; 110 111 public static final char _sup1='\u00B9'; 112 113 public static final char _ordm='\u00BA'; 114 115 public static final char _raquo='\u00BB'; 116 117 public static final char _frac14='\u00BC'; 118 119 public static final char _frac12='\u00BD'; 120 121 public static final char _frac34='\u00BE'; 122 123 public static final char _iquest='\u00BF'; 124 125 public static final char _Agrave='\u00C0'; 126 127 public static final char _Aacute='\u00C1'; 128 129 public static final char _Acirc='\u00C2'; 130 131 public static final char _Atilde='\u00C3'; 132 133 public static final char _Auml='\u00C4'; 134 135 public static final char _Aring='\u00C5'; 136 137 public static final char _AElig='\u00C6'; 138 139 public static final char _Ccedil='\u00C7'; 140 141 public static final char _Egrave='\u00C8'; 142 143 public static final char _Eacute='\u00C9'; 144 145 public static final char _Ecirc='\u00CA'; 146 147 public static final char _Euml='\u00CB'; 148 149 public static final char _Igrave='\u00CC'; 150 151 public static final char _Iacute='\u00CD'; 152 153 public static final char _Icirc='\u00CE'; 154 155 public static final char _Iuml='\u00CF'; 156 157 public static final char _ETH='\u00D0'; 158 159 public static final char _Ntilde='\u00D1'; 160 161 public static final char _Ograve='\u00D2'; 162 163 public static final char _Oacute='\u00D3'; 164 165 public static final char _Ocirc='\u00D4'; 166 167 public static final char _Otilde='\u00D5'; 168 169 public static final char _Ouml='\u00D6'; 170 171 public static final char _times='\u00D7'; 172 173 public static final char _Oslash='\u00D8'; 174 175 public static final char _Ugrave='\u00D9'; 176 177 public static final char _Uacute='\u00DA'; 178 179 public static final char _Ucirc='\u00DB'; 180 181 public static final char _Uuml='\u00DC'; 182 183 public static final char _Yacute='\u00DD'; 184 185 public static final char _THORN='\u00DE'; 186 187 public static final char _szlig='\u00DF'; 188 189 public static final char _agrave='\u00E0'; 190 191 public static final char _aacute='\u00E1'; 192 193 public static final char _acirc='\u00E2'; 194 195 public static final char _atilde='\u00E3'; 196 197 public static final char _auml='\u00E4'; 198 199 public static final char _aring='\u00E5'; 200 201 public static final char _aelig='\u00E6'; 202 203 public static final char _ccedil='\u00E7'; 204 205 public static final char _egrave='\u00E8'; 206 207 public static final char _eacute='\u00E9'; 208 209 public static final char _ecirc='\u00EA'; 210 211 public static final char _euml='\u00EB'; 212 213 public static final char _igrave='\u00EC'; 214 215 public static final char _iacute='\u00ED'; 216 217 public static final char _icirc='\u00EE'; 218 219 public static final char _iuml='\u00EF'; 220 221 public static final char _eth='\u00F0'; 222 223 public static final char _ntilde='\u00F1'; 224 225 public static final char _ograve='\u00F2'; 226 227 public static final char _oacute='\u00F3'; 228 229 public static final char _ocirc='\u00F4'; 230 231 public static final char _otilde='\u00F5'; 232 233 public static final char _ouml='\u00F6'; 234 235 public static final char _divide='\u00F7'; 236 237 public static final char _oslash='\u00F8'; 238 239 public static final char _ugrave='\u00F9'; 240 241 public static final char _uacute='\u00FA'; 242 243 public static final char _ucirc='\u00FB'; 244 245 public static final char _uuml='\u00FC'; 246 247 public static final char _yacute='\u00FD'; 248 249 public static final char _thorn='\u00FE'; 250 251 public static final char _yuml='\u00FF'; 252 253 public static final char _fnof='\u0192'; 254 255 public static final char _Alpha='\u0391'; 256 257 public static final char _Beta='\u0392'; 258 259 public static final char _Gamma='\u0393'; 260 261 public static final char _Delta='\u0394'; 262 263 public static final char _Epsilon='\u0395'; 264 265 public static final char _Zeta='\u0396'; 266 267 public static final char _Eta='\u0397'; 268 269 public static final char _Theta='\u0398'; 270 271 public static final char _Iota='\u0399'; 272 273 public static final char _Kappa='\u039A'; 274 275 public static final char _Lambda='\u039B'; 276 277 public static final char _Mu='\u039C'; 278 279 public static final char _Nu='\u039D'; 280 281 public static final char _Xi='\u039E'; 282 283 public static final char _Omicron='\u039F'; 284 285 public static final char _Pi='\u03A0'; 286 287 public static final char _Rho='\u03A1'; 288 289 public static final char _Sigma='\u03A3'; 290 291 public static final char _Tau='\u03A4'; 292 293 public static final char _Upsilon='\u03A5'; 294 295 public static final char _Phi='\u03A6'; 296 297 public static final char _Chi='\u03A7'; 298 299 public static final char _Psi='\u03A8'; 300 301 public static final char _Omega='\u03A9'; 302 303 public static final char _alpha='\u03B1'; 304 305 public static final char _beta='\u03B2'; 306 307 public static final char _gamma='\u03B3'; 308 309 public static final char _delta='\u03B4'; 310 311 public static final char _epsilon='\u03B5'; 312 313 public static final char _zeta='\u03B6'; 314 315 public static final char _eta='\u03B7'; 316 317 public static final char _theta='\u03B8'; 318 319 public static final char _iota='\u03B9'; 320 321 public static final char _kappa='\u03BA'; 322 323 public static final char _lambda='\u03BB'; 324 325 public static final char _mu='\u03BC'; 326 327 public static final char _nu='\u03BD'; 328 329 public static final char _xi='\u03BE'; 330 331 public static final char _omicron='\u03BF'; 332 333 public static final char _pi='\u03C0'; 334 335 public static final char _rho='\u03C1'; 336 337 public static final char _sigmaf='\u03C2'; 338 339 public static final char _sigma='\u03C3'; 340 341 public static final char _tau='\u03C4'; 342 343 public static final char _upsilon='\u03C5'; 344 345 public static final char _phi='\u03C6'; 346 347 public static final char _chi='\u03C7'; 348 349 public static final char _psi='\u03C8'; 350 351 public static final char _omega='\u03C9'; 352 353 public static final char _thetasym='\u03D1'; 354 355 public static final char _upsih='\u03D2'; 356 357 public static final char _piv='\u03D6'; 358 359 public static final char _bull='\u2022'; 360 361 public static final char _hellip='\u2026'; 362 363 public static final char _prime='\u2032'; 364 365 public static final char _Prime='\u2033'; 366 367 public static final char _oline='\u203E'; 368 369 public static final char _frasl='\u2044'; 370 371 public static final char _weierp='\u2118'; 372 373 public static final char _image='\u2111'; 374 375 public static final char _real='\u211C'; 376 377 public static final char _trade='\u2122'; 378 379 public static final char _alefsym='\u2135'; 380 381 public static final char _larr='\u2190'; 382 383 public static final char _uarr='\u2191'; 384 385 public static final char _rarr='\u2192'; 386 387 public static final char _darr='\u2193'; 388 389 public static final char _harr='\u2194'; 390 391 public static final char _crarr='\u21B5'; 392 393 public static final char _lArr='\u21D0'; 394 395 public static final char _uArr='\u21D1'; 396 397 public static final char _rArr='\u21D2'; 398 399 public static final char _dArr='\u21D3'; 400 401 public static final char _hArr='\u21D4'; 402 403 public static final char _forall='\u2200'; 404 405 public static final char _part='\u2202'; 406 407 public static final char _exist='\u2203'; 408 409 public static final char _empty='\u2205'; 410 411 public static final char _nabla='\u2207'; 412 413 public static final char _isin='\u2208'; 414 415 public static final char _notin='\u2209'; 416 417 public static final char _ni='\u220B'; 418 419 public static final char _prod='\u220F'; 420 421 public static final char _sum='\u2211'; 422 423 public static final char _minus='\u2212'; 424 425 public static final char _lowast='\u2217'; 426 427 public static final char _radic='\u221A'; 428 429 public static final char _prop='\u221D'; 430 431 public static final char _infin='\u221E'; 432 433 public static final char _ang='\u2220'; 434 435 public static final char _and='\u2227'; 436 437 public static final char _or='\u2228'; 438 439 public static final char _cap='\u2229'; 440 441 public static final char _cup='\u222A'; 442 443 public static final char _int='\u222B'; 444 445 public static final char _there4='\u2234'; 446 447 public static final char _sim='\u223C'; 448 449 public static final char _cong='\u2245'; 450 451 public static final char _asymp='\u2248'; 452 453 public static final char _ne='\u2260'; 454 455 public static final char _equiv='\u2261'; 456 457 public static final char _le='\u2264'; 458 459 public static final char _ge='\u2265'; 460 461 public static final char _sub='\u2282'; 462 463 public static final char _sup='\u2283'; 464 465 public static final char _nsub='\u2284'; 466 467 public static final char _sube='\u2286'; 468 469 public static final char _supe='\u2287'; 470 471 public static final char _oplus='\u2295'; 472 473 public static final char _otimes='\u2297'; 474 475 public static final char _perp='\u22A5'; 476 477 public static final char _sdot='\u22C5'; 478 479 public static final char _lceil='\u2308'; 480 481 public static final char _rceil='\u2309'; 482 483 public static final char _lfloor='\u230A'; 484 485 public static final char _rfloor='\u230B'; 486 487 public static final char _lang='\u2329'; 488 489 public static final char _rang='\u232A'; 490 491 public static final char _loz='\u25CA'; 492 493 public static final char _spades='\u2660'; 494 495 public static final char _clubs='\u2663'; 496 497 public static final char _hearts='\u2665'; 498 499 public static final char _diams='\u2666'; 500 501 public static final char _quot='\u0022'; 502 503 public static final char _amp='\u0026'; 504 505 public static final char _lt='\u003C'; 506 507 public static final char _gt='\u003E'; 508 509 public static final char _OElig='\u0152'; 510 511 public static final char _oelig='\u0153'; 512 513 public static final char _Scaron='\u0160'; 514 515 public static final char _scaron='\u0161'; 516 517 public static final char _Yuml='\u0178'; 518 519 public static final char _circ='\u02C6'; 520 521 public static final char _tilde='\u02DC'; 522 523 public static final char _ensp='\u2002'; 524 525 public static final char _emsp='\u2003'; 526 527 public static final char _thinsp='\u2009'; 528 529 public static final char _zwnj='\u200C'; 530 531 public static final char _zwj='\u200D'; 532 533 public static final char _lrm='\u200E'; 534 535 public static final char _rlm='\u200F'; 536 537 public static final char _ndash='\u2013'; 538 539 public static final char _mdash='\u2014'; 540 541 public static final char _lsquo='\u2018'; 542 543 public static final char _rsquo='\u2019'; 544 545 public static final char _sbquo='\u201A'; 546 547 public static final char _ldquo='\u201C'; 548 549 public static final char _rdquo='\u201D'; 550 551 public static final char _bdquo='\u201E'; 552 553 public static final char _dagger='\u2020'; 554 555 public static final char _Dagger='\u2021'; 556 557 public static final char _permil='\u2030'; 558 559 public static final char _lsaquo='\u2039'; 560 561 public static final char _rsaquo='\u203A'; 562 563 public static final char _euro='\u20AC'; 564 571 public static final char _apos='\''; 572 573 private static Map NAME_TO_CODE_POINT_MAP=new HashMap(512,1.0F); private static IntStringHashMap CODE_POINT_TO_NAME_MAP; 575 576 private static int MAX_NAME_LENGTH=0; 577 578 static { 579 NAME_TO_CODE_POINT_MAP.put("nbsp",new Integer (_nbsp)); 580 NAME_TO_CODE_POINT_MAP.put("iexcl",new Integer (_iexcl)); 581 NAME_TO_CODE_POINT_MAP.put("cent",new Integer (_cent)); 582 NAME_TO_CODE_POINT_MAP.put("pound",new Integer (_pound)); 583 NAME_TO_CODE_POINT_MAP.put("curren",new Integer (_curren)); 584 NAME_TO_CODE_POINT_MAP.put("yen",new Integer (_yen)); 585 NAME_TO_CODE_POINT_MAP.put("brvbar",new Integer (_brvbar)); 586 NAME_TO_CODE_POINT_MAP.put("sect",new Integer (_sect)); 587 NAME_TO_CODE_POINT_MAP.put("uml",new Integer (_uml)); 588 NAME_TO_CODE_POINT_MAP.put("copy",new Integer (_copy)); 589 NAME_TO_CODE_POINT_MAP.put("ordf",new Integer (_ordf)); 590 NAME_TO_CODE_POINT_MAP.put("laquo",new Integer (_laquo)); 591 NAME_TO_CODE_POINT_MAP.put("not",new Integer (_not)); 592 NAME_TO_CODE_POINT_MAP.put("shy",new Integer (_shy)); 593 NAME_TO_CODE_POINT_MAP.put("reg",new Integer (_reg)); 594 NAME_TO_CODE_POINT_MAP.put("macr",new Integer (_macr)); 595 NAME_TO_CODE_POINT_MAP.put("deg",new Integer (_deg)); 596 NAME_TO_CODE_POINT_MAP.put("plusmn",new Integer (_plusmn)); 597 NAME_TO_CODE_POINT_MAP.put("sup2",new Integer (_sup2)); 598 NAME_TO_CODE_POINT_MAP.put("sup3",new Integer (_sup3)); 599 NAME_TO_CODE_POINT_MAP.put("acute",new Integer (_acute)); 600 NAME_TO_CODE_POINT_MAP.put("micro",new Integer (_micro)); 601 NAME_TO_CODE_POINT_MAP.put("para",new Integer (_para)); 602 NAME_TO_CODE_POINT_MAP.put("middot",new Integer (_middot)); 603 NAME_TO_CODE_POINT_MAP.put("cedil",new Integer (_cedil)); 604 NAME_TO_CODE_POINT_MAP.put("sup1",new Integer (_sup1)); 605 NAME_TO_CODE_POINT_MAP.put("ordm",new Integer (_ordm)); 606 NAME_TO_CODE_POINT_MAP.put("raquo",new Integer (_raquo)); 607 NAME_TO_CODE_POINT_MAP.put("frac14",new Integer (_frac14)); 608 NAME_TO_CODE_POINT_MAP.put("frac12",new Integer (_frac12)); 609 NAME_TO_CODE_POINT_MAP.put("frac34",new Integer (_frac34)); 610 NAME_TO_CODE_POINT_MAP.put("iquest",new Integer (_iquest)); 611 NAME_TO_CODE_POINT_MAP.put("Agrave",new Integer (_Agrave)); 612 NAME_TO_CODE_POINT_MAP.put("Aacute",new Integer (_Aacute)); 613 NAME_TO_CODE_POINT_MAP.put("Acirc",new Integer (_Acirc)); 614 NAME_TO_CODE_POINT_MAP.put("Atilde",new Integer (_Atilde)); 615 NAME_TO_CODE_POINT_MAP.put("Auml",new Integer (_Auml)); 616 NAME_TO_CODE_POINT_MAP.put("Aring",new Integer (_Aring)); 617 NAME_TO_CODE_POINT_MAP.put("AElig",new Integer (_AElig)); 618 NAME_TO_CODE_POINT_MAP.put("Ccedil",new Integer (_Ccedil)); 619 NAME_TO_CODE_POINT_MAP.put("Egrave",new Integer (_Egrave)); 620 NAME_TO_CODE_POINT_MAP.put("Eacute",new Integer (_Eacute)); 621 NAME_TO_CODE_POINT_MAP.put("Ecirc",new Integer (_Ecirc)); 622 NAME_TO_CODE_POINT_MAP.put("Euml",new Integer (_Euml)); 623 NAME_TO_CODE_POINT_MAP.put("Igrave",new Integer (_Igrave)); 624 NAME_TO_CODE_POINT_MAP.put("Iacute",new Integer (_Iacute)); 625 NAME_TO_CODE_POINT_MAP.put("Icirc",new Integer (_Icirc)); 626 NAME_TO_CODE_POINT_MAP.put("Iuml",new Integer (_Iuml)); 627 NAME_TO_CODE_POINT_MAP.put("ETH",new Integer (_ETH)); 628 NAME_TO_CODE_POINT_MAP.put("Ntilde",new Integer (_Ntilde)); 629 NAME_TO_CODE_POINT_MAP.put("Ograve",new Integer (_Ograve)); 630 NAME_TO_CODE_POINT_MAP.put("Oacute",new Integer (_Oacute)); 631 NAME_TO_CODE_POINT_MAP.put("Ocirc",new Integer (_Ocirc)); 632 NAME_TO_CODE_POINT_MAP.put("Otilde",new Integer (_Otilde)); 633 NAME_TO_CODE_POINT_MAP.put("Ouml",new Integer (_Ouml)); 634 NAME_TO_CODE_POINT_MAP.put("times",new Integer (_times)); 635 NAME_TO_CODE_POINT_MAP.put("Oslash",new Integer (_Oslash)); 636 NAME_TO_CODE_POINT_MAP.put("Ugrave",new Integer (_Ugrave)); 637 NAME_TO_CODE_POINT_MAP.put("Uacute",new Integer (_Uacute)); 638 NAME_TO_CODE_POINT_MAP.put("Ucirc",new Integer (_Ucirc)); 639 NAME_TO_CODE_POINT_MAP.put("Uuml",new Integer (_Uuml)); 640 NAME_TO_CODE_POINT_MAP.put("Yacute",new Integer (_Yacute)); 641 NAME_TO_CODE_POINT_MAP.put("THORN",new Integer (_THORN)); 642 NAME_TO_CODE_POINT_MAP.put("szlig",new Integer (_szlig)); 643 NAME_TO_CODE_POINT_MAP.put("agrave",new Integer (_agrave)); 644 NAME_TO_CODE_POINT_MAP.put("aacute",new Integer (_aacute)); 645 NAME_TO_CODE_POINT_MAP.put("acirc",new Integer (_acirc)); 646 NAME_TO_CODE_POINT_MAP.put("atilde",new Integer (_atilde)); 647 NAME_TO_CODE_POINT_MAP.put("auml",new Integer (_auml)); 648 NAME_TO_CODE_POINT_MAP.put("aring",new Integer (_aring)); 649 NAME_TO_CODE_POINT_MAP.put("aelig",new Integer (_aelig)); 650 NAME_TO_CODE_POINT_MAP.put("ccedil",new Integer (_ccedil)); 651 NAME_TO_CODE_POINT_MAP.put("egrave",new Integer (_egrave)); 652 NAME_TO_CODE_POINT_MAP.put("eacute",new Integer (_eacute)); 653 NAME_TO_CODE_POINT_MAP.put("ecirc",new Integer (_ecirc)); 654 NAME_TO_CODE_POINT_MAP.put("euml",new Integer (_euml)); 655 NAME_TO_CODE_POINT_MAP.put("igrave",new Integer (_igrave)); 656 NAME_TO_CODE_POINT_MAP.put("iacute",new Integer (_iacute)); 657 NAME_TO_CODE_POINT_MAP.put("icirc",new Integer (_icirc)); 658 NAME_TO_CODE_POINT_MAP.put("iuml",new Integer (_iuml)); 659 NAME_TO_CODE_POINT_MAP.put("eth",new Integer (_eth)); 660 NAME_TO_CODE_POINT_MAP.put("ntilde",new Integer (_ntilde)); 661 NAME_TO_CODE_POINT_MAP.put("ograve",new Integer (_ograve)); 662 NAME_TO_CODE_POINT_MAP.put("oacute",new Integer (_oacute)); 663 NAME_TO_CODE_POINT_MAP.put("ocirc",new Integer (_ocirc)); 664 NAME_TO_CODE_POINT_MAP.put("otilde",new Integer (_otilde)); 665 NAME_TO_CODE_POINT_MAP.put("ouml",new Integer (_ouml)); 666 NAME_TO_CODE_POINT_MAP.put("divide",new Integer (_divide)); 667 NAME_TO_CODE_POINT_MAP.put("oslash",new Integer (_oslash)); 668 NAME_TO_CODE_POINT_MAP.put("ugrave",new Integer (_ugrave)); 669 NAME_TO_CODE_POINT_MAP.put("uacute",new Integer (_uacute)); 670 NAME_TO_CODE_POINT_MAP.put("ucirc",new Integer (_ucirc)); 671 NAME_TO_CODE_POINT_MAP.put("uuml",new Integer (_uuml)); 672 NAME_TO_CODE_POINT_MAP.put("yacute",new Integer (_yacute)); 673 NAME_TO_CODE_POINT_MAP.put("thorn",new Integer (_thorn)); 674 NAME_TO_CODE_POINT_MAP.put("yuml",new Integer (_yuml)); 675 NAME_TO_CODE_POINT_MAP.put("fnof",new Integer (_fnof)); 676 NAME_TO_CODE_POINT_MAP.put("Alpha",new Integer (_Alpha)); 677 NAME_TO_CODE_POINT_MAP.put("Beta",new Integer (_Beta)); 678 NAME_TO_CODE_POINT_MAP.put("Gamma",new Integer (_Gamma)); 679 NAME_TO_CODE_POINT_MAP.put("Delta",new Integer (_Delta)); 680 NAME_TO_CODE_POINT_MAP.put("Epsilon",new Integer (_Epsilon)); 681 NAME_TO_CODE_POINT_MAP.put("Zeta",new Integer (_Zeta)); 682 NAME_TO_CODE_POINT_MAP.put("Eta",new Integer (_Eta)); 683 NAME_TO_CODE_POINT_MAP.put("Theta",new Integer (_Theta)); 684 NAME_TO_CODE_POINT_MAP.put("Iota",new Integer (_Iota)); 685 NAME_TO_CODE_POINT_MAP.put("Kappa",new Integer (_Kappa)); 686 NAME_TO_CODE_POINT_MAP.put("Lambda",new Integer (_Lambda)); 687 NAME_TO_CODE_POINT_MAP.put("Mu",new Integer (_Mu)); 688 NAME_TO_CODE_POINT_MAP.put("Nu",new Integer (_Nu)); 689 NAME_TO_CODE_POINT_MAP.put("Xi",new Integer (_Xi)); 690 NAME_TO_CODE_POINT_MAP.put("Omicron",new Integer (_Omicron)); 691 NAME_TO_CODE_POINT_MAP.put("Pi",new Integer (_Pi)); 692 NAME_TO_CODE_POINT_MAP.put("Rho",new Integer (_Rho)); 693 NAME_TO_CODE_POINT_MAP.put("Sigma",new Integer (_Sigma)); 694 NAME_TO_CODE_POINT_MAP.put("Tau",new Integer (_Tau)); 695 NAME_TO_CODE_POINT_MAP.put("Upsilon",new Integer (_Upsilon)); 696 NAME_TO_CODE_POINT_MAP.put("Phi",new Integer (_Phi)); 697 NAME_TO_CODE_POINT_MAP.put("Chi",new Integer (_Chi)); 698 NAME_TO_CODE_POINT_MAP.put("Psi",new Integer (_Psi)); 699 NAME_TO_CODE_POINT_MAP.put("Omega",new Integer (_Omega)); 700 NAME_TO_CODE_POINT_MAP.put("alpha",new Integer (_alpha)); 701 NAME_TO_CODE_POINT_MAP.put("beta",new Integer (_beta)); 702 NAME_TO_CODE_POINT_MAP.put("gamma",new Integer (_gamma)); 703 NAME_TO_CODE_POINT_MAP.put("delta",new Integer (_delta)); 704 NAME_TO_CODE_POINT_MAP.put("epsilon",new Integer (_epsilon)); 705 NAME_TO_CODE_POINT_MAP.put("zeta",new Integer (_zeta)); 706 NAME_TO_CODE_POINT_MAP.put("eta",new Integer (_eta)); 707 NAME_TO_CODE_POINT_MAP.put("theta",new Integer (_theta)); 708 NAME_TO_CODE_POINT_MAP.put("iota",new Integer (_iota)); 709 NAME_TO_CODE_POINT_MAP.put("kappa",new Integer (_kappa)); 710 NAME_TO_CODE_POINT_MAP.put("lambda",new Integer (_lambda)); 711 NAME_TO_CODE_POINT_MAP.put("mu",new Integer (_mu)); 712 NAME_TO_CODE_POINT_MAP.put("nu",new Integer (_nu)); 713 NAME_TO_CODE_POINT_MAP.put("xi",new Integer (_xi)); 714 NAME_TO_CODE_POINT_MAP.put("omicron",new Integer (_omicron)); 715 NAME_TO_CODE_POINT_MAP.put("pi",new Integer (_pi)); 716 NAME_TO_CODE_POINT_MAP.put("rho",new Integer (_rho)); 717 NAME_TO_CODE_POINT_MAP.put("sigmaf",new Integer (_sigmaf)); 718 NAME_TO_CODE_POINT_MAP.put("sigma",new Integer (_sigma)); 719 NAME_TO_CODE_POINT_MAP.put("tau",new Integer (_tau)); 720 NAME_TO_CODE_POINT_MAP.put("upsilon",new Integer (_upsilon)); 721 NAME_TO_CODE_POINT_MAP.put("phi",new Integer (_phi)); 722 NAME_TO_CODE_POINT_MAP.put("chi",new Integer (_chi)); 723 NAME_TO_CODE_POINT_MAP.put("psi",new Integer (_psi)); 724 NAME_TO_CODE_POINT_MAP.put("omega",new Integer (_omega)); 725 NAME_TO_CODE_POINT_MAP.put("thetasym",new Integer (_thetasym)); 726 NAME_TO_CODE_POINT_MAP.put("upsih",new Integer (_upsih)); 727 NAME_TO_CODE_POINT_MAP.put("piv",new Integer (_piv)); 728 NAME_TO_CODE_POINT_MAP.put("bull",new Integer (_bull)); 729 NAME_TO_CODE_POINT_MAP.put("hellip",new Integer (_hellip)); 730 NAME_TO_CODE_POINT_MAP.put("prime",new Integer (_prime)); 731 NAME_TO_CODE_POINT_MAP.put("Prime",new Integer (_Prime)); 732 NAME_TO_CODE_POINT_MAP.put("oline",new Integer (_oline)); 733 NAME_TO_CODE_POINT_MAP.put("frasl",new Integer (_frasl)); 734 NAME_TO_CODE_POINT_MAP.put("weierp",new Integer (_weierp)); 735 NAME_TO_CODE_POINT_MAP.put("image",new Integer (_image)); 736 NAME_TO_CODE_POINT_MAP.put("real",new Integer (_real)); 737 NAME_TO_CODE_POINT_MAP.put("trade",new Integer (_trade)); 738 NAME_TO_CODE_POINT_MAP.put("alefsym",new Integer (_alefsym)); 739 NAME_TO_CODE_POINT_MAP.put("larr",new Integer (_larr)); 740 NAME_TO_CODE_POINT_MAP.put("uarr",new Integer (_uarr)); 741 NAME_TO_CODE_POINT_MAP.put("rarr",new Integer (_rarr)); 742 NAME_TO_CODE_POINT_MAP.put("darr",new Integer (_darr)); 743 NAME_TO_CODE_POINT_MAP.put("harr",new Integer (_harr)); 744 NAME_TO_CODE_POINT_MAP.put("crarr",new Integer (_crarr)); 745 NAME_TO_CODE_POINT_MAP.put("lArr",new Integer (_lArr)); 746 NAME_TO_CODE_POINT_MAP.put("uArr",new Integer (_uArr)); 747 NAME_TO_CODE_POINT_MAP.put("rArr",new Integer (_rArr)); 748 NAME_TO_CODE_POINT_MAP.put("dArr",new Integer (_dArr)); 749 NAME_TO_CODE_POINT_MAP.put("hArr",new Integer (_hArr)); 750 NAME_TO_CODE_POINT_MAP.put("forall",new Integer (_forall)); 751 NAME_TO_CODE_POINT_MAP.put("part",new Integer (_part)); 752 NAME_TO_CODE_POINT_MAP.put("exist",new Integer (_exist)); 753 NAME_TO_CODE_POINT_MAP.put("empty",new Integer (_empty)); 754 NAME_TO_CODE_POINT_MAP.put("nabla",new Integer (_nabla)); 755 NAME_TO_CODE_POINT_MAP.put("isin",new Integer (_isin)); 756 NAME_TO_CODE_POINT_MAP.put("notin",new Integer (_notin)); 757 NAME_TO_CODE_POINT_MAP.put("ni",new Integer (_ni)); 758 NAME_TO_CODE_POINT_MAP.put("prod",new Integer (_prod)); 759 NAME_TO_CODE_POINT_MAP.put("sum",new Integer (_sum)); 760 NAME_TO_CODE_POINT_MAP.put("minus",new Integer (_minus)); 761 NAME_TO_CODE_POINT_MAP.put("lowast",new Integer (_lowast)); 762 NAME_TO_CODE_POINT_MAP.put("radic",new Integer (_radic)); 763 NAME_TO_CODE_POINT_MAP.put("prop",new Integer (_prop)); 764 NAME_TO_CODE_POINT_MAP.put("infin",new Integer (_infin)); 765 NAME_TO_CODE_POINT_MAP.put("ang",new Integer (_ang)); 766 NAME_TO_CODE_POINT_MAP.put("and",new Integer (_and)); 767 NAME_TO_CODE_POINT_MAP.put("or",new Integer (_or)); 768 NAME_TO_CODE_POINT_MAP.put("cap",new Integer (_cap)); 769 NAME_TO_CODE_POINT_MAP.put("cup",new Integer (_cup)); 770 NAME_TO_CODE_POINT_MAP.put("int",new Integer (_int)); 771 NAME_TO_CODE_POINT_MAP.put("there4",new Integer (_there4)); 772 NAME_TO_CODE_POINT_MAP.put("sim",new Integer (_sim)); 773 NAME_TO_CODE_POINT_MAP.put("cong",new Integer (_cong)); 774 NAME_TO_CODE_POINT_MAP.put("asymp",new Integer (_asymp)); 775 NAME_TO_CODE_POINT_MAP.put("ne",new Integer (_ne)); 776 NAME_TO_CODE_POINT_MAP.put("equiv",new Integer (_equiv)); 777 NAME_TO_CODE_POINT_MAP.put("le",new Integer (_le)); 778 NAME_TO_CODE_POINT_MAP.put("ge",new Integer (_ge)); 779 NAME_TO_CODE_POINT_MAP.put("sub",new Integer (_sub)); 780 NAME_TO_CODE_POINT_MAP.put("sup",new Integer (_sup)); 781 NAME_TO_CODE_POINT_MAP.put("nsub",new Integer (_nsub)); 782 NAME_TO_CODE_POINT_MAP.put("sube",new Integer (_sube)); 783 NAME_TO_CODE_POINT_MAP.put("supe",new Integer (_supe)); 784 NAME_TO_CODE_POINT_MAP.put("oplus",new Integer (_oplus)); 785 NAME_TO_CODE_POINT_MAP.put("otimes",new Integer (_otimes)); 786 NAME_TO_CODE_POINT_MAP.put("perp",new Integer (_perp)); 787 NAME_TO_CODE_POINT_MAP.put("sdot",new Integer (_sdot)); 788 NAME_TO_CODE_POINT_MAP.put("lceil",new Integer (_lceil)); 789 NAME_TO_CODE_POINT_MAP.put("rceil",new Integer (_rceil)); 790 NAME_TO_CODE_POINT_MAP.put("lfloor",new Integer (_lfloor)); 791 NAME_TO_CODE_POINT_MAP.put("rfloor",new Integer (_rfloor)); 792 NAME_TO_CODE_POINT_MAP.put("lang",new Integer (_lang)); 793 NAME_TO_CODE_POINT_MAP.put("rang",new Integer (_rang)); 794 NAME_TO_CODE_POINT_MAP.put("loz",new Integer (_loz)); 795 NAME_TO_CODE_POINT_MAP.put("spades",new Integer (_spades)); 796 NAME_TO_CODE_POINT_MAP.put("clubs",new Integer (_clubs)); 797 NAME_TO_CODE_POINT_MAP.put("hearts",new Integer (_hearts)); 798 NAME_TO_CODE_POINT_MAP.put("diams",new Integer (_diams)); 799 NAME_TO_CODE_POINT_MAP.put("quot",new Integer (_quot)); 800 NAME_TO_CODE_POINT_MAP.put("amp",new Integer (_amp)); 801 NAME_TO_CODE_POINT_MAP.put("lt",new Integer (_lt)); 802 NAME_TO_CODE_POINT_MAP.put("gt",new Integer (_gt)); 803 NAME_TO_CODE_POINT_MAP.put("OElig",new Integer (_OElig)); 804 NAME_TO_CODE_POINT_MAP.put("oelig",new Integer (_oelig)); 805 NAME_TO_CODE_POINT_MAP.put("Scaron",new Integer (_Scaron)); 806 NAME_TO_CODE_POINT_MAP.put("scaron",new Integer (_scaron)); 807 NAME_TO_CODE_POINT_MAP.put("Yuml",new Integer (_Yuml)); 808 NAME_TO_CODE_POINT_MAP.put("circ",new Integer (_circ)); 809 NAME_TO_CODE_POINT_MAP.put("tilde",new Integer (_tilde)); 810 NAME_TO_CODE_POINT_MAP.put("ensp",new Integer (_ensp)); 811 NAME_TO_CODE_POINT_MAP.put("emsp",new Integer (_emsp)); 812 NAME_TO_CODE_POINT_MAP.put("thinsp",new Integer (_thinsp)); 813 NAME_TO_CODE_POINT_MAP.put("zwnj",new Integer (_zwnj)); 814 NAME_TO_CODE_POINT_MAP.put("zwj",new Integer (_zwj)); 815 NAME_TO_CODE_POINT_MAP.put("lrm",new Integer (_lrm)); 816 NAME_TO_CODE_POINT_MAP.put("rlm",new Integer (_rlm)); 817 NAME_TO_CODE_POINT_MAP.put("ndash",new Integer (_ndash)); 818 NAME_TO_CODE_POINT_MAP.put("mdash",new Integer (_mdash)); 819 NAME_TO_CODE_POINT_MAP.put("lsquo",new Integer (_lsquo)); 820 NAME_TO_CODE_POINT_MAP.put("rsquo",new Integer (_rsquo)); 821 NAME_TO_CODE_POINT_MAP.put("sbquo",new Integer (_sbquo)); 822 NAME_TO_CODE_POINT_MAP.put("ldquo",new Integer (_ldquo)); 823 NAME_TO_CODE_POINT_MAP.put("rdquo",new Integer (_rdquo)); 824 NAME_TO_CODE_POINT_MAP.put("bdquo",new Integer (_bdquo)); 825 NAME_TO_CODE_POINT_MAP.put("dagger",new Integer (_dagger)); 826 NAME_TO_CODE_POINT_MAP.put("Dagger",new Integer (_Dagger)); 827 NAME_TO_CODE_POINT_MAP.put("permil",new Integer (_permil)); 828 NAME_TO_CODE_POINT_MAP.put("lsaquo",new Integer (_lsaquo)); 829 NAME_TO_CODE_POINT_MAP.put("rsaquo",new Integer (_rsaquo)); 830 NAME_TO_CODE_POINT_MAP.put("euro",new Integer (_euro)); 831 NAME_TO_CODE_POINT_MAP.put("apos",new Integer (_apos)); 832 833 CODE_POINT_TO_NAME_MAP=new IntStringHashMap((int)(NAME_TO_CODE_POINT_MAP.size()/0.75F),1.0F); 834 for (final Iterator i=NAME_TO_CODE_POINT_MAP.entrySet().iterator(); i.hasNext();) { 835 Map.Entry entry=(Map.Entry)i.next(); 836 String name=(String )entry.getKey(); 837 if (MAX_NAME_LENGTH<name.length()) MAX_NAME_LENGTH=name.length(); 838 CODE_POINT_TO_NAME_MAP.put(((Integer )entry.getValue()).intValue(),name); 839 } 840 } 841 842 private CharacterEntityReference(final Source source, final int begin, final int end, final int codePoint) { 843 super(source,begin,end,codePoint); 844 name=getName(codePoint); 845 } 846 847 857 public String getName() { 858 return name; 859 } 860 861 873 public static String getName(final char ch) { 874 return getName((int)ch); 875 } 876 877 889 public static String getName(final int codePoint) { 890 return CODE_POINT_TO_NAME_MAP.get(codePoint); 891 } 892 893 908 public static int getCodePointFromName(final String name) { 909 Integer codePoint=(Integer )NAME_TO_CODE_POINT_MAP.get(name); 910 if (codePoint==null) { 911 final String lowerCaseName=name.toLowerCase(); 913 if (lowerCaseName!=name) codePoint=(Integer )NAME_TO_CODE_POINT_MAP.get(lowerCaseName); 914 } 915 return (codePoint!=null) ? codePoint.intValue() : INVALID_CODE_POINT; 916 } 917 918 934 public String getCharacterReferenceString() { 935 return getCharacterReferenceString(name); 936 } 937 938 953 public static String getCharacterReferenceString(final int codePoint) { 954 if (codePoint>Character.MAX_VALUE) return null; 955 final String name=getName(codePoint); 956 return name!=null ? getCharacterReferenceString(name) : null; 957 } 958 959 963 public static Map getNameToCodePointMap() { 964 return NAME_TO_CODE_POINT_MAP; 965 } 966 967 971 public String getDebugInfo() { 972 final StringBuffer sb=new StringBuffer (); 973 sb.append('"'); 974 appendCharacterReferenceString(sb,name); 975 sb.append("\" "); 976 appendUnicodeText(sb,codePoint); 977 sb.append(' ').append(super.getDebugInfo()); 978 return sb.toString(); 979 } 980 981 private static String getCharacterReferenceString(final String name) { 982 return appendCharacterReferenceString(new StringBuffer (),name).toString(); 983 } 984 985 static final StringBuffer appendCharacterReferenceString(final StringBuffer sb, final String name) { 986 return sb.append('&').append(name).append(';'); 987 } 988 989 static CharacterReference construct(final Source source, final int begin, final int unterminatedMaxCodePoint) { 990 String name; 992 final int nameBegin=begin+1; 993 final int maxNameEnd=nameBegin+MAX_NAME_LENGTH; 994 final int maxSourcePos=source.end-1; 995 int end; 996 int x=nameBegin; 997 boolean unterminated=false; 998 while (true) { 999 final char ch=source.charAt(x); 1000 if (ch==';') { 1001 end=x+1; 1002 name=source.subSequence(nameBegin,x).toString(); 1003 break; 1004 } 1005 if (!isValidReferenceNameChar(ch)) { 1006 unterminated=true; 1008 } else if (x==maxSourcePos) { 1009 unterminated=true; 1011 x++; } 1013 if (unterminated) { 1014 if (unterminatedMaxCodePoint==INVALID_CODE_POINT) { 1017 return null; 1019 } else { 1020 end=x; 1022 name=source.subSequence(nameBegin,x).toString(); 1023 break; 1024 } 1025 } 1026 if (++x>maxNameEnd) return null; 1027 } 1028 final int codePoint=getCodePointFromName(name); 1029 if (codePoint==INVALID_CODE_POINT || (unterminated && codePoint>unterminatedMaxCodePoint)) return null; 1030 return new CharacterEntityReference(source,begin,end,codePoint); 1031 } 1032 1033 private static final boolean isValidReferenceNameChar(final char ch) { 1034 return ch>='A' && ch<='z' && (ch<='Z' || ch>='a'); 1035 } 1036} 1037 1038 | Popular Tags |