Associates an integer value with a style or attribute name or tag.
protected boolean registerName( String strName, int key )
strName
The tag, attribute name, or style name.
key
The key you want to associate with that value. It cannot be -1 because this is what is passed to these functions when the key is not registered.
Returns true if the name was successfully registered, or returns false if -1 is used or the key is already assigned to another name.
If registered, you will receive this value with the name in calls to onTagGenerate, onAttrGenerate, and onStyleGenerate. Registering a key allows you to avoid string comparison in your handler functions.
The following is an example of this method:
public class MyHTMLGenerator{ public final static TAG_BR = 0; public final static TAG_DIV = 1; public MyHTMLGenerator(){ registerName( "BR", TAG_BR ); registerName( "DIV", TAG_DIV ); } // ... public boolean onTagGenerate( int key, String strTagName ){ switch ( key ){ case TAG_BR: case TAG_DIV: setTagName( "P" ); return false; break; } return true; } }