- Enable expat by default. If you run into problems, you can disable expat at run-time by setting NOEXPAT=1 in your environment on Windows and UNIX.

On Mac, create a file called NOEXPAT in the directory from which you run the browser.

- Changed nsExpatTokenizer so that it stops parsing buffers once it sees an XML well-formedness error.


git-svn-id: svn://10.0.0.236/trunk@26804 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nisheeth%netscape.com
1999-04-08 09:21:16 +00:00
parent 82ff5ae768
commit 4cb9ed22c6
6 changed files with 34 additions and 20 deletions

View File

@@ -133,6 +133,7 @@ void nsExpatTokenizer::SetupExpatCallbacks(void) {
nsExpatTokenizer::nsExpatTokenizer() : nsHTMLTokenizer() {
NS_INIT_REFCNT();
mBytesParsed = 0;
mSeenError = PR_FALSE;
mExpatParser = XML_ParserCreate(NULL);
gTokenRecycler=(CTokenRecycler*)GetTokenRecycler();
if (mExpatParser) {
@@ -148,8 +149,10 @@ nsExpatTokenizer::nsExpatTokenizer() : nsHTMLTokenizer() {
* @return
*/
nsExpatTokenizer::~nsExpatTokenizer(){
if (mExpatParser)
XML_ParserFree(mExpatParser);
if (mExpatParser) {
XML_ParserFree(mExpatParser);
mExpatParser = nsnull;
}
}
@@ -232,10 +235,13 @@ nsresult nsExpatTokenizer::ParseXMLBuffer(const char *aBuffer, PRUint32 aLength)
nsresult result=NS_OK;
if (mExpatParser) {
PR_ASSERT(aLength == strlen(aBuffer));
if (!XML_Parse(mExpatParser, aBuffer, aLength, PR_FALSE)) {
PushXMLErrorToken(aBuffer, aLength);
}
mBytesParsed += aLength;
if (!mSeenError) {
if (!XML_Parse(mExpatParser, aBuffer, aLength, PR_FALSE)) {
PushXMLErrorToken(aBuffer, aLength);
mSeenError = PR_TRUE;
}
mBytesParsed += aLength;
}
}
else {
result = NS_ERROR_FAILURE;