fixed numeric entities

git-svn-id: svn://10.0.0.236/trunk@1424 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg
1998-05-11 23:28:01 +00:00
parent 08ea7302b4
commit d279bd9b90
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;
}