100 * Important point: 101 * 1. We are not exposing Xerces namespace property. Application should configure namespace through 102 * Stax specific property. 103 * 104 */ 105 private void initConfigurableReaderProperties(){ 106 //spec default values 107 supportedProps.put(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE); 108 supportedProps.put(XMLInputFactory.IS_VALIDATING, Boolean.FALSE); 109 supportedProps.put(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE); 110 supportedProps.put(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.TRUE); 111 supportedProps.put(XMLInputFactory.IS_COALESCING, Boolean.FALSE); 112 supportedProps.put(XMLInputFactory.SUPPORT_DTD, Boolean.TRUE); 113 supportedProps.put(XMLInputFactory.REPORTER, null); 114 supportedProps.put(XMLInputFactory.RESOLVER, null); 115 supportedProps.put(XMLInputFactory.ALLOCATOR, null); 116 supportedProps.put(STAX_NOTATIONS,null ); 117 118 //zephyr (implementation) specific properties which can be set by the application. 119 //interning is always done 120 supportedProps.put(Constants.SAX_FEATURE_PREFIX + Constants.STRING_INTERNING_FEATURE , new Boolean(true)); 121 //recognizing java encoding names by default 122 supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.ALLOW_JAVA_ENCODINGS_FEATURE, new Boolean(true)) ; 123 //in stax mode, namespace declarations are not added as attributes 124 supportedProps.put(Constants.ADD_NAMESPACE_DECL_AS_ATTRIBUTE , Boolean.FALSE) ; 125 supportedProps.put(Constants.READER_IN_DEFINED_STATE, new Boolean(true)); 126 supportedProps.put(Constants.REUSE_INSTANCE, new Boolean(true)); 127 supportedProps.put(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT , new Boolean(false)); 128 supportedProps.put(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD, Boolean.FALSE); 129 supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE, new Boolean(false)); 130 supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE, new Boolean(false)); 131 supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE, new Boolean(false)); 132 133 fSecurityManager = new XMLSecurityManager(true); 134 supportedProps.put(SECURITY_MANAGER, fSecurityManager); 135 fSecurityPropertyMgr = new XMLSecurityPropertyManager(); 136 supportedProps.put(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); 137 } 138 139 private void initWriterProps(){ 140 supportedProps.put(XMLOutputFactory.IS_REPAIRING_NAMESPACES , Boolean.FALSE); 141 //default value of escaping characters is 'true' 142 supportedProps.put(Constants.ESCAPE_CHARACTERS , Boolean.TRUE); 143 supportedProps.put(Constants.REUSE_INSTANCE, new Boolean(true)); 144 } 145 146 /** 147 * public void reset(){ 148 * supportedProps.clear() ; 149 * } 150 */ 151 public boolean containsProperty(String property){ 152 return supportedProps.containsKey(property) || 153 (fSecurityManager != null && fSecurityManager.getIndex(property) > -1) || 154 (fSecurityPropertyMgr!=null && fSecurityPropertyMgr.getIndex(property) > -1) ; 155 } 156 157 public Object getProperty(String property){ 158 return supportedProps.get(property); 159 } 160 161 public void setProperty(String property, Object value){ 162 String equivalentProperty = null ; 163 if(property == XMLInputFactory.IS_NAMESPACE_AWARE || property.equals(XMLInputFactory.IS_NAMESPACE_AWARE)){ | 100 * Important point: 101 * 1. We are not exposing Xerces namespace property. Application should configure namespace through 102 * Stax specific property. 103 * 104 */ 105 private void initConfigurableReaderProperties(){ 106 //spec default values 107 supportedProps.put(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE); 108 supportedProps.put(XMLInputFactory.IS_VALIDATING, Boolean.FALSE); 109 supportedProps.put(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE); 110 supportedProps.put(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.TRUE); 111 supportedProps.put(XMLInputFactory.IS_COALESCING, Boolean.FALSE); 112 supportedProps.put(XMLInputFactory.SUPPORT_DTD, Boolean.TRUE); 113 supportedProps.put(XMLInputFactory.REPORTER, null); 114 supportedProps.put(XMLInputFactory.RESOLVER, null); 115 supportedProps.put(XMLInputFactory.ALLOCATOR, null); 116 supportedProps.put(STAX_NOTATIONS,null ); 117 118 //zephyr (implementation) specific properties which can be set by the application. 119 //interning is always done 120 supportedProps.put(Constants.SAX_FEATURE_PREFIX + Constants.STRING_INTERNING_FEATURE , Boolean.TRUE); 121 //recognizing java encoding names by default 122 supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.ALLOW_JAVA_ENCODINGS_FEATURE, Boolean.TRUE) ; 123 //in stax mode, namespace declarations are not added as attributes 124 supportedProps.put(Constants.ADD_NAMESPACE_DECL_AS_ATTRIBUTE , Boolean.FALSE) ; 125 supportedProps.put(Constants.READER_IN_DEFINED_STATE, Boolean.TRUE); 126 supportedProps.put(Constants.REUSE_INSTANCE, Boolean.TRUE); 127 supportedProps.put(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT , Boolean.FALSE); 128 supportedProps.put(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD, Boolean.FALSE); 129 supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE, Boolean.FALSE); 130 supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE, Boolean.FALSE); 131 supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE, Boolean.FALSE); 132 133 fSecurityManager = new XMLSecurityManager(true); 134 supportedProps.put(SECURITY_MANAGER, fSecurityManager); 135 fSecurityPropertyMgr = new XMLSecurityPropertyManager(); 136 supportedProps.put(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); 137 } 138 139 private void initWriterProps(){ 140 supportedProps.put(XMLOutputFactory.IS_REPAIRING_NAMESPACES , Boolean.FALSE); 141 //default value of escaping characters is 'true' 142 supportedProps.put(Constants.ESCAPE_CHARACTERS , Boolean.TRUE); 143 supportedProps.put(Constants.REUSE_INSTANCE, Boolean.TRUE); 144 } 145 146 /** 147 * public void reset(){ 148 * supportedProps.clear() ; 149 * } 150 */ 151 public boolean containsProperty(String property){ 152 return supportedProps.containsKey(property) || 153 (fSecurityManager != null && fSecurityManager.getIndex(property) > -1) || 154 (fSecurityPropertyMgr!=null && fSecurityPropertyMgr.getIndex(property) > -1) ; 155 } 156 157 public Object getProperty(String property){ 158 return supportedProps.get(property); 159 } 160 161 public void setProperty(String property, Object value){ 162 String equivalentProperty = null ; 163 if(property == XMLInputFactory.IS_NAMESPACE_AWARE || property.equals(XMLInputFactory.IS_NAMESPACE_AWARE)){ |