I do not have cvs, but the following code was inserted in the method
createStartTag in ElementAttributes.java
iStartPos is defined as an int in this method;
iStartPos = out.length();
out.append(alterCase(attr));
if ( !value.equalsIgnoreCase(NO_ATTRIBUTE_VALUE) )
{
// we have a value
// we might still enclose in quotes
boolean quoteThisAttribute = attribute_quote;
int singleQuoteFound = 0;
int doubleQuoteFound = 0;
if ( value.length() == 0 )
{ // quote a null string
quoteThisAttribute = true;
}
for ( int ii = 0; ii < value.length(); ii++ )
{
char c = value.charAt( ii );
if ( 'a' <= c && c <= 'z' )
{
continue;
}
if ( 'A' <= c && c <= 'Z' )
{
continue;
}
if ( '0' <= c && c <= '9' )
{
continue;
}
if ( c == ':' ||
c == '-' ||
c == '_' ||
c == '.' )
{
continue;
}
if ( c == '\'' )
{
singleQuoteFound++;
}
if ( c == '"' )
{
doubleQuoteFound++;
}
quoteThisAttribute = true;
}
out.append( getAttributeEqualitySign() );
if ( !quoteThisAttribute )
{ // no need to append quotes
out.append( value );
}
else
{ // use single quotes if possible
if ( singleQuoteFound == 0 )
{ // no single quotes, safe to use them to quote
out.append( '\'' );
out.append( value );
out.append( '\'' );
}
else
if ( doubleQuoteFound == 0 )
{ // no double quotes, safe to use them to quote
out.append( '"' );
out.append( value );
out.append( '"' );
}
else if ( singleQuoteFound <= doubleQuoteFound )
{ // use single quotes, convert embedded single quotes
out.append( '\'' );
int startPos = out.length();
out.append( value );
for ( int ii = startPos; ii < out.length(); ii++ )
{ // note out.length() may change during processing
if ( out.charAt( ii ) == '\'' )
{
out.setCharAt( ii, '&');
out.insert( ii+1, "#39;" );
ii++;
}
}
out.append( '\'' );
}
else
{ // use double quotes, convert embedded double quotes
out.append( '"' );
int startPos = out.length();
out.append( value );
for ( int ii = startPos; ii < out.length(); ii++ )
{ // note out.length() may change during processing
if ( out.charAt( ii ) == '"' )
{
out.setCharAt( ii, '&');
out.insert( ii+1, "#34;" );
ii++;
}
}
out.append( '"' );
}
}
}
and replaces the following code:
*** replaced code starts
if(!value.equalsIgnoreCase(NO_ATTRIBUTE_VALUE) &&
getAttributeQuote())
{
out.append(getAttributeEqualitySign());
out.append(getAttributeQuoteChar());
out.append(value);
out.append(getAttributeQuoteChar());
}
else if( !getAttributeQuote() )
{
out.append(getAttributeEqualitySign());
out.append(value);
}
*** replaced code ends
If this should be posted elsewhere, please advise.
Hackmann
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]