1 57 58 package com.sun.org.apache.xerces.internal.impl; 59 60 import java.util.Enumeration ; 61 import java.util.NoSuchElementException ; 62 63 70 public final class Constants { 71 72 public static final String NS_XMLSCHEMA = "http://www.w3.org/2001/XMLSchema".intern(); 77 public static final String NS_DTD = "http://www.w3.org/TR/REC-xml".intern(); 78 79 81 82 public static final String SAX_FEATURE_PREFIX = "http://xml.org/sax/features/"; 83 84 85 86 public static final String NAMESPACES_FEATURE = "namespaces"; 87 88 89 public static final String NAMESPACE_PREFIXES_FEATURE = "namespace-prefixes"; 90 91 92 public static final String STRING_INTERNING_FEATURE = "string-interning"; 93 94 95 public static final String VALIDATION_FEATURE = "validation"; 96 97 98 public static final String EXTERNAL_GENERAL_ENTITIES_FEATURE = "external-general-entities"; 99 100 101 public static final String EXTERNAL_PARAMETER_ENTITIES_FEATURE = "external-parameter-entities"; 102 103 104 public static final String LEXICAL_HANDLER_PARAMETER_ENTITIES_FEATURE = "lexical-handler/parameter-entities"; 105 106 107 public static final String IS_STANDALONE_FEATURE = "is-standalone"; 108 109 110 public static final String RESOLVE_DTD_URIS_FEATURE = "resolve-dtd-uris"; 111 112 113 public static final String USE_ATTRIBUTES2_FEATURE = "use-attributes2"; 114 115 116 public static final String USE_LOCATOR2_FEATURE = "use-locator2"; 117 118 119 public static final String USE_ENTITY_RESOLVER2_FEATURE = "use-entity-resolver2"; 120 121 122 public static final String UNICODE_NORMALIZATION_CHECKING_FEATURE = "unicode-normalization-checking"; 123 124 125 public static final String XMLNS_URIS_FEATURE = "xmlns-uris"; 126 127 128 public static final String XML_11_FEATURE = "xml-1.1"; 129 130 131 public static final String ALLOW_DTD_EVENTS_AFTER_ENDDTD_FEATURE = "allow-dtd-events-after-endDTD"; 132 133 135 136 public static final String SAX_PROPERTY_PREFIX = "http://xml.org/sax/properties/"; 137 138 139 public static final String DECLARATION_HANDLER_PROPERTY = "declaration-handler"; 140 141 142 public static final String LEXICAL_HANDLER_PROPERTY = "lexical-handler"; 143 144 145 public static final String DOM_NODE_PROPERTY = "dom-node"; 146 147 148 public static final String XML_STRING_PROPERTY = "xml-string"; 149 150 public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing"; 151 152 153 public static final String DOCUMENT_XML_VERSION_PROPERTY = "document-xml-version"; 154 155 156 160 161 public static final String JAXP_PROPERTY_PREFIX = 162 "http://java.sun.com/xml/jaxp/properties/"; 163 164 165 public static final String SCHEMA_SOURCE = "schemaSource"; 166 167 168 public static final String SCHEMA_LANGUAGE = "schemaLanguage"; 169 170 public static final String SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ; 171 172 176 177 public static final String INCLUDE_COMMENTS_FEATURE = "include-comments"; 178 179 180 public static final String CREATE_CDATA_NODES_FEATURE = "create-cdata-nodes"; 181 182 183 public static final String LOAD_AS_INFOSET = "load-as-infoset"; 184 185 186 190 public static final String DOM_CANONICAL_FORM = "canonical-form"; 191 public static final String DOM_CDATA_SECTIONS ="cdata-sections"; 192 public static final String DOM_COMMENTS = "comments"; 193 194 public static final String DOM_CHARSET_OVERRIDES_XML_ENCODING = 196 "charset-overrides-xml-encoding"; 197 198 public static final String DOM_DATATYPE_NORMALIZATION = "datatype-normalization"; 199 public static final String DOM_ENTITIES = "entities"; 200 public static final String DOM_INFOSET = "infoset"; 201 public static final String DOM_NAMESPACES = "namespaces"; 202 public static final String DOM_NAMESPACE_DECLARATIONS = "namespace-declarations"; 203 public static final String DOM_SUPPORTED_MEDIATYPES_ONLY = 204 "supported-media-types-only"; 205 206 public static final String DOM_VALIDATE_IF_SCHEMA = "validate-if-schema"; 207 public static final String DOM_VALIDATE = "validate"; 208 public static final String DOM_ELEMENT_CONTENT_WHITESPACE = 209 "element-content-whitespace"; 210 211 public static final String DOM_DISCARD_DEFAULT_CONTENT = "discard-default-content"; 213 public static final String DOM_NORMALIZE_CHARACTERS = "normalize-characters"; 214 public static final String DOM_CHECK_CHAR_NORMALIZATION = "check-character-normalization"; 215 public static final String DOM_WELLFORMED = "well-formed"; 216 public static final String DOM_SPLIT_CDATA = "split-cdata-sections"; 217 218 public static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print"; 220 public static final String DOM_XMLDECL = "xml-declaration"; 221 public static final String DOM_UNKNOWNCHARS = "unknown-characters"; 222 public static final String DOM_CERTIFIED = "certified"; 223 public static final String DOM_DISALLOW_DOCTYPE = "disallow-doctype"; 224 public static final String DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS = "ignore-unknown-character-denormalizations"; 225 226 public static final String DOM_RESOURCE_RESOLVER = "resource-resolver"; 228 public static final String DOM_ERROR_HANDLER = "error-handler"; 229 public static final String DOM_SCHEMA_TYPE = "schema-type"; 230 public static final String DOM_SCHEMA_LOCATION = "schema-location"; 231 232 public static final String DOM_PSVI = "psvi"; 234 235 236 238 239 public static final String XERCES_FEATURE_PREFIX = "http://apache.org/xml/features/"; 240 241 242 public static final String SCHEMA_VALIDATION_FEATURE = "validation/schema"; 243 244 245 public static final String SCHEMA_NORMALIZED_VALUE = "validation/schema/normalized-value"; 246 247 248 public static final String SCHEMA_ELEMENT_DEFAULT = "validation/schema/element-default"; 249 250 251 public static final String SCHEMA_FULL_CHECKING = "validation/schema-full-checking"; 252 253 254 public static final String SCHEMA_AUGMENT_PSVI = "validation/schema/augment-psvi"; 255 256 257 public static final String DYNAMIC_VALIDATION_FEATURE = "validation/dynamic"; 258 259 260 public static final String WARN_ON_DUPLICATE_ATTDEF_FEATURE = "validation/warn-on-duplicate-attdef"; 261 262 263 public static final String WARN_ON_UNDECLARED_ELEMDEF_FEATURE = "validation/warn-on-undeclared-elemdef"; 264 265 266 public static final String WARN_ON_DUPLICATE_ENTITYDEF_FEATURE = "warn-on-duplicate-entitydef"; 267 268 269 public static final String ALLOW_JAVA_ENCODINGS_FEATURE = "allow-java-encodings"; 270 271 272 public static final String DISALLOW_DOCTYPE_DECL_FEATURE = "disallow-doctype-decl"; 273 274 275 public static final String CONTINUE_AFTER_FATAL_ERROR_FEATURE = "continue-after-fatal-error"; 276 277 278 public static final String LOAD_DTD_GRAMMAR_FEATURE = "nonvalidating/load-dtd-grammar"; 279 280 281 public static final String LOAD_EXTERNAL_DTD_FEATURE = "nonvalidating/load-external-dtd"; 282 283 284 public static final String DEFER_NODE_EXPANSION_FEATURE = "dom/defer-node-expansion"; 285 286 287 public static final String CREATE_ENTITY_REF_NODES_FEATURE = "dom/create-entity-ref-nodes"; 288 289 290 public static final String INCLUDE_IGNORABLE_WHITESPACE = "dom/include-ignorable-whitespace"; 291 292 293 public static final String DEFAULT_ATTRIBUTE_VALUES_FEATURE = "validation/default-attribute-values"; 294 295 296 public static final String VALIDATE_CONTENT_MODELS_FEATURE = "validation/validate-content-models"; 297 298 299 public static final String VALIDATE_DATATYPES_FEATURE = "validation/validate-datatypes"; 300 301 302 public static final String NOTIFY_CHAR_REFS_FEATURE = "scanner/notify-char-refs"; 303 304 305 public static final String NOTIFY_BUILTIN_REFS_FEATURE = "scanner/notify-builtin-refs"; 306 307 308 public static final String STANDARD_URI_CONFORMANT_FEATURE = "standard-uri-conformant"; 309 310 315 public static final String PARSER_SETTINGS = "internal/parser-settings"; 316 317 318 public static final String XINCLUDE_AWARE = "xinclude-aware"; 319 320 321 public static final String IGNORE_SCHEMA_LOCATION_HINTS = "validation/schema/ignore-schema-location-hints"; 322 323 328 public static final String CHANGE_IGNORABLE_CHARACTERS_INTO_IGNORABLE_WHITESPACES = 329 "validation/change-ignorable-characters-into-ignorable-whitespaces"; 330 331 333 334 public static final String XERCES_PROPERTY_PREFIX = "http://apache.org/xml/properties/"; 335 336 337 public static final String CURRENT_ELEMENT_NODE_PROPERTY = "dom/current-element-node"; 338 339 340 public static final String DOCUMENT_CLASS_NAME_PROPERTY = "dom/document-class-name"; 341 342 343 public static final String SYMBOL_TABLE_PROPERTY = "internal/symbol-table"; 344 345 346 public static final String ERROR_REPORTER_PROPERTY = "internal/error-reporter"; 347 348 349 public static final String ERROR_HANDLER_PROPERTY = "internal/error-handler"; 350 351 352 public static final String XINCLUDE_HANDLER_PROPERTY = "internal/xinclude-handler"; 353 354 355 public static final String ENTITY_MANAGER_PROPERTY = "internal/entity-manager"; 356 357 358 public static final String BUFFER_SIZE_PROPERTY = "input-buffer-size"; 359 360 361 public static final String SECURITY_MANAGER_PROPERTY = "security-manager"; 362 363 364 protected static final String SECURITY_MANAGER = 365 Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY; 366 367 368 public static final String ENTITY_RESOLVER_PROPERTY = "internal/entity-resolver"; 369 370 371 public static final String XMLGRAMMAR_POOL_PROPERTY = "internal/grammar-pool"; 372 373 374 public static final String DATATYPE_VALIDATOR_FACTORY_PROPERTY = "internal/datatype-validator-factory"; 375 376 377 public static final String DOCUMENT_SCANNER_PROPERTY = "internal/document-scanner"; 378 379 380 public static final String DTD_SCANNER_PROPERTY = "internal/dtd-scanner"; 381 382 383 public static final String DTD_PROCESSOR_PROPERTY = "internal/dtd-processor"; 384 385 386 public static final String VALIDATOR_PROPERTY = "internal/validator"; 387 388 389 public static final String DTD_VALIDATOR_PROPERTY = "internal/validator/dtd"; 390 391 392 public static final String SCHEMA_VALIDATOR_PROPERTY = "internal/validator/schema"; 393 394 395 public static final String SCHEMA_LOCATION = "schema/external-schemaLocation"; 396 397 398 public static final String SCHEMA_NONS_LOCATION = "schema/external-noNamespaceSchemaLocation"; 399 400 401 public static final String NAMESPACE_BINDER_PROPERTY = "internal/namespace-binder"; 402 403 404 public static final String NAMESPACE_CONTEXT_PROPERTY = "internal/namespace-context"; 405 406 407 public static final String VALIDATION_MANAGER_PROPERTY = "internal/validation-manager"; 408 409 410 public static final String XPOINTER_SCHEMA_PROPERTY = "xpointer-schema"; 411 412 414 415 public final static String ELEMENT_PSVI = "ELEMENT_PSVI"; 416 417 418 public final static String ATTRIBUTE_PSVI = "ATTRIBUTE_PSVI"; 419 420 425 public final static String ATTRIBUTE_DECLARED = "ATTRIBUTE_DECLARED"; 426 427 public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit"; 428 429 public final static String MAX_OCCUR_LIMIT = "maxOccurLimit"; 430 431 440 public final static String TYPEINFO = "org.w3c.dom.TypeInfo"; 441 442 450 public final static String ID_ATTRIBUTE = "ID_ATTRIBUTE"; 451 452 454 460 public final static String ENTITY_SKIPPED = "ENTITY_SKIPPED"; 461 462 469 public final static String CHAR_REF_PROBABLE_WS = "CHAR_REF_PROBABLE_WS"; 470 471 public final static short XML_VERSION_1_0 = 1; 473 public final static short XML_VERSION_1_1 = 2; 474 475 476 public final static String ANONYMOUS_TYPE_NAMESPACE = 478 "http://apache.org/xml/xmlschema/1.0/anonymousTypes"; 479 480 482 483 private static final String [] fgSAXFeatures = { 484 NAMESPACES_FEATURE, 485 NAMESPACE_PREFIXES_FEATURE, 486 STRING_INTERNING_FEATURE, 487 VALIDATION_FEATURE, 488 EXTERNAL_GENERAL_ENTITIES_FEATURE, 489 EXTERNAL_PARAMETER_ENTITIES_FEATURE, 490 }; 491 492 493 private static final String [] fgSAXProperties = { 494 DECLARATION_HANDLER_PROPERTY, 495 LEXICAL_HANDLER_PROPERTY, 496 DOM_NODE_PROPERTY, 497 XML_STRING_PROPERTY, 498 }; 499 500 501 private static final String [] fgXercesFeatures = { 502 SCHEMA_VALIDATION_FEATURE, 503 SCHEMA_FULL_CHECKING, 504 DYNAMIC_VALIDATION_FEATURE, 505 WARN_ON_DUPLICATE_ATTDEF_FEATURE, 506 WARN_ON_UNDECLARED_ELEMDEF_FEATURE, 507 ALLOW_JAVA_ENCODINGS_FEATURE, 508 CONTINUE_AFTER_FATAL_ERROR_FEATURE, 509 LOAD_DTD_GRAMMAR_FEATURE, 510 LOAD_EXTERNAL_DTD_FEATURE, 511 CREATE_ENTITY_REF_NODES_FEATURE, 513 XINCLUDE_AWARE, 514 INCLUDE_IGNORABLE_WHITESPACE, 515 DEFAULT_ATTRIBUTE_VALUES_FEATURE, 517 VALIDATE_CONTENT_MODELS_FEATURE, 518 VALIDATE_DATATYPES_FEATURE, 519 NOTIFY_CHAR_REFS_FEATURE, 520 NOTIFY_BUILTIN_REFS_FEATURE, 521 DISALLOW_DOCTYPE_DECL_FEATURE, 522 STANDARD_URI_CONFORMANT_FEATURE 523 }; 524 525 526 private static final String [] fgXercesProperties = { 527 CURRENT_ELEMENT_NODE_PROPERTY, 528 DOCUMENT_CLASS_NAME_PROPERTY, 529 SYMBOL_TABLE_PROPERTY, 530 ERROR_HANDLER_PROPERTY, 531 ERROR_REPORTER_PROPERTY, 532 ENTITY_MANAGER_PROPERTY, 533 ENTITY_RESOLVER_PROPERTY, 534 XMLGRAMMAR_POOL_PROPERTY, 535 DATATYPE_VALIDATOR_FACTORY_PROPERTY, 536 DOCUMENT_SCANNER_PROPERTY, 537 DTD_SCANNER_PROPERTY, 538 VALIDATOR_PROPERTY, 539 SCHEMA_LOCATION, 540 SCHEMA_NONS_LOCATION, 541 VALIDATION_MANAGER_PROPERTY, 542 BUFFER_SIZE_PROPERTY, 543 SECURITY_MANAGER_PROPERTY 544 }; 545 546 547 private static final Enumeration fgEmptyEnumeration = new ArrayEnumeration(new Object [] {}); 548 549 553 554 private Constants() {} 555 556 560 562 563 public static Enumeration getSAXFeatures() { 564 return fgSAXFeatures.length > 0 565 ? new ArrayEnumeration(fgSAXFeatures) : fgEmptyEnumeration; 566 } 568 569 public static Enumeration getSAXProperties() { 570 return fgSAXProperties.length > 0 571 ? new ArrayEnumeration(fgSAXProperties) : fgEmptyEnumeration; 572 } 574 576 577 public static Enumeration getXercesFeatures() { 578 return fgXercesFeatures.length > 0 579 ? new ArrayEnumeration(fgXercesFeatures) : fgEmptyEnumeration; 580 } 582 583 public static Enumeration getXercesProperties() { 584 return fgXercesProperties.length > 0 585 ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration; 586 } 588 592 597 static class ArrayEnumeration 598 implements Enumeration { 599 600 604 605 private Object [] array; 606 607 608 private int index; 609 610 614 615 public ArrayEnumeration(Object [] array) { 616 this.array = array; 617 } 619 623 630 public boolean hasMoreElements() { 631 return index < array.length; 632 } 634 641 public Object nextElement() { 642 if (index < array.length) { 643 return array[index++]; 644 } 645 throw new NoSuchElementException (); 646 } 648 } 650 654 655 public static void main(String [] argv) { 656 657 print("SAX features:", SAX_FEATURE_PREFIX, fgSAXFeatures); 658 print("SAX properties:", SAX_PROPERTY_PREFIX, fgSAXProperties); 659 print("Xerces features:", XERCES_FEATURE_PREFIX, fgXercesFeatures); 660 print("Xerces properties:", XERCES_PROPERTY_PREFIX, fgXercesProperties); 661 662 } 664 665 private static void print(String header, String prefix, Object [] array) { 666 System.out.print(header); 667 if (array.length > 0) { 668 System.out.println(); 669 for (int i = 0; i < array.length; i++) { 670 System.out.print(" "); 671 System.out.print(prefix); 672 System.out.println(array[i]); 673 } 674 } 675 else { 676 System.out.println(" none."); 677 } 678 } 680 } | Popular Tags |