fixed numeric entities

This commit is contained in:
rickg
1998-05-11 23:28:01 +00:00
parent 0ef821229d
commit e83c9b0502
4 changed files with 46 additions and 26 deletions

View File

@@ -939,8 +939,8 @@ CEntityToken::CEntityToken(const nsString& aName) : CHTMLToken(aName) {
* @return error result
*/
PRInt32 CEntityToken::Consume(PRUnichar aChar, CScanner& aScanner) {
mTextValue=aChar;
if(aChar)
mTextValue=aChar;
PRInt32 result=ConsumeEntity(aChar,mTextValue,aScanner);
return result;
};
@@ -1013,17 +1013,27 @@ PRInt32 CEntityToken::ConsumeEntity(PRUnichar aChar,nsString& aString,CScanner&
* @return
*/
PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) {
char* cp = mTextValue.ToNewCString();
PRInt32 index=FindEntityIndex(cp);
if(kNotFound!=index) {
PRUnichar ch=gStrToUnicodeTable[index].fValue;
aString=ch;
} else {
#ifdef GESS_MACHINE
index=TranslateExtendedEntity(cp,aString);
#endif
PRInt32 index=0;
if(aString.IsDigit(mTextValue[0])) {
PRInt32 err=0;
index=mTextValue.ToInteger(&err);
if(0==err)
aString.Append(PRUnichar(index));
}
else {
char* cp = mTextValue.ToNewCString();
index=FindEntityIndex(cp);
if(kNotFound!=index) {
PRUnichar ch=gStrToUnicodeTable[index].fValue;
aString=ch;
}
else {
#ifdef GESS_MACHINE
index=TranslateExtendedEntity(cp,aString);
#endif
}
delete cp;
}
delete cp;
return index;
}