private StringBuilder appendAttributeValue ( final String value , final StringBuilder buf ) { if ( value . contains ( "\"" ) ) { buf . append ( "\'" ) . append ( escapeAttribute ( value ) ) . append ( "\'" ) ; } else if ( value . contains ( " " ) || value . contains ( "\'" ) || value . contains ( "=" ) ) { buf . append ( "\"" ) . append ( escapeAttribute ( value ) ) . append ( "\"" ) ; } else { buf . append ( escapeAttribute ( value ) ) ; } return buf ; }
Appends an attribute value with appropriate quoting .