nsresult ConsumeAttributeEntity(nsString& aString,
nsresult ConsumeAttributeEntity(nsScannerSharedSubstring& aString,
nsresult ConsumeAttributeEntity(nsString& aString,                                nsScanner& aScanner,                                PRInt32 aFlag) {   nsresult result=NS_OK;  PRUnichar ch;  result=aScanner.Peek(ch, 1);  if (NS_SUCCEEDED(result)) {    PRUnichar amp=0;    PRInt32 theNCRValue=0;    nsAutoString entity;    if (nsCRT::IsAsciiAlpha(ch) && !(aFlag & NS_IPARSER_FLAG_VIEW_SOURCE)) {      result=CEntityToken::ConsumeEntity(ch,entity,aScanner);      if (NS_SUCCEEDED(result)) {        theNCRValue = nsHTMLEntities::EntityToUnicode(entity);        PRUnichar theTermChar=entity.Last();        // If an entity value is greater than 255 then:        // Nav 4.x does not treat it as an entity,        // IE treats it as an entity if terminated with a semicolon.        // Resembling IE!!        if(theNCRValue < 0 || (theNCRValue > 255 && theTermChar != ';')) {          // Looks like we're not dealing with an entity          aString.Append(kAmpersand);          aString.Append(entity);        }        else {          // A valid entity so reduce it.          aString.Append(PRUnichar(theNCRValue));        }      }    }    else if (ch==kHashsign && !(aFlag & NS_IPARSER_FLAG_VIEW_SOURCE)) {      result=CEntityToken::ConsumeEntity(ch,entity,aScanner);      if (NS_SUCCEEDED(result)) {        if (result == NS_HTMLTOKENS_NOT_AN_ENTITY) {          // Looked like an entity but it's not          aScanner.GetChar(amp);          aString.Append(amp);          result = NS_OK; // just being safe..        }        else {          PRInt32 err;          theNCRValue=entity.ToInteger(&err,kAutoDetect);          AppendNCR(aString, theNCRValue);        }      }    }    else {      // What we thought as entity is not really an entity...      aScanner.GetChar(amp);      aString.Append(amp);    }//if  }  return result;}