Removed the compile flag check for enabling expat, James Clark's XML parser. Now, expat can be enabled dynamically at run-time on the Windows and Unix platforms by setting the EXPAT environment variable to 1. On the Mac, create a file called EXPAT in the directory from which you run viewer.exe or apprunner.exe. This dynamic switch is only temporary. Once the bugs associated with expat's parsing of XUL files or XML errors in the XUL files are fixed, the expat parser will become the default.

This commit is contained in:
nisheeth%netscape.com 1999-03-30 06:29:50 +00:00
Родитель 3f8393527a
Коммит 1cd4ad8964
2 изменённых файлов: 36 добавлений и 20 удалений

Просмотреть файл

@ -36,10 +36,7 @@
#include "nsIHTMLContentSink.h"
#include "nsHTMLTokenizer.h"
#include "nsXMLTokenizer.h"
#ifdef EXPAT
#include "nsExpatTokenizer.h"
#endif
#include "prenv.h" //this is here for debug reasons...
#include "prtypes.h" //this is here for debug reasons...
@ -50,7 +47,7 @@
#include <direct.h> //this is here for debug reasons...
#endif
#include "prmem.h"
#include "nsSpecialSystemDirectory.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
@ -330,20 +327,31 @@ nsITokenRecycler* CWellFormedDTD::GetTokenRecycler(void){
nsITokenizer* CWellFormedDTD::GetTokenizer(void) {
if(!mTokenizer) {
PRBool theExpatState=PR_FALSE;
#ifdef EXPAT
#ifndef XP_MAC
char* theEnvString = PR_GetEnv("EXPAT");
if(theEnvString){
if(('1'==theEnvString[0]) || ('Y'==toupper(theEnvString[0]))) {
theExpatState=PR_TRUE; //this indicates that the EXPAT flag was found in the environment.
}
}
if(theExpatState)
mTokenizer=(nsHTMLTokenizer*)new nsExpatTokenizer();
else mTokenizer=(nsHTMLTokenizer*)new nsXMLTokenizer();
#else
mTokenizer=(nsHTMLTokenizer*)new nsXMLTokenizer();
// Check for the existence of a file called EXPAT in the current directory
nsSpecialSystemDirectory expatFile(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
expatFile += "EXPAT";
theExpatState = expatFile.Exists();
#endif
if(theExpatState) {
mTokenizer=(nsHTMLTokenizer*)new nsExpatTokenizer();
#ifdef DEBUG
printf("Using Expat for parsing XML...\n");
#endif
}
else {
mTokenizer=(nsHTMLTokenizer*)new nsXMLTokenizer();
#ifdef DEBUG
printf("Using internal parser for parsing XML...\n");
#endif
}
}
return mTokenizer;
}

Просмотреть файл

@ -36,10 +36,7 @@
#include "nsIHTMLContentSink.h"
#include "nsHTMLTokenizer.h"
#include "nsXMLTokenizer.h"
#ifdef EXPAT
#include "nsExpatTokenizer.h"
#endif
#include "prenv.h" //this is here for debug reasons...
#include "prtypes.h" //this is here for debug reasons...
@ -50,7 +47,7 @@
#include <direct.h> //this is here for debug reasons...
#endif
#include "prmem.h"
#include "nsSpecialSystemDirectory.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
@ -330,20 +327,31 @@ nsITokenRecycler* CWellFormedDTD::GetTokenRecycler(void){
nsITokenizer* CWellFormedDTD::GetTokenizer(void) {
if(!mTokenizer) {
PRBool theExpatState=PR_FALSE;
#ifdef EXPAT
#ifndef XP_MAC
char* theEnvString = PR_GetEnv("EXPAT");
if(theEnvString){
if(('1'==theEnvString[0]) || ('Y'==toupper(theEnvString[0]))) {
theExpatState=PR_TRUE; //this indicates that the EXPAT flag was found in the environment.
}
}
if(theExpatState)
mTokenizer=(nsHTMLTokenizer*)new nsExpatTokenizer();
else mTokenizer=(nsHTMLTokenizer*)new nsXMLTokenizer();
#else
mTokenizer=(nsHTMLTokenizer*)new nsXMLTokenizer();
// Check for the existence of a file called EXPAT in the current directory
nsSpecialSystemDirectory expatFile(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
expatFile += "EXPAT";
theExpatState = expatFile.Exists();
#endif
if(theExpatState) {
mTokenizer=(nsHTMLTokenizer*)new nsExpatTokenizer();
#ifdef DEBUG
printf("Using Expat for parsing XML...\n");
#endif
}
else {
mTokenizer=(nsHTMLTokenizer*)new nsXMLTokenizer();
#ifdef DEBUG
printf("Using internal parser for parsing XML...\n");
#endif
}
}
return mTokenizer;
}