1 19 package org.netbeans.tax; 20 21 import java.util.Map ; 22 import java.util.TreeMap ; 23 import java.util.Collection ; 24 import java.io.ByteArrayInputStream ; 25 import java.io.IOException ; 26 import java.io.InputStreamReader ; 27 28 import org.netbeans.tax.spec.AttlistDecl; 29 import org.netbeans.tax.spec.Attribute; 30 import org.netbeans.tax.spec.CDATASection; 31 import org.netbeans.tax.spec.CharacterReference; 32 import org.netbeans.tax.spec.Comment; 33 import org.netbeans.tax.spec.ConditionalSection; 34 import org.netbeans.tax.spec.DocumentFragment; 35 import org.netbeans.tax.spec.Document; 36 import org.netbeans.tax.spec.DocumentType; 37 import org.netbeans.tax.spec.DTD; 38 import org.netbeans.tax.spec.ElementDecl; 39 import org.netbeans.tax.spec.Element; 40 import org.netbeans.tax.spec.EntityDecl; 41 import org.netbeans.tax.spec.GeneralEntityReference; 42 import org.netbeans.tax.spec.NotationDecl; 43 import org.netbeans.tax.spec.ParameterEntityReference; 44 import org.netbeans.tax.spec.ProcessingInstruction; 45 import org.netbeans.tax.spec.Text; 46 47 52 public final class TreeUtilities { 53 54 55 private static Constraints constraints = new Constraints (); 56 57 58 62 64 public static final void checkAttributeName (TreeName treeName) throws InvalidArgumentException { 65 constraints.checkAttributeName (treeName); 66 } 67 68 70 public static final boolean isValidAttributeName (TreeName treeName) { 71 return constraints.isValidAttributeName (treeName); 72 } 73 74 76 public static final void checkElementTagName (TreeName elementTreeName) throws InvalidArgumentException { 77 constraints.checkElementTagName (elementTreeName); 78 } 79 80 82 public static final boolean isValidElementTagName (TreeName elementTreeName) { 83 return constraints.isValidElementTagName (elementTreeName); 84 } 85 86 88 public static final void checkNotationDeclSystemId (String systemId) throws InvalidArgumentException { 89 constraints.checkNotationDeclSystemId (systemId); 90 } 91 92 94 public static final boolean isValidNotationDeclSystemId (String systemId) { 95 return constraints.isValidNotationDeclSystemId (systemId); 96 } 97 98 100 public static final void checkDocumentEncoding (String encoding) throws InvalidArgumentException { 101 constraints.checkDocumentEncoding (encoding); 102 } 103 104 106 public static final boolean isValidDocumentEncoding (String encoding) { 107 return constraints.isValidDocumentEncoding (encoding); 108 } 109 110 112 public static final void checkDTDEncoding (String encoding) throws InvalidArgumentException { 113 constraints.checkDTDEncoding (encoding); 114 } 115 116 118 public static final boolean isValidDTDEncoding (String encoding) { 119 return constraints.isValidDTDEncoding (encoding); 120 } 121 122 124 public static final void checkCharacterReferenceName (String name) throws InvalidArgumentException { 125 constraints.checkCharacterReferenceName (name); 126 } 127 128 130 public static final boolean isValidCharacterReferenceName (String name) { 131 return constraints.isValidCharacterReferenceName (name); 132 } 133 134 136 public static final void checkEntityDeclInternalText (String internalText) throws InvalidArgumentException { 137 constraints.checkEntityDeclInternalText (internalText); 138 } 139 140 142 public static final boolean isValidEntityDeclInternalText (String internalText) { 143 return constraints.isValidEntityDeclInternalText (internalText); 144 } 145 146 148 public static final void checkAttlistDeclElementName (String elementName) throws InvalidArgumentException { 149 constraints.checkAttlistDeclElementName (elementName); 150 } 151 152 154 public static final boolean isValidAttlistDeclElementName (String elementName) { 155 return constraints.isValidAttlistDeclElementName (elementName); 156 } 157 158 160 public static final void checkDTDVersion (String version) throws InvalidArgumentException { 161 constraints.checkDTDVersion (version); 162 } 163 164 166 public static final boolean isValidDTDVersion (String version) { 167 return constraints.isValidDTDVersion (version); 168 } 169 170 172 public static final void checkDocumentTypeSystemId (String systemId) throws InvalidArgumentException { 173 constraints.checkDocumentTypeSystemId (systemId); 174 } 175 176 178 public static final boolean isValidDocumentTypeSystemId (String systemId) { 179 return constraints.isValidDocumentTypeSystemId (systemId); 180 } 181 182 184 public static final void checkDocumentTypeElementName (String elementName) throws InvalidArgumentException { 185 constraints.checkDocumentTypeElementName (elementName); 186 } 187 188 190 public static final boolean isValidDocumentTypeElementName (String elementName) { 191 return constraints.isValidDocumentTypeElementName (elementName); 192 } 193 194 196 public static final void checkDocumentStandalone (String standalone) throws InvalidArgumentException { 197 constraints.checkDocumentStandalone (standalone); 198 } 199 200 202 public static final boolean isValidDocumentStandalone (String standalone) { 203 return constraints.isValidDocumentStandalone (standalone); 204 } 205 206 208 public static final void checkEntityDeclName (String name) throws InvalidArgumentException { 209 constraints.checkEntityDeclName (name); 210 } 211 212 214 public static final boolean isValidEntityDeclName (String name) { 215 return constraints.isValidEntityDeclName (name); 216 } 217 218 220 public static final void checkAttlistDeclAttributeEnumeratedType (String [] enumeratedType) throws InvalidArgumentException { 221 constraints.checkAttlistDeclAttributeEnumeratedType (enumeratedType); 222 } 223 224 226 public static final boolean isValidAttlistDeclAttributeEnumeratedType (String [] enumeratedType) { 227 return constraints.isValidAttlistDeclAttributeEnumeratedType (enumeratedType); 228 } 229 230 232 public static final void checkProcessingInstructionData (String data) throws InvalidArgumentException { 233 constraints.checkProcessingInstructionData (data); 234 } 235 236 238 public static final boolean isValidProcessingInstructionData (String data) { 239 return constraints.isValidProcessingInstructionData (data); 240 } 241 242 244 public static final void checkEntityDeclNotationName (String notationName) throws InvalidArgumentException { 245 constraints.checkEntityDeclNotationName (notationName); 246 } 247 248 250 public static final boolean isValidEntityDeclNotationName (String notationName) { 251 return constraints.isValidEntityDeclNotationName (notationName); 252 } 253 254 256 public static final void checkElementDeclName (String name) throws InvalidArgumentException { 257 constraints.checkElementDeclName (name); 258 } 259 260 262 public static final boolean isValidElementDeclName (String name) { 263 return constraints.isValidElementDeclName (name); 264 } 265 266 268 public static final void checkGeneralEntityReferenceName (String name) throws InvalidArgumentException { 269 constraints.checkGeneralEntityReferenceName (name); 270 } 271 272 274 public static final boolean isValidGeneralEntityReferenceName (String name) { 275 return constraints.isValidGeneralEntityReferenceName (name); 276 } 277 278 280 public static final void checkEntityDeclSystemId (String systemId) throws InvalidArgumentException { 281 constraints.checkEntityDeclSystemId (systemId); 282 } 283 284 286 public static final boolean isValidEntityDeclSystemId (String systemId) { 287 return constraints.isValidEntityDeclSystemId (systemId); 288 } 289 290 292 public static final void checkProcessingInstructionTarget (String target) throws InvalidArgumentException { 293 constraints.checkProcessingInstructionTarget (target); 294 } 295 296 298 public static final boolean isValidProcessingInstructionTarget (String target) { 299 return constraints.isValidProcessingInstructionTarget (target); 300 } 301 302 304 public static final void checkEntityDeclPublicId (String publicId) throws InvalidArgumentException { 305 constraints.checkEntityDeclPublicId (publicId); 306 } 307 308 310 public static final boolean isValidEntityDeclPublicId (String publicId) { 311 return constraints.isValidEntityDeclPublicId (publicId); 312 } 313 314 316 public static final void checkAttlistDeclAttributeDefaultValue (String defaultValue) throws InvalidArgumentException { 317 constraints.checkAttlistDeclAttributeDefaultValue (defaultValue); 318 } 319 320 322 public static final boolean isValidAttlistDeclAttributeDefaultValue (String defaultValue) { 323 return constraints.isValidAttlistDeclAttributeDefaultValue (defaultValue); 324 } 325 326 328 public static final void checkDocumentFragmentVersion (String version) throws InvalidArgumentException { 329 constraints.checkDocumentFragmentVersion (version); 330 } 331 332 334 public static final boolean isValidDocumentFragmentVersion (String version) { 335 return constraints.isValidDocumentFragmentVersion (version); 336 } 337 338 340 public static final void checkNotationDeclName (String name) throws InvalidArgumentException { 341 constraints.checkNotationDeclName (name); 342 } 343 344 346 public static final boolean isValidNotationDeclName (String name) { 347 return constraints.isValidNotationDeclName (name); 348 } 349 350 352 public static final void checkAttributeValue (String value) throws InvalidArgumentException { 353 constraints.checkAttributeValue (value); 354 } 355 356 358 public static final boolean isValidAttributeValue (String value) { 359 return constraints.isValidAttributeValue (value); 360 } 361 362 364 public static final void checkParameterEntityReferenceName (String name) throws InvalidArgumentException { 365 constraints.checkParameterEntityReferenceName (name); 366 } 367 368 370 public static final boolean isValidParameterEntityReferenceName (String name) { 371 return constraints.isValidParameterEntityReferenceName (name); 372 } 373 374 376 public static final void checkDocumentFragmentEncoding (String encoding) throws InvalidArgumentException { 377 constraints.checkDocumentFragmentEncoding (encoding); 378 } 379 380 382 public static final boolean isValidDocumentFragmentEncoding (String encoding) { 383 return constraints.isValidDocumentFragmentEncoding (encoding); 384 } 385 386 388 public static final void checkTextData (String data) throws InvalidArgumentException { 389 constraints.checkTextData (data); 390 } 391 392 394 public static final boolean isValidTextData (String data) { 395 return constraints.isValidTextData (data); 396 } 397 398 400 public static final void checkDocumentTypePublicId (String publicId) throws InvalidArgumentException { 401 constraints.checkDocumentTypePublicId (publicId); 402 } 403 404 406 public static final boolean isValidDocumentTypePublicId (String publicId) { 407 return constraints.isValidDocumentTypePublicId (publicId); 408 } 409 410 412 public static final void checkElementDeclContentType (TreeElementDecl.ContentType contentType) throws InvalidArgumentException { 413 constraints.checkElementDeclContentType (contentType); 414 } 415 416 418 public static final boolean isValidElementDeclContentType (TreeElementDecl.ContentType contentType) { 419 return constraints.isValidElementDeclContentType (contentType); 420 } 421 422 424 public static final void checkDocumentVersion (String version) throws InvalidArgumentException { 425 constraints.checkDocumentVersion (version); 426 } 427 428 430 public static final boolean isValidDocumentVersion (String version) { 431 return constraints.isValidDocumentVersion (version); 432 } 433 434 436 public static final void checkCDATASectionData (String data) throws InvalidArgumentException { 437 constraints.checkCDATASectionData (data); 438 } 439 440 442 public static final boolean isValidCDATASectionData (String data) { 443 return constraints.isValidCDATASectionData (data); 444 } 445 446 448 public static final void checkNotationDeclPublicId (String publicId) throws InvalidArgumentException { 449 constraints.checkNotationDeclPublicId (publicId); 450 } 451 452 454 public static final boolean isValidNotationDeclPublicId (String publicId) { 455 return constraints.isValidNotationDeclPublicId (publicId); 456 } 457 458 460 public static final void checkAttlistDeclAttributeName (String attributeName) throws InvalidArgumentException { 461 constraints.checkAttlistDeclAttributeName (attributeName); 462 } 463 464 466 public static final boolean isValidAttlistDeclAttributeName (String attributeName) { 467 return constraints.isValidAttlistDeclAttributeName (attributeName); 468 } 469 470 472 public static final void checkCommentData (String data) throws InvalidArgumentException { 473 constraints.checkCommentData (data); 474 } 475 476 478 public static final boolean isValidCommentData (String data) { 479 return constraints.isValidCommentData (data); 480 } 481 482 484 public static final void checkAttlistDeclAttributeType (short type) throws InvalidArgumentException { 485 constraints.checkAttlistDeclAttributeType (type); 486 } 487 488 490 public static final boolean isValidAttlistDeclAttributeType (short type) { 491 return constraints.isValidAttlistDeclAttributeType (type); 492 } 493 494 496 public static final void checkAttlistDeclAttributeDefaultType (short defaultType) throws InvalidArgumentException { 497 constraints.checkAttlistDeclAttributeDefaultType (defaultType); 498 } 499 500 502 public static final boolean isValidAttlistDeclAttributeDefaultType (short defaultType) { 503 return constraints.isValidAttlistDeclAttributeDefaultType (defaultType); 504 } 505 506 507 508 512 515 private static final class Constraints extends UnicodeClasses 516 implements AttlistDecl.Constraints, 517 Attribute.Constraints, 518 CDATASection.Constraints, 519 CharacterReference.Constraints, 520 Comment.Constraints, 521 ConditionalSection.Constraints, 522 DocumentFragment.Constraints, 523 Document.Constraints, 524 DocumentType.Constraints, 525 DTD.Constraints, 526 ElementDecl.Constraints, 527 Element.Constraints, 528 EntityDecl.Constraints, 529 GeneralEntityReference.Constraints, 530 NotationDecl.Constraints, 531 ParameterEntityReference.Constraints, 532 ProcessingInstruction.Constraints, 533 Text.Constraints { 534 535 536 540 542 private static void checkNullArgument (String argName, Object argValue) throws InvalidArgumentException { 543 if ( argValue == null ) { 544 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_null_value")); 545 } 546 } 547 548 550 private static void checkEmptyString (String argName, String string, boolean trim) throws InvalidArgumentException { 551 if ( (string.length () == 0) || (trim && (string.trim ().equals (""))) ) { throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_empty_value")); 553 } 554 } 555 556 557 558 562 565 private static void checkXMLName (String argName, String name) throws InvalidArgumentException { 566 checkNullArgument (argName, name); 567 checkEmptyString (argName, name, true); 568 569 char first = name.charAt (0); 570 if (!!! isXMLNameStartChar (first)) { 571 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_first_char", String.valueOf (first))); 572 } 573 574 for (int i = 0, len = name.length (); i < len; i++) { 575 char c = name.charAt (i); 576 if (!!! isXMLNameChar (c)) { 577 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_content_char", String.valueOf (c))); 578 } 579 } 580 } 581 582 585 private static void checkNmToken (String argName, String token) throws InvalidArgumentException { 586 587 checkNullArgument (argName, token); 588 checkEmptyString (argName, token, true); 589 590 for (int i = 0, len = token.length (); i < len; i++) { 591 char c = token.charAt (i); 592 if (!!! isXMLNameChar (c)) { 593 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_content_char", String.valueOf (c))); 594 } 595 } 596 597 } 598 599 602 private static void checkXMLNCName (String argName, String name) throws InvalidArgumentException { 603 checkNullArgument (argName, name); 604 checkEmptyString (argName, name, true); 605 606 char first = name.charAt (0); 607 if (!!! isXMLNCNameStartChar (first)) { 608 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_first_char", String.valueOf (first))); 609 } 610 611 for (int i = 0, len = name.length (); i < len; i++) { 612 char c = name.charAt (i); 613 if (!!! isXMLNCNameChar (c)) { 614 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_content_char", String.valueOf (c))); 615 } 616 } 617 } 618 619 621 private static void checkNamespacePrefix (String prefix) throws InvalidArgumentException { 622 String argName = Util.THIS.getString ("PROP_NamespacePrefix"); 623 checkXMLNCName (argName, prefix); 624 } 625 626 628 private static void checkNamespaceURI (String uri) throws InvalidArgumentException { 629 String argName = Util.THIS.getString ("PROP_NamespaceURI"); 630 checkAttributeValue (argName, uri); 631 } 632 633 634 635 637 private static void checkElementName (String argName, String name) throws InvalidArgumentException { 638 checkNullArgument (argName, name); 639 checkXMLName (argName, name); 640 } 641 642 644 private static void checkAttributeName (String argName, String name) throws InvalidArgumentException { 645 checkNullArgument (argName, name); 646 checkXMLName (argName, name); 647 } 648 649 651 private static void checkAttributeValue (String argName, String value) throws InvalidArgumentException { 652 checkNullArgument (argName, value); 653 checkCharacterData (argName, value); 654 655 int index = value.indexOf ('<'); 656 if ( index != -1 ) { 657 throw new InvalidArgumentException (argName, Util.THIS.getString ("EXC_invalid_attribute_value", value)); 658 } 659 index = value.indexOf ('&'); 660 if ( index != -1 ) { 661 throw new InvalidArgumentException (argName, Util.THIS.getString ("EXC_invalid_attribute_value", value)); 662 } 663 664 boolean apostrofFound = false; 665 boolean quoteFound = false; 666 for (int i = 0, len = value.length (); i < len; i++) { 667 char c = value.charAt (i); 668 if (c == '\'') 669 if (quoteFound) 670 throw new InvalidArgumentException (argName, Util.THIS.getString ("EXC_invalid_attribute_value", value)); 671 else 672 apostrofFound = true; 673 if (c == '"') 674 if (apostrofFound) 675 throw new InvalidArgumentException (argName, Util.THIS.getString ("EXC_invalid_attribute_value", value)); 676 else 677 quoteFound = true; 678 } 679 } 680 681 683 private static void checkCharacterData (String argName, String text) throws InvalidArgumentException { 684 checkNullArgument (argName, text); 685 686 for (int i = 0, len = text.length (); i < len; i++) { 688 char c = text.charAt (i); 689 if (!!! isXMLChar (c)) { 690 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_content_char", "0x" + Integer.toHexString (c))); } 692 } 693 } 694 695 697 private static void checkSystemId (String argName, String systemId) throws InvalidArgumentException { 698 boolean apostrofFound = false; 699 boolean quoteFound = false; 700 for (int i = 0, len = systemId.length (); i < len; i++) { 701 char c = systemId.charAt (i); 702 if (c == '\'') 703 if (quoteFound) 704 throw new InvalidArgumentException (argName, Util.THIS.getString ("EXC_Invalid_system_id", systemId)); 705 else 706 apostrofFound = true; 707 if (c == '"') 708 if (apostrofFound) 709 throw new InvalidArgumentException (argName, Util.THIS.getString ("EXC_Invalid_system_id", systemId)); 710 else 711 quoteFound = true; 712 } 713 } 714 715 717 private static void checkPublicId (String argName, String publicId) throws InvalidArgumentException { 718 boolean apostrofFound = false; 719 boolean quoteFound = false; 720 for (int i = 0, len = publicId.length (); i < len; i++) { 721 char c = publicId.charAt (i); 722 if (c == '\'') { 723 if (quoteFound) { 724 throw new InvalidArgumentException (argName, Util.THIS.getString ("EXC_Invalid_public_id", publicId)); 725 } else { 726 apostrofFound = true; 727 } 728 } else if (c == '"') { 729 if (apostrofFound) { 730 throw new InvalidArgumentException (argName, Util.THIS.getString ("EXC_Invalid_public_id", publicId)); 731 } else { 732 quoteFound = true; 733 } 734 } else if ( isXMLPubidLiteral (c) == false ) { 735 throw new InvalidArgumentException (argName, Util.THIS.getString ("EXC_Invalid_public_id", publicId)); 736 } 737 } 738 } 739 740 742 private static void checkNotationName (String argName, String name) throws InvalidArgumentException { 743 checkNullArgument (argName, name); 744 checkXMLName (argName, name); 745 } 746 747 748 750 private static void checkEncoding (String argName, String encoding) throws InvalidArgumentException { 751 if ( Util.THIS.isLoggable() ) Util.THIS.debug ("TreeUtilities::checkEncoding: encoding = " + encoding); 753 ByteArrayInputStream stream = new ByteArrayInputStream (new byte[0]); 754 755 if ( Util.THIS.isLoggable() ) Util.THIS.debug (" ::checkEncoding: stream = " + stream); 757 try { 758 InputStreamReader reader = new InputStreamReader (stream, iana2java (encoding)); 759 760 if ( Util.THIS.isLoggable() ) Util.THIS.debug (" ::checkEncoding: reader = " + reader); } catch (IOException exc) { 762 if ( Util.THIS.isLoggable() ) Util.THIS.debug (" ::checkEncoding: IOException !!!", exc); 764 throw new InvalidArgumentException (argName, Util.THIS.getString ("EXC_Invalid_encoding", encoding)); 765 } 766 } 767 768 769 771 public void checkAttributeName (TreeName treeName) throws InvalidArgumentException { 772 String argName = Util.THIS.getString ("PROP_AttributeName"); 773 checkAttributeName (argName, treeName.getQualifiedName ()); 774 } 775 776 778 public boolean isValidAttributeName (TreeName treeName) { 779 try { 780 checkAttributeName (treeName); 781 } catch (InvalidArgumentException exc) { 782 return false; 783 } 784 return true; 785 } 786 787 788 790 public void checkElementTagName (TreeName elementTreeName) throws InvalidArgumentException { 791 checkElementName (Util.THIS.getString ("PROP_ElementTagName"), elementTreeName.getQualifiedName ()); 792 } 793 794 796 public boolean isValidElementTagName (TreeName elementTreeName) { 797 try { 798 checkElementTagName (elementTreeName); 799 } catch (InvalidArgumentException exc) { 800 return false; 801 } 802 return true; 803 } 804 805 806 808 public void checkNotationDeclSystemId (String systemId) throws InvalidArgumentException { 809 if ( systemId == null ) { 810 return; 811 } 812 checkSystemId (Util.THIS.getString ("PROP_NotationDeclSystemId"), systemId); 813 } 814 815 817 public boolean isValidNotationDeclSystemId (String systemId) { 818 try { 819 checkNotationDeclSystemId (systemId); 820 } catch (InvalidArgumentException exc) { 821 return false; 822 } 823 return true; 824 } 825 826 827 829 public void checkDocumentEncoding (String encoding) throws InvalidArgumentException { 830 if ( encoding == null ) 831 return; 832 checkEncoding (Util.THIS.getString ("PROP_DocumentEncoding"), encoding); 833 } 834 835 837 public boolean isValidDocumentEncoding (String encoding) { 838 try { 839 checkDocumentEncoding (encoding); 840 } catch (InvalidArgumentException exc) { 841 return false; 842 } 843 return true; 844 } 845 846 847 849 public void checkDTDEncoding (String encoding) throws InvalidArgumentException { 850 if ( encoding == null ) 851 return; 852 checkEncoding (Util.THIS.getString ("PROP_DTDEncoding"), encoding); 853 } 854 855 857 public boolean isValidDTDEncoding (String encoding) { 858 try { 859 checkDTDEncoding (encoding); 860 } catch (InvalidArgumentException exc) { 861 return false; 862 } 863 return true; 864 } 865 866 867 869 public void checkCharacterReferenceName (String name) throws InvalidArgumentException { 870 String argName = Util.THIS.getString ("PROP_CharacterReferenceName"); 871 872 checkNullArgument (argName, name); 873 checkEmptyString (argName, name, true); 874 875 int i = 0; 876 char first = name.charAt (i); 877 if ( first != '#' ) { 878 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_first_char", String.valueOf (first))); 879 } 880 881 i++; 882 if ( name.length () <= i ) { 883 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_empty_value")); 884 } 885 886 char second = name.charAt (i); 887 int radix = 10; 888 if ( second == 'x' ) { 889 radix = 16; 890 891 i++; 892 if ( name.length () <= i ) { 893 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_empty_value")); 894 } 895 } 896 String number = name.substring (i); 897 try { 898 Short.parseShort (number, radix); 899 } catch (NumberFormatException exc) { 900 throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_content_char", number)); 901 } 902 903 909 } 910 911 913 public boolean isValidCharacterReferenceName (String name) { 914 try { 915 checkCharacterReferenceName (name); 916 } catch (InvalidArgumentException exc) { 917 return false; 918 } 919 return true; 920 } 921 922 923 925 public void checkEntityDeclInternalText (String internalText) throws InvalidArgumentException { 926 checkNullArgument (Util.THIS.getString ("PROP_EntityDeclInternalText"), internalText); 927 boolean apostrofFound = false; 928 boolean quoteFound = false; 929 for (int i = 0, len = internalText.length (); i < len; i++) { 930 char c = internalText.charAt (i); 931 if (c == '\'') 932 if (quoteFound) 933 throw new InvalidArgumentException (Util.THIS.getString ("PROP_EntityDeclInternalText"), Util.THIS.getString ("EXC_Invalid_Entity_Decl_Internal_text", internalText)); 934 else 935 apostrofFound = true; 936 if (c == '"') 937 if (apostrofFound) 938 throw new InvalidArgumentException (Util.THIS.getString ("PROP_EntityDeclInternalText"), Util.THIS.getString ("EXC_Invalid_Entity_Decl_Internal_text", internalText)); 939 else 940 quoteFound = true; 941 } 945 } 946 947 948 950 public boolean isValidEntityDeclInternalText (String internalText) { 951 try { 952 checkEntityDeclInternalText (internalText); 953 } catch (InvalidArgumentException exc) { 954 return false; 955 } 956 return true; 957 } 958 959 960 962 public void checkAttlistDeclElementName (String elementName) throws InvalidArgumentException { 963 checkElementName (Util.THIS.getString ("PROP_AttlistDeclElementName"), elementName); 964 } 965 966 968 public boolean isValidAttlistDeclElementName (String elementName) { 969 try { 970 checkAttlistDeclElementName (elementName); 971 } catch (InvalidArgumentException exc) { 972 return false; 973 } 974 return true; 975 } 976 977 978 980 public void checkDTDVersion (String version) throws InvalidArgumentException { 981 if (version == null) 982 return; 983 if (!!! version.equals ("1.0")) { String arg = Util.THIS.getString ("PROP_DTDVersion"); 985 String msg = Util.THIS.getString ("PROP_invalid_version_number", version); 986 throw new InvalidArgumentException (arg, msg); 987 } 988 } 989 990 992 public boolean isValidDTDVersion (String version) { 993 try { 994 checkDTDVersion (version); 995 } catch (InvalidArgumentException exc) { 996 return false; 997 } 998 return true; 999 } 1000 1001 1002 1004 public void checkDocumentTypeSystemId (String systemId) throws InvalidArgumentException { 1005 if ( systemId == null ) { 1006 return; 1007 } 1008 checkSystemId (Util.THIS.getString ("PROP_DocumentTypeSystemId"), systemId); 1009 } 1010 1011 1013 public boolean isValidDocumentTypeSystemId (String systemId) { 1014 try { 1015 checkDocumentTypeSystemId (systemId); 1016 } catch (InvalidArgumentException exc) { 1017 return false; 1018 } 1019 return true; 1020 } 1021 1022 1023 1025 public void checkDocumentTypeElementName (String elementName) throws InvalidArgumentException { 1026 checkElementName (Util.THIS.getString ("PROP_DocumentTypeElementName"), elementName); 1027 } 1028 1029 1031 public boolean isValidDocumentTypeElementName (String elementName) { 1032 try { 1033 checkDocumentTypeElementName (elementName); 1034 } catch (InvalidArgumentException exc) { 1035 return false; 1036 } 1037 return true; 1038 } 1039 1040 1041 1043 public void checkDocumentStandalone (String standalone) throws InvalidArgumentException { 1044 if (standalone == null) 1045 return; 1046 if (standalone.equals ("yes")) return; 1048 if (standalone.equals ("no")) return; 1050 throw new InvalidArgumentException (standalone, standalone + Util.THIS.getString ("PROP_is_not_valid_standalone_value")); 1051 } 1052 1053 1055 public boolean isValidDocumentStandalone (String standalone) { 1056 try { 1057 checkDocumentStandalone (standalone); 1058 } catch (InvalidArgumentException exc) { 1059 return false; 1060 } 1061 return true; 1062 } 1063 1064 1065 1067 public void checkEntityDeclName (String name) throws InvalidArgumentException { 1068 checkXMLName (Util.THIS.getString ("PROP_EntityDeclName"), name); 1069 } 1070 1071 1073 public boolean isValidEntityDeclName (String name) { 1074 try { 1075 checkEntityDeclName (name); 1076 } catch (InvalidArgumentException exc) { 1077 return false; 1078 } 1079 return true; 1080 } 1081 1082 1083 1085 public void checkAttlistDeclAttributeEnumeratedType (String [] enumeratedType) throws InvalidArgumentException { 1086 if ( enumeratedType == null ) { 1087 return; 1088 } 1089 for (int i = 0, len = enumeratedType.length; i < len; i++) 1090 checkNmToken (Util.THIS.getString ("PROP_AttlistDeclAttributeEnumeratedType"), enumeratedType[i]); 1091 } 1092 1093 1095 public boolean isValidAttlistDeclAttributeEnumeratedType (String [] enumeratedType) { 1096 try { 1097 checkAttlistDeclAttributeEnumeratedType (enumeratedType); 1098 } catch (InvalidArgumentException exc) { 1099 return false; 1100 } 1101 return true; 1102 } 1103 1104 1105 1107 public void checkProcessingInstructionData (String data) throws InvalidArgumentException { 1108 checkCharacterData (Util.THIS.getString ("PROP_ProcessingInstructionData"), data); 1109 1110 int index = data.indexOf ("?>"); if (index != -1) { 1112 throw new InvalidArgumentException (data, Util.THIS.getString ("PROP_invalid_processing_instruction_data")); 1113 } 1114 } 1115 1116 1118 public boolean isValidProcessingInstructionData (String data) { 1119 try { 1120 checkProcessingInstructionData (data); 1121 } catch (InvalidArgumentException exc) { 1122 return false; 1123 } 1124 return true; 1125 } 1126 1127 1129 public void checkEntityDeclNotationName (String notationName) throws InvalidArgumentException { 1130 if ( notationName == null ) { 1131 return; 1132 } 1133 checkNotationName (Util.THIS.getString ("PROP_EntityDeclNotationName"), notationName); 1134 } 1135 1136 1138 public boolean isValidEntityDeclNotationName (String notationName) { 1139 try { 1140 checkEntityDeclNotationName (notationName); 1141 } catch (InvalidArgumentException exc) { 1142 return false; 1143 } 1144 return true; 1145 } 1146 1147 1148 1150 public void checkElementDeclName (String name) throws InvalidArgumentException { 1151 checkElementName (Util.THIS.getString ("PROP_ElementDeclName"), name); 1152 } 1153 1154 1156 public boolean isValidElementDeclName (String name) { 1157 try { 1158 checkElementDeclName (name); 1159 } catch (InvalidArgumentException exc) { 1160 return false; 1161 } 1162 return true; 1163 } 1164 1165 1166 1168 public void checkGeneralEntityReferenceName (String name) throws InvalidArgumentException { 1169 checkXMLName (Util.THIS.getString ("PROP_GeneralEntityReferenceName"), name); 1170 } 1171 1172 1174 public boolean isValidGeneralEntityReferenceName (String name) { 1175 try { 1176 checkGeneralEntityReferenceName (name); 1177 } catch (InvalidArgumentException exc) { 1178 return false; 1179 } 1180 return true; 1181 } 1182 1183 1184 1186 public void checkEntityDeclSystemId (String systemId) throws InvalidArgumentException { 1187 if ( systemId == null ) { 1188 return; 1189 } 1190 checkSystemId (Util.THIS.getString ("PROP_EntityDeclSystemId"), systemId); 1191 } 1192 1193 1195 public boolean isValidEntityDeclSystemId (String systemId) { 1196 try { 1197 checkEntityDeclSystemId (systemId); 1198 } catch (InvalidArgumentException exc) { 1199 return false; 1200 } 1201 return true; 1202 } 1203 1204 1205 1207 public void checkProcessingInstructionTarget (String target) throws InvalidArgumentException { 1208 String argName = Util.THIS.getString ("PROP_ProcessingInstructionTarget"); 1209 checkXMLName (argName, target); 1210 1211 if (target.equalsIgnoreCase ("xml")) { throw new InvalidArgumentException (argName, Util.THIS.getString ("PROP_invalid_content_char", target)); 1213 } 1214 } 1215 1216 1218 public boolean isValidProcessingInstructionTarget (String target) { 1219 try { 1220 checkProcessingInstructionTarget (target); 1221 } catch (InvalidArgumentException exc) { 1222 return false; 1223 } 1224 return true; 1225 } 1226 1227 1228 1230 public void checkEntityDeclPublicId (String publicId) throws InvalidArgumentException { 1231 if ( publicId == null ) { 1232 return; 1233 } 1234 checkPublicId (Util.THIS.getString ("PROP_EntityDeclPublicId"), publicId); 1235 } 1236 1237 1238 1240 public boolean isValidEntityDeclPublicId (String publicId) { 1241 try { 1242 checkEntityDeclPublicId (publicId); 1243 } catch (InvalidArgumentException exc) { 1244 return false; 1245 } 1246 return true; 1247 } 1248 1249 1250 1252 public void checkAttlistDeclAttributeDefaultValue (String defaultValue) throws InvalidArgumentException { 1253 if ( defaultValue == null ) { 1254 return; 1255 } 1256 boolean apostrofFound = false; 1257 boolean quoteFound = false; 1258 for (int i = 0, len = defaultValue.length (); i < len; i++) { 1259 char c = defaultValue.charAt (i); 1260 if (c == '\'') 1261 if (quoteFound) 1262 throw new InvalidArgumentException (Util.THIS.getString ("PROP_AttlistDeclAttributeDefaultValue"), Util.THIS.getString ("EXC_invalid_attribute_default_value", defaultValue)); 1263 else 1264 apostrofFound = true; 1265 if (c == '"') 1266 if (apostrofFound) 1267 throw new InvalidArgumentException (Util.THIS.getString ("PROP_AttlistDeclAttributeDefaultValue"), Util.THIS.getString ("EXC_invalid_attribute_default_value", defaultValue)); 1268 else 1269 quoteFound = true; 1270 } 1274 } 1275 1276 1278 public boolean isValidAttlistDeclAttributeDefaultValue (String defaultValue) { 1279 try { 1280 checkAttlistDeclAttributeDefaultValue (defaultValue); 1281 } catch (InvalidArgumentException exc) { 1282 return false; 1283 } 1284 return true; 1285 } 1286 1287 1288 1290 public void checkDocumentFragmentVersion (String version) throws InvalidArgumentException { 1291 if ( version == null ) 1292 return; 1293 if (!!! version.equals ("1.0")) { String arg = Util.THIS.getString ("PROP_DocumentFragmentVersion"); 1295 String msg = Util.THIS.getString ("PROP_invalid_version_number", version); 1296 throw new InvalidArgumentException (arg, msg); 1297 } 1298 } 1299 1300 1302 public boolean isValidDocumentFragmentVersion (String version) { 1303 try { 1304 checkDocumentFragmentVersion (version); 1305 } catch (InvalidArgumentException exc) { 1306 return false; 1307 } 1308 return true; 1309 } 1310 1311 1312 1314 public void checkNotationDeclName (String name) throws InvalidArgumentException { 1315 checkXMLName (Util.THIS.getString ("PROP_NotationDeclName"), name); 1316 } 1317 1318 1320 public boolean isValidNotationDeclName (String name) { 1321 try { 1322 checkNotationDeclName (name); 1323 } catch (InvalidArgumentException exc) { 1324 return false; 1325 } 1326 return true; 1327 } 1328 1329 1330 1332 public void checkAttributeValue (String value) throws InvalidArgumentException { 1333 String argName = Util.THIS.getString ("PROP_AttributeValue"); 1334 checkAttributeValue (argName, value); 1335 } 1336 1337 1339 public boolean isValidAttributeValue (String value) { 1340 try { 1341 checkAttributeValue (value); 1342 } catch (InvalidArgumentException exc) { 1343 return false; 1344 } 1345 return true; 1346 } 1347 1348 1349 1351 public void checkParameterEntityReferenceName (String name) throws InvalidArgumentException { 1352 checkXMLName (Util.THIS.getString ("PROP_ParameterEntityReferenceName"), name); 1353 } 1354 1355 1357 public boolean isValidParameterEntityReferenceName (String name) { 1358 try { 1359 checkParameterEntityReferenceName (name); 1360 } catch (InvalidArgumentException exc) { 1361 return false; 1362 } 1363 return true; 1364 } 1365 1366 1367 1369 public void checkDocumentFragmentEncoding (String encoding) throws InvalidArgumentException { 1370 if ( encoding == null ) 1371 return; 1372 checkEncoding (Util.THIS.getString ("PROP_DocumentFragmentEncoding"), encoding); 1373 } 1374 1375 1377 public boolean isValidDocumentFragmentEncoding (String encoding) { 1378 try { 1379 checkDocumentFragmentEncoding (encoding); 1380 } catch (InvalidArgumentException exc) { 1381 return false; 1382 } 1383 return true; 1384 } 1385 1386 1387 1389 public void checkTextData (String data) throws InvalidArgumentException { 1390 String argName = Util.THIS.getString ("PROP_TextData"); 1391 checkCharacterData (argName, data); 1392 checkEmptyString (argName, data, false); 1393 1394 int index = data.indexOf ('<'); 1395 if ( index != -1 ) { 1396 throw new InvalidArgumentException (data, Util.THIS.getString ("PROP_invalid_text_data")); 1397 } 1398 index = data.indexOf ('&'); 1399 if ( index != -1 ) { 1400 throw new InvalidArgumentException (data, Util.THIS.getString ("PROP_invalid_text_data")); 1401 } 1402 index = data.indexOf ("]]>"); 1403 if ( index != -1 ) { 1404 throw new InvalidArgumentException (data, Util.THIS.getString ("PROP_invalid_text_data")); 1405 } 1406 } 1407 1408 1410 public boolean isValidTextData (String data) { 1411 try { 1412 checkTextData (data); 1413 } catch (InvalidArgumentException exc) { 1414 return false; 1415 } 1416 return true; 1417 } 1418 1419 1420 1422 public void checkDocumentTypePublicId (String publicId) throws InvalidArgumentException { 1423 if ( publicId == null ) { 1424 return; 1425 } 1426 checkPublicId (Util.THIS.getString ("PROP_DocumentTypePublicId"), publicId); 1427 } 1428 1429 1431 public boolean isValidDocumentTypePublicId (String publicId) { 1432 try { 1433 checkDocumentTypePublicId (publicId); 1434 } catch (InvalidArgumentException exc) { 1435 return false; 1436 } 1437 return true; 1438 } 1439 1440 1441 1443 public void checkElementDeclContentType (TreeElementDecl.ContentType contentType) throws InvalidArgumentException { 1444 checkNullArgument (Util.THIS.getString ("PROP_ElementDeclContentType"), contentType); 1445 } 1447 1448 1450 public boolean isValidElementDeclContentType (TreeElementDecl.ContentType contentType) { 1451 try { 1452 checkElementDeclContentType (contentType); 1453 } catch (InvalidArgumentException exc) { 1454 return false; 1455 } 1456 return true; 1457 } 1458 1459 1460 1462 public void checkDocumentVersion (String version) throws InvalidArgumentException { 1463 if ( version == null ) 1464 return; 1465 if (!!! version.equals ("1.0")) { String arg = Util.THIS.getString ("PROP_DocumentVersion"); 1467 String msg = Util.THIS.getString ("PROP_invalid_version_number", version); 1468 throw new InvalidArgumentException (arg, msg); 1469 } 1470 } 1471 1472 1474 public boolean isValidDocumentVersion (String version) { 1475 try { 1476 checkDocumentVersion (version); 1477 } catch (InvalidArgumentException exc) { 1478 return false; 1479 } 1480 return true; 1481 } 1482 1483 1484 1486 public void checkCDATASectionData (String data) throws InvalidArgumentException { 1487 checkCharacterData (Util.THIS.getString ("PROP_CDATASectionData"), data); 1488 1489 int index = data.indexOf ("]]>"); if (index != -1) { 1491 throw new InvalidArgumentException (data, Util.THIS.getString ("PROP_invalid_cdata_section_data")); 1492 } 1493 } 1494 1495 1497 public boolean isValidCDATASectionData (String data) { 1498 try { 1499 checkCDATASectionData (data); 1500 } catch (InvalidArgumentException exc) { 1501 return false; 1502 } 1503 return true; 1504 } 1505 1506 1507 1509 public void checkNotationDeclPublicId (String publicId) throws InvalidArgumentException { 1510 if ( publicId == null ) { 1511 return; 1512 } 1513 checkPublicId (Util.THIS.getString ("PROP_NotationDeclPublicId"), publicId); 1514 } 1515 1516 1518 public boolean isValidNotationDeclPublicId (String publicId) { 1519 try { 1520 checkNotationDeclPublicId (publicId); 1521 } catch (InvalidArgumentException exc) { 1522 return false; 1523 } 1524 return true; 1525 } 1526 1527 1528 1530 public void checkAttlistDeclAttributeName (String attributeName) throws InvalidArgumentException { 1531 checkAttributeName (Util.THIS.getString ("PROP_AttlistDeclAttributeName"), attributeName); 1532 } 1533 1534 1536 public boolean isValidAttlistDeclAttributeName (String attributeName) { 1537 try { 1538 checkAttlistDeclAttributeName (attributeName); 1539 } catch (InvalidArgumentException exc) { 1540 return false; 1541 } 1542 return true; 1543 } 1544 1545 1546 1548 public void checkCommentData (String data) throws InvalidArgumentException { 1549 checkCharacterData (Util.THIS.getString ("PROP_CommentData"), data); 1550 1551 int index = data.indexOf ("--"); if (index != -1) { 1553 throw new InvalidArgumentException (data, Util.THIS.getString ("PROP_invalid_comment_data")); 1554 } 1555 if (data.endsWith ("-")) { throw new InvalidArgumentException (data, Util.THIS.getString ("PROP_invalid_comment_data_end")); 1557 } 1558 } 1559 1560 1562 public boolean isValidCommentData (String data) { 1563 try { 1564 checkCommentData (data); 1565 } catch (InvalidArgumentException exc) { 1566 return false; 1567 } 1568 return true; 1569 } 1570 1571 1573 public void checkAttlistDeclAttributeType (short type) throws InvalidArgumentException { 1574 if (( type != TreeAttlistDeclAttributeDef.TYPE_CDATA ) && 1575 ( type != TreeAttlistDeclAttributeDef.TYPE_ID ) && 1576 ( type != TreeAttlistDeclAttributeDef.TYPE_IDREF ) && 1577 ( type != TreeAttlistDeclAttributeDef.TYPE_IDREFS ) && 1578 ( type != TreeAttlistDeclAttributeDef.TYPE_ENTITY ) && 1579 ( type != TreeAttlistDeclAttributeDef.TYPE_ENTITIES ) && 1580 ( type != TreeAttlistDeclAttributeDef.TYPE_NMTOKEN ) && 1581 ( type != TreeAttlistDeclAttributeDef.TYPE_NMTOKENS ) && 1582 ( type != TreeAttlistDeclAttributeDef.TYPE_ENUMERATED ) && 1583 ( type != TreeAttlistDeclAttributeDef.TYPE_NOTATION ) ) { 1584 throw new InvalidArgumentException (new Short (type), Util.THIS.getString ("PROP_invalid_attribute_list_declaration_type")); 1585 } 1586 } 1587 1588 1590 public boolean isValidAttlistDeclAttributeType (short type) { 1591 try { 1592 checkAttlistDeclAttributeType (type); 1593 } catch (InvalidArgumentException exc) { 1594 return false; 1595 } 1596 return true; 1597 } 1598 1599 1601 public void checkAttlistDeclAttributeDefaultType (short defaultType) throws InvalidArgumentException { 1602 if (( defaultType != TreeAttlistDeclAttributeDef.DEFAULT_TYPE_NULL ) && 1603 ( defaultType != TreeAttlistDeclAttributeDef.DEFAULT_TYPE_REQUIRED ) && 1604 ( defaultType != TreeAttlistDeclAttributeDef.DEFAULT_TYPE_IMPLIED ) && 1605 ( defaultType != TreeAttlistDeclAttributeDef.DEFAULT_TYPE_FIXED ) ) { 1606 throw new InvalidArgumentException (new Short (defaultType), Util.THIS.getString ("PROP_invalid_attribute_list_declaration_default_type")); 1607 } 1608 } 1609 1610 1612 public boolean isValidAttlistDeclAttributeDefaultType (short defaultType) { 1613 try { 1614 checkAttlistDeclAttributeDefaultType (defaultType); 1615 } catch (InvalidArgumentException exc) { 1616 return false; 1617 } 1618 return true; 1619 } 1620 1621 } 1623 1624 1628 1630 public static final Collection getSupportedEncodings () { 1631 return EncodingUtil.getIANA2JavaMap ().keySet (); 1632 } 1633 1634 1636 public static final String iana2java (String iana) { 1637 String java = (String ) EncodingUtil.getIANA2JavaMap ().get (iana.toUpperCase ()); 1638 return java == null ? iana : java; 1639 } 1640 1641 1642 1645 static class EncodingUtil { 1646 1647 1648 protected final static Map encodingIANA2JavaMap = new TreeMap (); 1649 1650 1651 protected final static Map encodingIANADescriptionMap = new TreeMap (); 1652 1653 1654 protected final static Map encodingIANAAliasesMap = new TreeMap (); 1655 1656 1660 static { 1661 encodingIANA2JavaMap.put ("BIG5", "Big5"); encodingIANADescriptionMap.put ("BIG5", Util.THIS.getString ("NAME_BIG5")); encodingIANAAliasesMap.put ("BIG5", "BIG5"); 1665 encodingIANA2JavaMap.put ("IBM037", "CP037"); encodingIANADescriptionMap.put ("IBM037", Util.THIS.getString ("NAME_IBM037")); encodingIANAAliasesMap.put ("IBM037", "IBM037"); encodingIANAAliasesMap.put ("EBCDIC-CP-US", "IBM037"); encodingIANAAliasesMap.put ("EBCDIC-CP-CA", "IBM037"); encodingIANAAliasesMap.put ("EBCDIC-CP-NL", "IBM037"); encodingIANAAliasesMap.put ("EBCDIC-CP-WT", "IBM037"); 1673 encodingIANA2JavaMap.put ("IBM277", "CP277"); encodingIANADescriptionMap.put ("IBM277", Util.THIS.getString ("NAME_IBM277")); encodingIANAAliasesMap.put ("IBM277", "IBM277"); encodingIANAAliasesMap.put ("EBCDIC-CP-DK", "IBM277"); encodingIANAAliasesMap.put ("EBCDIC-CP-NO", "IBM277"); 1679 encodingIANA2JavaMap.put ("IBM278", "CP278"); encodingIANADescriptionMap.put ("IBM278", Util.THIS.getString ("NAME_IBM277")); encodingIANAAliasesMap.put ("IBM278", "IBM278"); encodingIANAAliasesMap.put ("EBCDIC-CP-FI", "IBM278"); encodingIANAAliasesMap.put ("EBCDIC-CP-SE", "IBM278"); 1685 encodingIANA2JavaMap.put ("IBM280", "CP280"); encodingIANADescriptionMap.put ("IBM280", Util.THIS.getString ("NAME_IBM280")); encodingIANAAliasesMap.put ("IBM280", "IBM280"); encodingIANAAliasesMap.put ("EBCDIC-CP-IT", "IBM280"); 1690 encodingIANA2JavaMap.put ("IBM284", "CP284"); encodingIANADescriptionMap.put ("IBM284", Util.THIS.getString ("NAME_IBM284")); encodingIANAAliasesMap.put ("IBM284", "IBM284"); encodingIANAAliasesMap.put ("EBCDIC-CP-ES", "IBM284"); 1695 encodingIANA2JavaMap.put ("IBM285", "CP285"); encodingIANADescriptionMap.put ("IBM285", Util.THIS.getString ("NAME_IBM285")); encodingIANAAliasesMap.put ("IBM285", "IBM285"); encodingIANAAliasesMap.put ("EBCDIC-CP-GB", "IBM285"); 1700 encodingIANA2JavaMap.put ("IBM297", "CP297"); encodingIANADescriptionMap.put ("IBM297", Util.THIS.getString ("NAME_IBM297")); encodingIANAAliasesMap.put ("IBM297", "IBM297"); encodingIANAAliasesMap.put ("EBCDIC-CP-FR", "IBM297"); 1705 encodingIANA2JavaMap.put ("IBM424", "CP424"); encodingIANADescriptionMap.put ("IBM424", Util.THIS.getString ("NAME_IBM424")); encodingIANAAliasesMap.put ("IBM424", "IBM424"); encodingIANAAliasesMap.put ("EBCDIC-CP-HE", "IBM424"); 1710 encodingIANA2JavaMap.put ("IBM500", "CP500"); encodingIANADescriptionMap.put ("IBM500", Util.THIS.getString ("NAME_IBM500")); encodingIANAAliasesMap.put ("IBM500", "IBM500"); encodingIANAAliasesMap.put ("EBCDIC-CP-CH", "IBM500"); encodingIANAAliasesMap.put ("EBCDIC-CP-BE", "IBM500"); 1716 encodingIANA2JavaMap.put ("IBM870", "CP870"); encodingIANADescriptionMap.put ("IBM870", Util.THIS.getString ("NAME_IBM870")); encodingIANAAliasesMap.put ("IBM870", "IBM870"); encodingIANAAliasesMap.put ("EBCDIC-CP-ROECE", "IBM870"); encodingIANAAliasesMap.put ("EBCDIC-CP-YU", "IBM870"); 1722 encodingIANA2JavaMap.put ("IBM871", "CP871"); encodingIANADescriptionMap.put ("IBM871", Util.THIS.getString ("NAME_IBM871")); encodingIANAAliasesMap.put ("IBM871", "IBM871"); encodingIANAAliasesMap.put ("EBCDIC-CP-IS", "IBM871"); 1727 encodingIANA2JavaMap.put ("IBM918", "CP918"); encodingIANADescriptionMap.put ("IBM918", Util.THIS.getString ("NAME_IBM918")); encodingIANAAliasesMap.put ("IBM918", "IBM918"); encodingIANAAliasesMap.put ("EBCDIC-CP-AR2", "IBM918"); 1732 encodingIANA2JavaMap.put ("EUC-JP", "EUCJIS"); encodingIANADescriptionMap.put ("EUC-JP", Util.THIS.getString ("NAME_EUC-JP")); encodingIANAAliasesMap.put ("EUC-JP", "EUC-JP"); 1736 encodingIANA2JavaMap.put ("EUC-KR", "KSC5601"); encodingIANADescriptionMap.put ("EUC-KR", Util.THIS.getString ("NAME_EUC-KR")); encodingIANAAliasesMap.put ("EUC-KR", "EUC-KR"); 1740 encodingIANA2JavaMap.put ("GB2312", "GB2312"); encodingIANADescriptionMap.put ("GB2312", Util.THIS.getString ("NAME_GB2312")); encodingIANAAliasesMap.put ("GB2312", "GB2312"); 1744 encodingIANA2JavaMap.put ("ISO-2022-JP", "JIS"); encodingIANADescriptionMap.put ("ISO-2022-JP", Util.THIS.getString ("NAME_ISO-2022-JP")); encodingIANAAliasesMap.put ("ISO-2022-JP", "ISO-2022-JP"); 1748 encodingIANA2JavaMap.put ("ISO-2022-KR", "ISO2022KR"); encodingIANADescriptionMap.put ("ISO-2022-KR", Util.THIS.getString ("NAME_ISO-2022-KR")); encodingIANAAliasesMap.put ("ISO-2022-KR", "ISO-2022-KR"); 1752 encodingIANA2JavaMap.put ("ISO-8859-1", "8859_1"); encodingIANADescriptionMap.put ("ISO-8859-1", Util.THIS.getString ("NAME_ISO-8859-1")); encodingIANAAliasesMap.put ("ISO-8859-1", "ISO-8859-1"); encodingIANAAliasesMap.put ("LATIN1", "ISO-8859-1"); encodingIANAAliasesMap.put ("L1", "ISO-8859-1"); encodingIANAAliasesMap.put ("IBM819", "ISO-8859-1"); encodingIANAAliasesMap.put ("CP819", "ISO-8859-1"); 1760 encodingIANA2JavaMap.put ("ISO-8859-2", "8859_2"); encodingIANADescriptionMap.put ("ISO-8859-2", Util.THIS.getString ("NAME_ISO-8859-2")); encodingIANAAliasesMap.put ("ISO-8859-2", "ISO-8859-2"); encodingIANAAliasesMap.put ("LATIN2", "ISO-8859-2"); encodingIANAAliasesMap.put ("L2", "ISO-8859-2"); 1766 encodingIANA2JavaMap.put ("ISO-8859-3", "8859_3"); encodingIANADescriptionMap.put ("ISO-8859-3", Util.THIS.getString ("NAME_ISO-8859-3")); encodingIANAAliasesMap.put ("ISO-8859-3", "ISO-8859-3"); encodingIANAAliasesMap.put ("LATIN3", "ISO-8859-3"); encodingIANAAliasesMap.put ("L3", "ISO-8859-3"); 1772 encodingIANA2JavaMap.put ("ISO-8859-4", "8859_4"); encodingIANADescriptionMap.put ("ISO-8859-4", Util.THIS.getString ("NAME_ISO-8859-4")); encodingIANAAliasesMap.put ("ISO-8859-4", "ISO-8859-4"); encodingIANAAliasesMap.put ("LATIN4", "ISO-8859-4"); encodingIANAAliasesMap.put ("L4", "ISO-8859-4"); 1778 encodingIANA2JavaMap.put ("ISO-8859-5", "8859_5"); encodingIANADescriptionMap.put ("ISO-8859-5", Util.THIS.getString ("NAME_ISO-8859-5")); encodingIANAAliasesMap.put ("ISO-8859-5", "ISO-8859-5"); encodingIANAAliasesMap.put ("CYRILLIC", "ISO-8859-5"); 1783 encodingIANA2JavaMap.put ("ISO-8859-6", "8859_6"); encodingIANADescriptionMap.put ("ISO-8859-6", Util.THIS.getString ("NAME_ISO-8859-6")); encodingIANAAliasesMap.put ("ISO-8859-6", "ISO-8859-6"); 1787 encodingIANA2JavaMap.put ("ISO-8859-7", "8859_7"); encodingIANADescriptionMap.put ("ISO-8859-7", Util.THIS.getString ("NAME_ISO-8859-7")); encodingIANAAliasesMap.put ("ISO-8859-7", "ISO-8859-7"); encodingIANAAliasesMap.put ("GREEK", "ISO-8859-7"); encodingIANAAliasesMap.put ("GREEK8", "ISO-8859-7"); 1793 encodingIANA2JavaMap.put ("ISO-8859-8", "8859_8"); encodingIANADescriptionMap.put ("ISO-8859-8", Util.THIS.getString ("NAME_ISO-8859-8")); encodingIANAAliasesMap.put ("ISO-8859-8", "ISO-8859-8"); encodingIANAAliasesMap.put ("HEBREW", "ISO-8859-8"); 1798 encodingIANA2JavaMap.put ("ISO-8859-9", "8859_9"); encodingIANADescriptionMap.put ("ISO-8859-9", Util.THIS.getString ("NAME_ISO-8859-9")); encodingIANAAliasesMap.put ("ISO-8859-9", "ISO-8859-9"); encodingIANAAliasesMap.put ("LATIN5", "ISO-8859-9"); encodingIANAAliasesMap.put ("L5", "ISO-8859-9"); 1804 encodingIANA2JavaMap.put ("KOI8-R", "KOI8_R"); encodingIANADescriptionMap.put ("KOI8-R", Util.THIS.getString ("NAME_KOI8-R")); encodingIANAAliasesMap.put ("KOI8-R", "KOI8-R"); 1808 encodingIANA2JavaMap.put ("US-ASCII", "8859_1"); encodingIANADescriptionMap.put ("US-ASCII", Util.THIS.getString ("NAME_ASCII")); encodingIANAAliasesMap.put ("ASCII", "US-ASCII"); encodingIANAAliasesMap.put ("US-ASCII", "US-ASCII"); encodingIANAAliasesMap.put ("ISO646-US", "US-ASCII"); encodingIANAAliasesMap.put ("IBM367", "US-ASCII"); encodingIANAAliasesMap.put ("CP367", "US-ASCII"); 1816 encodingIANA2JavaMap.put ("UTF-8", "UTF8"); encodingIANADescriptionMap.put ("UTF-8", Util.THIS.getString ("NAME_UTF-8")); encodingIANAAliasesMap.put ("UTF-8", "UTF-8"); 1820 encodingIANA2JavaMap.put ("UTF-16", "Unicode"); encodingIANADescriptionMap.put ("UTF-16", Util.THIS.getString ("NAME_UTF-16")); encodingIANAAliasesMap.put ("UTF-16", "UTF-16"); } 1824 1825 1826 1828 public static Map getIANA2JavaMap () { 1829 return encodingIANA2JavaMap; 1830 } 1831 1832 } 1834} 1835 | Popular Tags |