public void setAttribute ( String name , Object value ) throws IllegalArgumentException { if ( name . equals ( FEATURE_INCREMENTAL ) ) { if ( value instanceof Boolean ) { // Accept a Boolean object.. m_incremental = ( ( Boolean ) value ) . booleanValue ( ) ; } else if ( value instanceof String ) { // .. or a String object m_incremental = ( new Boolean ( ( String ) value ) ) . booleanValue ( ) ; } else { // Give a more meaningful error message throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_BAD_VALUE , new Object [ ] { name , value } ) ) ; //name + " bad value " + value); } } else if ( name . equals ( FEATURE_OPTIMIZE ) ) { if ( value instanceof Boolean ) { // Accept a Boolean object.. m_optimize = ( ( Boolean ) value ) . booleanValue ( ) ; } else if ( value instanceof String ) { // .. or a String object m_optimize = ( new Boolean ( ( String ) value ) ) . booleanValue ( ) ; } else { // Give a more meaningful error message throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_BAD_VALUE , new Object [ ] { name , value } ) ) ; //name + " bad value " + value); } } // Custom Xalan feature: annotate DTM with SAX source locator fields. // This gets used during SAX2DTM instantiation. // // %REVIEW% Should the name of this field really be in XalanProperties? // %REVIEW% I hate that it's a global static, but didn't want to change APIs yet. else if ( name . equals ( FEATURE_SOURCE_LOCATION ) ) { if ( value instanceof Boolean ) { // Accept a Boolean object.. m_source_location = ( ( Boolean ) value ) . booleanValue ( ) ; } else if ( value instanceof String ) { // .. or a String object m_source_location = ( new Boolean ( ( String ) value ) ) . booleanValue ( ) ; } else { // Give a more meaningful error message throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_BAD_VALUE , new Object [ ] { name , value } ) ) ; //name + " bad value " + value); } } else { throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_NOT_SUPPORTED , new Object [ ] { name } ) ) ; //name + "not supported"); } }
Allows the user to set specific attributes on the underlying implementation .