diff --git a/mozilla/htmlparser/macbuild/htmlparser.mcp b/mozilla/htmlparser/macbuild/htmlparser.mcp
index 9d10143f268..6f60e66be7c 100644
Binary files a/mozilla/htmlparser/macbuild/htmlparser.mcp and b/mozilla/htmlparser/macbuild/htmlparser.mcp differ
diff --git a/mozilla/htmlparser/src/MANIFEST b/mozilla/htmlparser/src/MANIFEST
index ce7b04be86e..f48f7a12200 100644
--- a/mozilla/htmlparser/src/MANIFEST
+++ b/mozilla/htmlparser/src/MANIFEST
@@ -21,7 +21,6 @@ nsParserCIID.h
nsHTMLEntities.h
nsHTMLEntityList.h
nsWellFormedDTD.h
-nsExpatDTD.h
nsIExpatTokenizer.h
nsParserError.h
nsIElementObserver.h
diff --git a/mozilla/htmlparser/src/Makefile.in b/mozilla/htmlparser/src/Makefile.in
index 01e466575ad..898eb8869da 100644
--- a/mozilla/htmlparser/src/Makefile.in
+++ b/mozilla/htmlparser/src/Makefile.in
@@ -77,7 +77,6 @@ CPPSRCS = \
nsValidDTD.cpp \
nsWellFormedDTD.cpp \
nsViewSourceHTML.cpp \
- nsExpatDTD.cpp \
$(NULL)
#
@@ -114,7 +113,6 @@ EXPORTS = \
nsWellFormedDTD.h \
nsValidDTD.h \
nsParserCIID.h \
- nsExpatDTD.h \
nsParserError.h \
nsIElementObserver.h \
nsIParserService.h \
diff --git a/mozilla/htmlparser/src/makefile.win b/mozilla/htmlparser/src/makefile.win
index 700d0eec712..a9c7ec788a6 100644
--- a/mozilla/htmlparser/src/makefile.win
+++ b/mozilla/htmlparser/src/makefile.win
@@ -53,7 +53,6 @@ CPPSRCS= \
nsValidDTD.cpp \
nsWellFormedDTD.cpp \
nsViewSourceHTML.cpp \
- nsExpatDTD.cpp \
nsParserModule.cpp \
$(NULL)
@@ -80,7 +79,6 @@ CPP_OBJS= \
.\$(OBJDIR)\nsValidDTD.obj \
.\$(OBJDIR)\nsWellFormedDTD.obj \
.\$(OBJDIR)\nsViewSourceHTML.obj \
- .\$(OBJDIR)\nsExpatDTD.obj \
.\$(OBJDIR)\nsParserModule.obj \
$(NULL)
@@ -108,7 +106,6 @@ EXPORTS= \
nsValidDTD.h \
COtherDTD.h \
nsIDTD.h \
- nsExpatDTD.h \
nsParserCIID.h \
nsParserError.h \
nsIElementObserver.h \
diff --git a/mozilla/htmlparser/src/nsExpatDTD.cpp b/mozilla/htmlparser/src/nsExpatDTD.cpp
deleted file mode 100644
index 96b3169299c..00000000000
--- a/mozilla/htmlparser/src/nsExpatDTD.cpp
+++ /dev/null
@@ -1,601 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/*
- * The contents of this file are subject to the Netscape Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is Netscape
- * Communications Corporation. Portions created by Netscape are
- * Copyright (C) 1998 Netscape Communications Corporation. All
- * Rights Reserved.
- *
- * Contributor(s):
- */
-
-/**
- * MODULE NOTES:
- * @update gess 4/8/98
- *
- *
- */
-
-
-#include "nsIDTDDebug.h"
-#include "nsExpatDTD.h"
-#include "nsCRT.h"
-#include "nsParser.h"
-#include "nsScanner.h"
-#include "nsIParser.h"
-#include "nsTokenHandler.h"
-#include "nsDTDUtils.h"
-#include "nsIContentSink.h"
-#include "nsIHTMLContentSink.h"
-#include "nsExpatTokenizer.h"
-#include "nsHTMLEntities.h"
-
-#include "prenv.h" //this is here for debug reasons...
-#include "prtypes.h" //this is here for debug reasons...
-#include "prio.h"
-#include "plstr.h"
-#include "prlog.h"
-
-#include "prmem.h"
-
-static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
-static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
-static NS_DEFINE_IID(kClassIID, NS_EXPAT_DTD_IID);
-
-/**
- * This method gets called as part of our COM-like interfaces.
- * Its purpose is to create an interface to parser object
- * of some type.
- *
- * @update gess 4/8/98
- * @param nsIID id of object to discover
- * @param aInstancePtr ptr to newly discovered interface
- * @return NS_xxx result code
- */
-nsresult nsExpatDTD::QueryInterface(const nsIID& aIID, void** aInstancePtr)
-{
- if (NULL == aInstancePtr) {
- return NS_ERROR_NULL_POINTER;
- }
-
- if(aIID.Equals(kISupportsIID)) { //do IUnknown...
- *aInstancePtr = (nsIDTD*)(this);
- }
- else if(aIID.Equals(kIDTDIID)) { //do IParser base class...
- *aInstancePtr = (nsIDTD*)(this);
- }
- else if(aIID.Equals(kClassIID)) { //do this class...
- *aInstancePtr = (nsExpatDTD*)(this);
- }
- else {
- *aInstancePtr=0;
- return NS_NOINTERFACE;
- }
- NS_ADDREF_THIS();
- return NS_OK;
-}
-
-/**
- * This method is defined in nsIParser. It is used to
- * cause the COM-like construction of an nsParser.
- *
- * @update gess 4/8/98
- * @param nsIParser** ptr to newly instantiated parser
- * @return NS_xxx error result
- */
-NS_HTMLPARS nsresult NS_New_Expat_DTD(nsIDTD** aInstancePtrResult) {
- nsExpatDTD* it = new nsExpatDTD();
- if (it == 0) {
- return NS_ERROR_OUT_OF_MEMORY;
- }
- return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);
-}
-
-
-NS_IMPL_ADDREF(nsExpatDTD)
-NS_IMPL_RELEASE(nsExpatDTD)
-
-
-/**
- * Default constructor
- *
- * @update gess 4/9/98
- * @param
- * @return
- */
-nsExpatDTD::nsExpatDTD() {
- NS_INIT_REFCNT();
-
- mExpatParser=0;
- mParser=0;
- mSink=0;
- mLineNumber=0;
- mTokenizer=0;
-}
-
-/**
- * Default destructor
- *
- * @update gess 4/9/98
- * @param
- * @return
- */
-nsExpatDTD::~nsExpatDTD(){
- mParser=0; //just to prove we destructed...
- NS_IF_RELEASE(mTokenizer);
- if (mExpatParser)
- XML_ParserFree(mExpatParser);
-}
-
-/**
- *
- * @update gess1/8/99
- * @param
- * @return
- */
-const nsIID& nsExpatDTD::GetMostDerivedIID(void) const{
- return kClassIID;
-}
-
-/**
- * Call this method if you want the DTD to construct a fresh
- * instance of itself.
- * @update gess7/23/98
- * @param
- * @return
- */
-nsresult nsExpatDTD::CreateNewInstance(nsIDTD** aInstancePtrResult){
- return NS_New_Expat_DTD(aInstancePtrResult);
-}
-
-/**
- * This method is called to determine if the given DTD can parse
- * a document in a given source-type.
- * NOTE: Parsing always assumes that the end result will involve
- * storing the result in the main content model.
- * @update gess6/24/98
- * @param
- * @return TRUE if this DTD can satisfy the request; FALSE otherwise.
- */
-eAutoDetectResult nsExpatDTD::CanParse(CParserContext& aParserContext,nsString& aBuffer, PRInt32 aVersion){
- eAutoDetectResult result=eUnknownDetect;
-
- if(eViewSource!=aParserContext.mParserCommand) {
- if(aParserContext.mMimeType.EqualsWithConversion(kXMLTextContentType) ||
- aParserContext.mMimeType.EqualsWithConversion(kXMLApplicationContentType) ||
- aParserContext.mMimeType.EqualsWithConversion(kXHTMLApplicationContentType) ||
- aParserContext.mMimeType.EqualsWithConversion(kRDFTextContentType) ||
- aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType)) {
- result=eValidDetect;
- }
- else {
- if(-1GetFilename();
-
- mSink=aSink;
- if((!aParserContext.mPrevContext) && (mSink)) {
- mLineNumber=0;
- result = mSink->WillBuildModel();
- }
-
- return result;
-}
-
-/**
- * The parser uses a code sandwich to wrap the parsing process. Before
- * the process begins, WillBuildModel() is called. Afterwards the parser
- * calls DidBuildModel().
- * @update gess 1/4/99
- * @param aFilename is the name of the file being parsed.
- * @return error code (almost always 0)
- */
-NS_IMETHODIMP nsExpatDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITokenObserver* anObserver,nsIContentSink* aSink) {
- nsresult result=NS_OK;
-
- if(aTokenizer) {
- nsITokenizer* oldTokenizer=mTokenizer;
- mTokenizer=aTokenizer;
- nsTokenAllocator* theAllocator=aTokenizer->GetTokenAllocator();
-
- while(NS_OK==result){
- CToken* theToken=mTokenizer->PopToken();
- if(theToken) {
- result=HandleToken(theToken,aParser);
- if(NS_SUCCEEDED(result)) {
- IF_FREE(theToken, mTokenizer->GetTokenAllocator());
- }
- else if(NS_ERROR_HTMLPARSER_BLOCK!=result){
- mTokenizer->PushTokenFront(theToken);
- }
- // theRootDTD->Verify(kEmptyString,aParser);
- }
- else break;
- }//while
- mTokenizer=oldTokenizer;
- }
- else result=NS_ERROR_HTMLPARSER_BADTOKENIZER;
-
- return result;
-}
-
-
-/**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
-NS_IMETHODIMP nsExpatDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink){
- nsresult result= NS_OK;
-
- //ADD CODE HERE TO CLOSE OPEN CONTAINERS...
-
- if(aParser){
- mSink=aParser->GetContentSink();
- if((aNotifySink) && (mSink)) {
- result = mSink->DidBuildModel(1);
- }
- }
- return result;
-}
-
-/**
- *
- * @update gess8/4/98
- * @param
- * @return
- */
-nsTokenAllocator* nsExpatDTD::GetTokenAllocator(void){
- nsITokenizer* theTokenizer=0;
- nsresult result=GetTokenizer(theTokenizer);
-
- if (NS_SUCCEEDED(result)) {
- return theTokenizer->GetTokenAllocator();
- }
- return 0;
-}
-
-/**
- * Use this id you want to stop the building content model
- * --------------[ Sets DTD to STOP mode ]----------------
- * It's recommended to use this method in accordance with
- * the parser's terminate() method.
- *
- * @update harishd 07/22/99
- * @param
- * @return
- */
-nsresult nsExpatDTD::Terminate(nsIParser* aParser)
-{
- return NS_ERROR_HTMLPARSER_STOPPARSING;
-}
-
-/**
- * Sets up the callbacks for the expat parser
- * @update nra 2/24/99
- * @param none
- * @return none
- */
-void nsExpatDTD::SetupExpatCallbacks(void) {
- if (mExpatParser) {
- XML_SetElementHandler(mExpatParser, DTD_HandleStartElement, DTD_HandleEndElement);
- XML_SetCharacterDataHandler(mExpatParser, DTD_HandleCharacterData);
- XML_SetProcessingInstructionHandler(mExpatParser, DTD_HandleProcessingInstruction);
- // XML_SetDefaultHandler(mExpatParser, NULL);
- // XML_SetUnparsedEntityDeclHandler(mExpatParser, NULL);
- XML_SetNotationDeclHandler(mExpatParser, DTD_HandleNotationDecl);
- // XML_SetExternalEntityRefHandler(mExpatParser, NULL);
- // XML_SetUnknownEncodingHandler(mExpatParser, NULL, NULL);
- }
-}
-
-
-/**
- * Retrieve the preferred tokenizer for use by this DTD.
- * @update gess12/28/98
- * @param none
- * @return ptr to tokenizer
- */
-nsresult nsExpatDTD::GetTokenizer(nsITokenizer*& aTokenizer) {
- nsresult result=NS_OK;
- if(!mTokenizer) {
- result=NS_New_Expat_Tokenizer(&mTokenizer);
- mExpatParser = XML_ParserCreate(NULL);
- if (mExpatParser) {
- SetupExpatCallbacks();
- }
- }
- aTokenizer=mTokenizer;
- return result;
-}
-
-
-/**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
-NS_IMETHODIMP nsExpatDTD::WillResumeParse(void){
- nsresult result = NS_OK;
- if(mSink) {
- result = mSink->WillResume();
- }
- return result;
-}
-
-/**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
-NS_IMETHODIMP nsExpatDTD::WillInterruptParse(void){
- nsresult result = NS_OK;
- if(mSink) {
- result = mSink->WillInterrupt();
- }
- return result;
-}
-
-/**
- * Called by the parser to initiate dtd verification of the
- * internal context stack.
- * @update gess 7/23/98
- * @param
- * @return
- */
-PRBool nsExpatDTD::Verify(nsString& aURLRef,nsIParser* aParser) {
- PRBool result=PR_TRUE;
- mParser=(nsParser*)aParser;
- return result;
-}
-
-/**
- * Called by the parser to enable/disable dtd verification of the
- * internal context stack.
- * @update gess 7/23/98
- * @param
- * @return
- */
-void nsExpatDTD::SetVerification(PRBool aEnabled){
-}
-
-/**
- * This method is called to determine whether or not a tag
- * of one type can contain a tag of another type.
- *
- * @update gess 3/25/98
- * @param aParent -- int tag of parent container
- * @param aChild -- int tag of child container
- * @return PR_TRUE if parent can contain child
- */
-PRBool nsExpatDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const{
- PRBool result=PR_TRUE;
- return result;
-}
-
-/**
- * Give rest of world access to our tag enums, so that CanContain(), etc,
- * become useful.
- */
-NS_IMETHODIMP nsExpatDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP nsExpatDTD::IntTagToStringTag(PRInt32 aIntTag, nsString& aTag) const
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP nsExpatDTD::ConvertEntityToUnicode(const nsString& aEntity, PRInt32* aUnicode) const
-{
- // XXX Needed since the XML content sink reduces entities as well
- *aUnicode = nsHTMLEntities::EntityToUnicode(aEntity);
- return NS_OK;
-}
-
-/**
- * This method gets called to determine whether a given
- * tag is itself a container
- *
- * @update gess 3/25/98
- * @param aTag -- tag to test for containership
- * @return PR_TRUE if given tag can contain other tags
- */
-PRBool nsExpatDTD::IsContainer(PRInt32 aTag) const{
- PRBool result=PR_TRUE;
- return result;
-}
-
-/**
- *
- * @update vidur 11/12/98
- * @param aToken -- token object to be put into content model
- * @return 0 if all is well; non-zero is an error
- */
-NS_IMETHODIMP nsExpatDTD::HandleToken(CToken* aToken,nsIParser* aParser) {
- nsresult result=NS_OK;
- CHTMLToken* theToken= (CHTMLToken*)(aToken);
- eHTMLTokenTypes theType= (eHTMLTokenTypes)theToken->GetTokenType();
-
- mParser=(nsParser*)aParser;
- mSink=aParser->GetContentSink();
-
- nsCParserNode theNode(theToken,mLineNumber,mTokenizer->GetTokenAllocator());
- switch(theType) {
-
- case eToken_newline:
- mLineNumber++; //now fall through
- case eToken_entity:
- case eToken_whitespace:
- case eToken_text:
- case eToken_cdatasection:
- result=mSink->AddLeaf(theNode);
- break;
-
- case eToken_comment:
- result=mSink->AddComment(theNode);
- break;
-
- case eToken_instruction:
- result=mSink->AddProcessingInstruction(theNode);
- break;
-
- case eToken_start:
- {
- PRInt16 attrCount=aToken->GetAttributeCount();
-
- if(0PeekToken();
- if(theAttrToken) {
- eHTMLTokenTypes theAttrType=eHTMLTokenTypes(theAttrToken->GetTokenType());
- if(eToken_attribute==theAttrType){
- mTokenizer->PopToken(); //pop it for real...
- theNode.AddAttribute(theAttrToken);
- }
- }
- else return kEOF;
- }
- }
- if(NS_OK==result){
- result=mSink->OpenContainer(theNode);
- if(((CStartToken*)aToken)->IsEmpty()){
- result=mSink->CloseContainer(theNode);
- }
- }
- }
- break;
-
- case eToken_end:
- result=mSink->CloseContainer(theNode);
- break;
-
- case eToken_style:
- case eToken_skippedcontent:
- default:
- result=NS_OK;
- }//switch
- return result;
-}
-
-
-nsresult nsExpatDTD::ParseXMLBuffer(const char *buffer){
- nsresult result=NS_OK;
- if (mExpatParser) {
- if (!XML_Parse(mExpatParser, buffer, strlen(buffer), PR_FALSE)) {
- // XXX Add code here to implement error propagation to the
- // content sink.
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::ParseXMLBuffer(): \
- Error propogation from expat not yet implemented.");
- result = NS_ERROR_FAILURE;
- }
- }
- else {
- result = NS_ERROR_FAILURE;
- }
- return result;
-}
-
-/***************************************/
-/* Expat Callback Functions start here */
-/***************************************/
-
-void DTD_HandleStartElement(void *userData, const XML_Char *name, const XML_Char **atts)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleStartElement() not yet implemented.");
-}
-
-void DTD_HandleEndElement(void *userData, const XML_Char *name)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleEndElement() not yet implemented.");
-}
-
-void DTD_HandleCharacterData(void *userData, const XML_Char *s, int len)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleCharacterData() not yet implemented.");
-}
-
-void DTD_HandleProcessingInstruction(void *userData,
- const XML_Char *target,
- const XML_Char *data)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleProcessingInstruction() not yet implemented.");
-}
-
-void DTD_HandleDefault(void *userData, const XML_Char *s, int len)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleDefault() not yet implemented.");
-}
-
-void DTD_HandleUnparsedEntityDecl(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleUnparsedEntityDecl() not yet implemented.");
-}
-
-void DTD_HandleNotationDecl(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleNotationDecl() not yet implemented.");
-}
-
-void DTD_HandleExternalEntityRef(XML_Parser parser,
- const XML_Char *openEntityNames,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleExternalEntityRef() not yet implemented.");
-}
-
-void DTD_HandleUnknownEncoding(void *encodingHandlerData,
- const XML_Char *name,
- XML_Encoding *info)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleUnknownEncoding() not yet implemented.");
-}
diff --git a/mozilla/htmlparser/src/nsExpatDTD.h b/mozilla/htmlparser/src/nsExpatDTD.h
deleted file mode 100644
index 2990247d881..00000000000
--- a/mozilla/htmlparser/src/nsExpatDTD.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/*
- * The contents of this file are subject to the Netscape Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is Netscape
- * Communications Corporation. Portions created by Netscape are
- * Copyright (C) 1998 Netscape Communications Corporation. All
- * Rights Reserved.
- *
- * Contributor(s):
- * IBM Corp.
- */
-
-/**
- * MODULE NOTES:
- * @update gess 4/8/98
- *
- *
- */
-
-#ifndef __NS_EXPAT_DTD
-#define __NS_EXPAT_DTD
-
-#include "nsIDTD.h"
-#include "nsITokenizer.h"
-#include "nsISupports.h"
-#include "nsHTMLTokens.h"
-#include "nshtmlpars.h"
-#include "nsVoidArray.h"
-#include "nsDeque.h"
-#include "nsIContentSink.h"
-#include "xmlparse.h"
-
-
-#define NS_EXPAT_DTD_IID \
- {0x5ad4b431, 0xcabb, 0x11d2, \
- {0xab, 0xcb, 0x0, 0x10, 0x4b, 0x98, 0x3f, 0xd4}}
-
-
-class nsIDTDDebug;
-class nsIParserNode;
-class nsParser;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- /* The callback handlers that get called from the expat parser */
- void DTD_HandleStartElement(void *userData, const XML_Char *name, const XML_Char **atts);
- void DTD_HandleEndElement(void *userData, const XML_Char *name);
- void DTD_HandleCharacterData(void *userData, const XML_Char *s, int len);
- void DTD_HandleProcessingInstruction(void *userData,
- const XML_Char *target,
- const XML_Char *data);
- void DTD_HandleDefault(void *userData, const XML_Char *s, int len);
- void DTD_HandleUnparsedEntityDecl(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName);
- void DTD_HandleNotationDecl(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
- void DTD_HandleExternalEntityRef(XML_Parser parser,
- const XML_Char *openEntityNames,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
- void DTD_HandleUnknownEncoding(void *encodingHandlerData,
- const XML_Char *name,
- XML_Encoding *info);
-#ifdef __cplusplus
-}
-#endif
-
-class nsExpatDTD : public nsIDTD {
-
- public:
-
- NS_DECL_ISUPPORTS
-
-
- /**
- *
- *
- * @update gess 4/9/98
- * @param
- * @return
- */
- nsExpatDTD();
-
- /**
- *
- *
- * @update gess 4/9/98
- * @param
- * @return
- */
- virtual ~nsExpatDTD();
-
- virtual const nsIID& GetMostDerivedIID(void) const;
-
- /**
- * Call this method if you want the DTD to construct a clone of itself.
- * @update gess7/23/98
- * @param
- * @return
- */
- virtual nsresult CreateNewInstance(nsIDTD** aInstancePtrResult);
-
- /**
- * This method is called to determine if the given DTD can parse
- * a document in a given source-type.
- * NOTE: Parsing always assumes that the end result will involve
- * storing the result in the main content model.
- * @update gess6/24/98
- * @param
- * @return TRUE if this DTD can satisfy the request; FALSE otherwise.
- */
- virtual eAutoDetectResult CanParse(CParserContext& aParserContext,nsString& aBuffer, PRInt32 aVersion);
-
- /**
- * The parser uses a code sandwich to wrap the parsing process. Before
- * the process begins, WillBuildModel() is called. Afterwards the parser
- * calls DidBuildModel().
- * @update rickg 03.20.2000
- * @param aParserContext
- * @param aSink
- * @return error code (almost always 0)
- */
- NS_IMETHOD WillBuildModel( const CParserContext& aParserContext,nsIContentSink* aSink);
-
-
- /**
- * The parser uses a code sandwich to wrap the parsing process. Before
- * the process begins, WillBuildModel() is called. Afterwards the parser
- * calls DidBuildModel().
- * @update gess5/18/98
- * @param aFilename is the name of the file being parsed.
- * @return error code (almost always 0)
- */
- NS_IMETHOD BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITokenObserver* anObserver=0,nsIContentSink* aSink=0);
-
- /**
- * The parser uses a code sandwich to wrap the parsing process. Before
- * the process begins, WillBuildModel() is called. Afterwards the parser
- * calls DidBuildModel().
- * @update gess5/18/98
- * @param anErrorCode contans the last error that occured
- * @return error code
- */
- NS_IMETHOD DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink=0);
-
- /**
- *
- * @update gess 3/25/98
- * @param aToken -- token object to be put into content model
- * @return 0 if all is well; non-zero is an error
- */
- NS_IMETHOD HandleToken(CToken* aToken,nsIParser* aParser);
-
- /**
- *
- * @update gess12/28/98
- * @param
- * @return
- */
- NS_IMETHOD GetTokenizer(nsITokenizer*& aTokenizer);
-
- /**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
- NS_IMETHOD WillResumeParse(void);
-
- /**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
- NS_IMETHOD WillInterruptParse(void);
-
- /**
- * Called by the parser to initiate dtd verification of the
- * internal context stack.
- * @update gess 7/23/98
- * @param
- * @return
- */
- virtual PRBool Verify(nsString& aURLRef,nsIParser* aParser);
-
- /**
- * Set this to TRUE if you want the DTD to verify its
- * context stack.
- * @update gess 7/23/98
- * @param
- * @return
- */
- virtual void SetVerification(PRBool aEnable);
-
- /**
- * This method is called to determine whether or not a tag
- * of one type can contain a tag of another type.
- *
- * @update gess 3/25/98
- * @param aParent -- int tag of parent container
- * @param aChild -- int tag of child container
- * @return PR_TRUE if parent can contain child
- */
- virtual PRBool CanContain(PRInt32 aParent,PRInt32 aChild) const;
-
- /**
- * This method gets called to determine whether a given
- * tag is itself a container
- *
- * @update gess 3/25/98
- * @param aTag -- tag to test for containership
- * @return PR_TRUE if given tag can contain other tags
- */
- virtual PRBool IsContainer(PRInt32 aTag) const;
-
- /**
- * Use this id you want to stop the building content model
- * --------------[ Sets DTD to STOP mode ]----------------
- * It's recommended to use this method in accordance with
- * the parser's terminate() method.
- *
- * @update harishd 07/22/99
- * @param
- * @return
- */
- virtual nsresult Terminate(nsIParser* aParser=nsnull);
-
- /**
- * Give rest of world access to our tag enums, so that CanContain(), etc,
- * become useful.
- */
- NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;
-
- NS_IMETHOD IntTagToStringTag(PRInt32 aIntTag, nsString& aTag) const;
-
- NS_IMETHOD ConvertEntityToUnicode(const nsString& aEntity, PRInt32* aUnicode) const;
-
- virtual PRBool IsBlockElement(PRInt32 aTagID,PRInt32 aParentID) const {return PR_FALSE;}
- virtual PRBool IsInlineElement(PRInt32 aTagID,PRInt32 aParentID) const {return PR_FALSE;}
-
- /**
- * Retrieve a ptr to the global token recycler...
- * @update gess8/4/98
- * @return ptr to recycler (or null)
- */
- virtual nsTokenAllocator* GetTokenAllocator(void);
-
- /**
- * Parse an XML buffer using expat
- * @update nra 2/29/99
- * @return NS_ERROR_FAILURE if expat encounters an error, else NS_OK
- */
- nsresult ParseXMLBuffer(const char *buffer);
-
-protected:
- /**
- * Sets up the callbacks for the expat parser
- * @update nra 2/24/99
- * @param none
- * @return none
- */
- void SetupExpatCallbacks(void);
-
- /* The callback handlers that get called from the expat parser */
- friend void DTD_HandleStartElement(void *userData, const XML_Char *name, const XML_Char **atts);
- friend void DTD_HandleEndElement(void *userData, const XML_Char *name);
- friend void DTD_HandleCharacterData(void *userData, const XML_Char *s, int len);
- friend void DTD_HandleProcessingInstruction(void *userData,
- const XML_Char *target,
- const XML_Char *data);
- friend void DTD_HandleDefault(void *userData, const XML_Char *s, int len);
- friend void DTD_HandleUnparsedEntityDecl(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName);
- friend void DTD_HandleNotationDecl(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
- friend void DTD_HandleExternalEntityRef(XML_Parser parser,
- const XML_Char *openEntityNames,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
- friend void DTD_HandleUnknownEncoding(void *encodingHandlerData,
- const XML_Char *name,
- XML_Encoding *info);
-
- XML_Parser mExpatParser;
- nsParser* mParser;
- nsIContentSink* mSink;
- nsString mFilename;
- PRInt32 mLineNumber;
- nsITokenizer* mTokenizer;
-};
-
-extern NS_HTMLPARS nsresult NS_New_Expat_DTD(nsIDTD** aInstancePtrResult);
-
-
-#endif
diff --git a/mozilla/htmlparser/src/nsExpatTokenizer.cpp b/mozilla/htmlparser/src/nsExpatTokenizer.cpp
index 28e82aab178..617f565cb67 100644
--- a/mozilla/htmlparser/src/nsExpatTokenizer.cpp
+++ b/mozilla/htmlparser/src/nsExpatTokenizer.cpp
@@ -117,23 +117,6 @@ nsresult nsExpatTokenizer::QueryInterface(const nsIID& aIID, void** aInstancePtr
return NS_OK;
}
-/**
- * This method is defined in nsIParser. It is used to
- * cause the COM-like construction of an nsParser.
- *
- * @update gess 4/8/98
- * @param nsIParser** ptr to newly instantiated parser
- * @return NS_xxx error result
- */
-NS_HTMLPARS nsresult NS_New_Expat_Tokenizer(nsITokenizer** aInstancePtrResult) {
- nsExpatTokenizer* it = new nsExpatTokenizer();
- if (it == 0) {
- return NS_ERROR_OUT_OF_MEMORY;
- }
- return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);
-}
-
-
NS_IMPL_ADDREF(nsExpatTokenizer)
NS_IMPL_RELEASE(nsExpatTokenizer)
diff --git a/mozilla/htmlparser/src/nsExpatTokenizer.h b/mozilla/htmlparser/src/nsExpatTokenizer.h
index d5047e28041..3bb488ccc22 100644
--- a/mozilla/htmlparser/src/nsExpatTokenizer.h
+++ b/mozilla/htmlparser/src/nsExpatTokenizer.h
@@ -190,7 +190,4 @@ protected:
XMLParserState* mState;
};
-
-extern NS_HTMLPARS nsresult NS_New_Expat_Tokenizer(nsITokenizer** aInstancePtrResult);
-
#endif
diff --git a/mozilla/parser/htmlparser/macbuild/htmlparser.mcp b/mozilla/parser/htmlparser/macbuild/htmlparser.mcp
index 9d10143f268..6f60e66be7c 100644
Binary files a/mozilla/parser/htmlparser/macbuild/htmlparser.mcp and b/mozilla/parser/htmlparser/macbuild/htmlparser.mcp differ
diff --git a/mozilla/parser/htmlparser/src/MANIFEST b/mozilla/parser/htmlparser/src/MANIFEST
index ce7b04be86e..f48f7a12200 100644
--- a/mozilla/parser/htmlparser/src/MANIFEST
+++ b/mozilla/parser/htmlparser/src/MANIFEST
@@ -21,7 +21,6 @@ nsParserCIID.h
nsHTMLEntities.h
nsHTMLEntityList.h
nsWellFormedDTD.h
-nsExpatDTD.h
nsIExpatTokenizer.h
nsParserError.h
nsIElementObserver.h
diff --git a/mozilla/parser/htmlparser/src/Makefile.in b/mozilla/parser/htmlparser/src/Makefile.in
index 01e466575ad..898eb8869da 100644
--- a/mozilla/parser/htmlparser/src/Makefile.in
+++ b/mozilla/parser/htmlparser/src/Makefile.in
@@ -77,7 +77,6 @@ CPPSRCS = \
nsValidDTD.cpp \
nsWellFormedDTD.cpp \
nsViewSourceHTML.cpp \
- nsExpatDTD.cpp \
$(NULL)
#
@@ -114,7 +113,6 @@ EXPORTS = \
nsWellFormedDTD.h \
nsValidDTD.h \
nsParserCIID.h \
- nsExpatDTD.h \
nsParserError.h \
nsIElementObserver.h \
nsIParserService.h \
diff --git a/mozilla/parser/htmlparser/src/makefile.win b/mozilla/parser/htmlparser/src/makefile.win
index 700d0eec712..a9c7ec788a6 100644
--- a/mozilla/parser/htmlparser/src/makefile.win
+++ b/mozilla/parser/htmlparser/src/makefile.win
@@ -53,7 +53,6 @@ CPPSRCS= \
nsValidDTD.cpp \
nsWellFormedDTD.cpp \
nsViewSourceHTML.cpp \
- nsExpatDTD.cpp \
nsParserModule.cpp \
$(NULL)
@@ -80,7 +79,6 @@ CPP_OBJS= \
.\$(OBJDIR)\nsValidDTD.obj \
.\$(OBJDIR)\nsWellFormedDTD.obj \
.\$(OBJDIR)\nsViewSourceHTML.obj \
- .\$(OBJDIR)\nsExpatDTD.obj \
.\$(OBJDIR)\nsParserModule.obj \
$(NULL)
@@ -108,7 +106,6 @@ EXPORTS= \
nsValidDTD.h \
COtherDTD.h \
nsIDTD.h \
- nsExpatDTD.h \
nsParserCIID.h \
nsParserError.h \
nsIElementObserver.h \
diff --git a/mozilla/parser/htmlparser/src/nsExpatDTD.cpp b/mozilla/parser/htmlparser/src/nsExpatDTD.cpp
deleted file mode 100644
index 96b3169299c..00000000000
--- a/mozilla/parser/htmlparser/src/nsExpatDTD.cpp
+++ /dev/null
@@ -1,601 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/*
- * The contents of this file are subject to the Netscape Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is Netscape
- * Communications Corporation. Portions created by Netscape are
- * Copyright (C) 1998 Netscape Communications Corporation. All
- * Rights Reserved.
- *
- * Contributor(s):
- */
-
-/**
- * MODULE NOTES:
- * @update gess 4/8/98
- *
- *
- */
-
-
-#include "nsIDTDDebug.h"
-#include "nsExpatDTD.h"
-#include "nsCRT.h"
-#include "nsParser.h"
-#include "nsScanner.h"
-#include "nsIParser.h"
-#include "nsTokenHandler.h"
-#include "nsDTDUtils.h"
-#include "nsIContentSink.h"
-#include "nsIHTMLContentSink.h"
-#include "nsExpatTokenizer.h"
-#include "nsHTMLEntities.h"
-
-#include "prenv.h" //this is here for debug reasons...
-#include "prtypes.h" //this is here for debug reasons...
-#include "prio.h"
-#include "plstr.h"
-#include "prlog.h"
-
-#include "prmem.h"
-
-static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
-static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
-static NS_DEFINE_IID(kClassIID, NS_EXPAT_DTD_IID);
-
-/**
- * This method gets called as part of our COM-like interfaces.
- * Its purpose is to create an interface to parser object
- * of some type.
- *
- * @update gess 4/8/98
- * @param nsIID id of object to discover
- * @param aInstancePtr ptr to newly discovered interface
- * @return NS_xxx result code
- */
-nsresult nsExpatDTD::QueryInterface(const nsIID& aIID, void** aInstancePtr)
-{
- if (NULL == aInstancePtr) {
- return NS_ERROR_NULL_POINTER;
- }
-
- if(aIID.Equals(kISupportsIID)) { //do IUnknown...
- *aInstancePtr = (nsIDTD*)(this);
- }
- else if(aIID.Equals(kIDTDIID)) { //do IParser base class...
- *aInstancePtr = (nsIDTD*)(this);
- }
- else if(aIID.Equals(kClassIID)) { //do this class...
- *aInstancePtr = (nsExpatDTD*)(this);
- }
- else {
- *aInstancePtr=0;
- return NS_NOINTERFACE;
- }
- NS_ADDREF_THIS();
- return NS_OK;
-}
-
-/**
- * This method is defined in nsIParser. It is used to
- * cause the COM-like construction of an nsParser.
- *
- * @update gess 4/8/98
- * @param nsIParser** ptr to newly instantiated parser
- * @return NS_xxx error result
- */
-NS_HTMLPARS nsresult NS_New_Expat_DTD(nsIDTD** aInstancePtrResult) {
- nsExpatDTD* it = new nsExpatDTD();
- if (it == 0) {
- return NS_ERROR_OUT_OF_MEMORY;
- }
- return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);
-}
-
-
-NS_IMPL_ADDREF(nsExpatDTD)
-NS_IMPL_RELEASE(nsExpatDTD)
-
-
-/**
- * Default constructor
- *
- * @update gess 4/9/98
- * @param
- * @return
- */
-nsExpatDTD::nsExpatDTD() {
- NS_INIT_REFCNT();
-
- mExpatParser=0;
- mParser=0;
- mSink=0;
- mLineNumber=0;
- mTokenizer=0;
-}
-
-/**
- * Default destructor
- *
- * @update gess 4/9/98
- * @param
- * @return
- */
-nsExpatDTD::~nsExpatDTD(){
- mParser=0; //just to prove we destructed...
- NS_IF_RELEASE(mTokenizer);
- if (mExpatParser)
- XML_ParserFree(mExpatParser);
-}
-
-/**
- *
- * @update gess1/8/99
- * @param
- * @return
- */
-const nsIID& nsExpatDTD::GetMostDerivedIID(void) const{
- return kClassIID;
-}
-
-/**
- * Call this method if you want the DTD to construct a fresh
- * instance of itself.
- * @update gess7/23/98
- * @param
- * @return
- */
-nsresult nsExpatDTD::CreateNewInstance(nsIDTD** aInstancePtrResult){
- return NS_New_Expat_DTD(aInstancePtrResult);
-}
-
-/**
- * This method is called to determine if the given DTD can parse
- * a document in a given source-type.
- * NOTE: Parsing always assumes that the end result will involve
- * storing the result in the main content model.
- * @update gess6/24/98
- * @param
- * @return TRUE if this DTD can satisfy the request; FALSE otherwise.
- */
-eAutoDetectResult nsExpatDTD::CanParse(CParserContext& aParserContext,nsString& aBuffer, PRInt32 aVersion){
- eAutoDetectResult result=eUnknownDetect;
-
- if(eViewSource!=aParserContext.mParserCommand) {
- if(aParserContext.mMimeType.EqualsWithConversion(kXMLTextContentType) ||
- aParserContext.mMimeType.EqualsWithConversion(kXMLApplicationContentType) ||
- aParserContext.mMimeType.EqualsWithConversion(kXHTMLApplicationContentType) ||
- aParserContext.mMimeType.EqualsWithConversion(kRDFTextContentType) ||
- aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType)) {
- result=eValidDetect;
- }
- else {
- if(-1GetFilename();
-
- mSink=aSink;
- if((!aParserContext.mPrevContext) && (mSink)) {
- mLineNumber=0;
- result = mSink->WillBuildModel();
- }
-
- return result;
-}
-
-/**
- * The parser uses a code sandwich to wrap the parsing process. Before
- * the process begins, WillBuildModel() is called. Afterwards the parser
- * calls DidBuildModel().
- * @update gess 1/4/99
- * @param aFilename is the name of the file being parsed.
- * @return error code (almost always 0)
- */
-NS_IMETHODIMP nsExpatDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITokenObserver* anObserver,nsIContentSink* aSink) {
- nsresult result=NS_OK;
-
- if(aTokenizer) {
- nsITokenizer* oldTokenizer=mTokenizer;
- mTokenizer=aTokenizer;
- nsTokenAllocator* theAllocator=aTokenizer->GetTokenAllocator();
-
- while(NS_OK==result){
- CToken* theToken=mTokenizer->PopToken();
- if(theToken) {
- result=HandleToken(theToken,aParser);
- if(NS_SUCCEEDED(result)) {
- IF_FREE(theToken, mTokenizer->GetTokenAllocator());
- }
- else if(NS_ERROR_HTMLPARSER_BLOCK!=result){
- mTokenizer->PushTokenFront(theToken);
- }
- // theRootDTD->Verify(kEmptyString,aParser);
- }
- else break;
- }//while
- mTokenizer=oldTokenizer;
- }
- else result=NS_ERROR_HTMLPARSER_BADTOKENIZER;
-
- return result;
-}
-
-
-/**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
-NS_IMETHODIMP nsExpatDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink){
- nsresult result= NS_OK;
-
- //ADD CODE HERE TO CLOSE OPEN CONTAINERS...
-
- if(aParser){
- mSink=aParser->GetContentSink();
- if((aNotifySink) && (mSink)) {
- result = mSink->DidBuildModel(1);
- }
- }
- return result;
-}
-
-/**
- *
- * @update gess8/4/98
- * @param
- * @return
- */
-nsTokenAllocator* nsExpatDTD::GetTokenAllocator(void){
- nsITokenizer* theTokenizer=0;
- nsresult result=GetTokenizer(theTokenizer);
-
- if (NS_SUCCEEDED(result)) {
- return theTokenizer->GetTokenAllocator();
- }
- return 0;
-}
-
-/**
- * Use this id you want to stop the building content model
- * --------------[ Sets DTD to STOP mode ]----------------
- * It's recommended to use this method in accordance with
- * the parser's terminate() method.
- *
- * @update harishd 07/22/99
- * @param
- * @return
- */
-nsresult nsExpatDTD::Terminate(nsIParser* aParser)
-{
- return NS_ERROR_HTMLPARSER_STOPPARSING;
-}
-
-/**
- * Sets up the callbacks for the expat parser
- * @update nra 2/24/99
- * @param none
- * @return none
- */
-void nsExpatDTD::SetupExpatCallbacks(void) {
- if (mExpatParser) {
- XML_SetElementHandler(mExpatParser, DTD_HandleStartElement, DTD_HandleEndElement);
- XML_SetCharacterDataHandler(mExpatParser, DTD_HandleCharacterData);
- XML_SetProcessingInstructionHandler(mExpatParser, DTD_HandleProcessingInstruction);
- // XML_SetDefaultHandler(mExpatParser, NULL);
- // XML_SetUnparsedEntityDeclHandler(mExpatParser, NULL);
- XML_SetNotationDeclHandler(mExpatParser, DTD_HandleNotationDecl);
- // XML_SetExternalEntityRefHandler(mExpatParser, NULL);
- // XML_SetUnknownEncodingHandler(mExpatParser, NULL, NULL);
- }
-}
-
-
-/**
- * Retrieve the preferred tokenizer for use by this DTD.
- * @update gess12/28/98
- * @param none
- * @return ptr to tokenizer
- */
-nsresult nsExpatDTD::GetTokenizer(nsITokenizer*& aTokenizer) {
- nsresult result=NS_OK;
- if(!mTokenizer) {
- result=NS_New_Expat_Tokenizer(&mTokenizer);
- mExpatParser = XML_ParserCreate(NULL);
- if (mExpatParser) {
- SetupExpatCallbacks();
- }
- }
- aTokenizer=mTokenizer;
- return result;
-}
-
-
-/**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
-NS_IMETHODIMP nsExpatDTD::WillResumeParse(void){
- nsresult result = NS_OK;
- if(mSink) {
- result = mSink->WillResume();
- }
- return result;
-}
-
-/**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
-NS_IMETHODIMP nsExpatDTD::WillInterruptParse(void){
- nsresult result = NS_OK;
- if(mSink) {
- result = mSink->WillInterrupt();
- }
- return result;
-}
-
-/**
- * Called by the parser to initiate dtd verification of the
- * internal context stack.
- * @update gess 7/23/98
- * @param
- * @return
- */
-PRBool nsExpatDTD::Verify(nsString& aURLRef,nsIParser* aParser) {
- PRBool result=PR_TRUE;
- mParser=(nsParser*)aParser;
- return result;
-}
-
-/**
- * Called by the parser to enable/disable dtd verification of the
- * internal context stack.
- * @update gess 7/23/98
- * @param
- * @return
- */
-void nsExpatDTD::SetVerification(PRBool aEnabled){
-}
-
-/**
- * This method is called to determine whether or not a tag
- * of one type can contain a tag of another type.
- *
- * @update gess 3/25/98
- * @param aParent -- int tag of parent container
- * @param aChild -- int tag of child container
- * @return PR_TRUE if parent can contain child
- */
-PRBool nsExpatDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const{
- PRBool result=PR_TRUE;
- return result;
-}
-
-/**
- * Give rest of world access to our tag enums, so that CanContain(), etc,
- * become useful.
- */
-NS_IMETHODIMP nsExpatDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP nsExpatDTD::IntTagToStringTag(PRInt32 aIntTag, nsString& aTag) const
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP nsExpatDTD::ConvertEntityToUnicode(const nsString& aEntity, PRInt32* aUnicode) const
-{
- // XXX Needed since the XML content sink reduces entities as well
- *aUnicode = nsHTMLEntities::EntityToUnicode(aEntity);
- return NS_OK;
-}
-
-/**
- * This method gets called to determine whether a given
- * tag is itself a container
- *
- * @update gess 3/25/98
- * @param aTag -- tag to test for containership
- * @return PR_TRUE if given tag can contain other tags
- */
-PRBool nsExpatDTD::IsContainer(PRInt32 aTag) const{
- PRBool result=PR_TRUE;
- return result;
-}
-
-/**
- *
- * @update vidur 11/12/98
- * @param aToken -- token object to be put into content model
- * @return 0 if all is well; non-zero is an error
- */
-NS_IMETHODIMP nsExpatDTD::HandleToken(CToken* aToken,nsIParser* aParser) {
- nsresult result=NS_OK;
- CHTMLToken* theToken= (CHTMLToken*)(aToken);
- eHTMLTokenTypes theType= (eHTMLTokenTypes)theToken->GetTokenType();
-
- mParser=(nsParser*)aParser;
- mSink=aParser->GetContentSink();
-
- nsCParserNode theNode(theToken,mLineNumber,mTokenizer->GetTokenAllocator());
- switch(theType) {
-
- case eToken_newline:
- mLineNumber++; //now fall through
- case eToken_entity:
- case eToken_whitespace:
- case eToken_text:
- case eToken_cdatasection:
- result=mSink->AddLeaf(theNode);
- break;
-
- case eToken_comment:
- result=mSink->AddComment(theNode);
- break;
-
- case eToken_instruction:
- result=mSink->AddProcessingInstruction(theNode);
- break;
-
- case eToken_start:
- {
- PRInt16 attrCount=aToken->GetAttributeCount();
-
- if(0PeekToken();
- if(theAttrToken) {
- eHTMLTokenTypes theAttrType=eHTMLTokenTypes(theAttrToken->GetTokenType());
- if(eToken_attribute==theAttrType){
- mTokenizer->PopToken(); //pop it for real...
- theNode.AddAttribute(theAttrToken);
- }
- }
- else return kEOF;
- }
- }
- if(NS_OK==result){
- result=mSink->OpenContainer(theNode);
- if(((CStartToken*)aToken)->IsEmpty()){
- result=mSink->CloseContainer(theNode);
- }
- }
- }
- break;
-
- case eToken_end:
- result=mSink->CloseContainer(theNode);
- break;
-
- case eToken_style:
- case eToken_skippedcontent:
- default:
- result=NS_OK;
- }//switch
- return result;
-}
-
-
-nsresult nsExpatDTD::ParseXMLBuffer(const char *buffer){
- nsresult result=NS_OK;
- if (mExpatParser) {
- if (!XML_Parse(mExpatParser, buffer, strlen(buffer), PR_FALSE)) {
- // XXX Add code here to implement error propagation to the
- // content sink.
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::ParseXMLBuffer(): \
- Error propogation from expat not yet implemented.");
- result = NS_ERROR_FAILURE;
- }
- }
- else {
- result = NS_ERROR_FAILURE;
- }
- return result;
-}
-
-/***************************************/
-/* Expat Callback Functions start here */
-/***************************************/
-
-void DTD_HandleStartElement(void *userData, const XML_Char *name, const XML_Char **atts)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleStartElement() not yet implemented.");
-}
-
-void DTD_HandleEndElement(void *userData, const XML_Char *name)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleEndElement() not yet implemented.");
-}
-
-void DTD_HandleCharacterData(void *userData, const XML_Char *s, int len)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleCharacterData() not yet implemented.");
-}
-
-void DTD_HandleProcessingInstruction(void *userData,
- const XML_Char *target,
- const XML_Char *data)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleProcessingInstruction() not yet implemented.");
-}
-
-void DTD_HandleDefault(void *userData, const XML_Char *s, int len)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleDefault() not yet implemented.");
-}
-
-void DTD_HandleUnparsedEntityDecl(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleUnparsedEntityDecl() not yet implemented.");
-}
-
-void DTD_HandleNotationDecl(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleNotationDecl() not yet implemented.");
-}
-
-void DTD_HandleExternalEntityRef(XML_Parser parser,
- const XML_Char *openEntityNames,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleExternalEntityRef() not yet implemented.");
-}
-
-void DTD_HandleUnknownEncoding(void *encodingHandlerData,
- const XML_Char *name,
- XML_Encoding *info)
-{
- NS_NOTYETIMPLEMENTED("Error: nsExpatDTD::HandleUnknownEncoding() not yet implemented.");
-}
diff --git a/mozilla/parser/htmlparser/src/nsExpatDTD.h b/mozilla/parser/htmlparser/src/nsExpatDTD.h
deleted file mode 100644
index 2990247d881..00000000000
--- a/mozilla/parser/htmlparser/src/nsExpatDTD.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/*
- * The contents of this file are subject to the Netscape Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is Netscape
- * Communications Corporation. Portions created by Netscape are
- * Copyright (C) 1998 Netscape Communications Corporation. All
- * Rights Reserved.
- *
- * Contributor(s):
- * IBM Corp.
- */
-
-/**
- * MODULE NOTES:
- * @update gess 4/8/98
- *
- *
- */
-
-#ifndef __NS_EXPAT_DTD
-#define __NS_EXPAT_DTD
-
-#include "nsIDTD.h"
-#include "nsITokenizer.h"
-#include "nsISupports.h"
-#include "nsHTMLTokens.h"
-#include "nshtmlpars.h"
-#include "nsVoidArray.h"
-#include "nsDeque.h"
-#include "nsIContentSink.h"
-#include "xmlparse.h"
-
-
-#define NS_EXPAT_DTD_IID \
- {0x5ad4b431, 0xcabb, 0x11d2, \
- {0xab, 0xcb, 0x0, 0x10, 0x4b, 0x98, 0x3f, 0xd4}}
-
-
-class nsIDTDDebug;
-class nsIParserNode;
-class nsParser;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- /* The callback handlers that get called from the expat parser */
- void DTD_HandleStartElement(void *userData, const XML_Char *name, const XML_Char **atts);
- void DTD_HandleEndElement(void *userData, const XML_Char *name);
- void DTD_HandleCharacterData(void *userData, const XML_Char *s, int len);
- void DTD_HandleProcessingInstruction(void *userData,
- const XML_Char *target,
- const XML_Char *data);
- void DTD_HandleDefault(void *userData, const XML_Char *s, int len);
- void DTD_HandleUnparsedEntityDecl(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName);
- void DTD_HandleNotationDecl(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
- void DTD_HandleExternalEntityRef(XML_Parser parser,
- const XML_Char *openEntityNames,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
- void DTD_HandleUnknownEncoding(void *encodingHandlerData,
- const XML_Char *name,
- XML_Encoding *info);
-#ifdef __cplusplus
-}
-#endif
-
-class nsExpatDTD : public nsIDTD {
-
- public:
-
- NS_DECL_ISUPPORTS
-
-
- /**
- *
- *
- * @update gess 4/9/98
- * @param
- * @return
- */
- nsExpatDTD();
-
- /**
- *
- *
- * @update gess 4/9/98
- * @param
- * @return
- */
- virtual ~nsExpatDTD();
-
- virtual const nsIID& GetMostDerivedIID(void) const;
-
- /**
- * Call this method if you want the DTD to construct a clone of itself.
- * @update gess7/23/98
- * @param
- * @return
- */
- virtual nsresult CreateNewInstance(nsIDTD** aInstancePtrResult);
-
- /**
- * This method is called to determine if the given DTD can parse
- * a document in a given source-type.
- * NOTE: Parsing always assumes that the end result will involve
- * storing the result in the main content model.
- * @update gess6/24/98
- * @param
- * @return TRUE if this DTD can satisfy the request; FALSE otherwise.
- */
- virtual eAutoDetectResult CanParse(CParserContext& aParserContext,nsString& aBuffer, PRInt32 aVersion);
-
- /**
- * The parser uses a code sandwich to wrap the parsing process. Before
- * the process begins, WillBuildModel() is called. Afterwards the parser
- * calls DidBuildModel().
- * @update rickg 03.20.2000
- * @param aParserContext
- * @param aSink
- * @return error code (almost always 0)
- */
- NS_IMETHOD WillBuildModel( const CParserContext& aParserContext,nsIContentSink* aSink);
-
-
- /**
- * The parser uses a code sandwich to wrap the parsing process. Before
- * the process begins, WillBuildModel() is called. Afterwards the parser
- * calls DidBuildModel().
- * @update gess5/18/98
- * @param aFilename is the name of the file being parsed.
- * @return error code (almost always 0)
- */
- NS_IMETHOD BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITokenObserver* anObserver=0,nsIContentSink* aSink=0);
-
- /**
- * The parser uses a code sandwich to wrap the parsing process. Before
- * the process begins, WillBuildModel() is called. Afterwards the parser
- * calls DidBuildModel().
- * @update gess5/18/98
- * @param anErrorCode contans the last error that occured
- * @return error code
- */
- NS_IMETHOD DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink=0);
-
- /**
- *
- * @update gess 3/25/98
- * @param aToken -- token object to be put into content model
- * @return 0 if all is well; non-zero is an error
- */
- NS_IMETHOD HandleToken(CToken* aToken,nsIParser* aParser);
-
- /**
- *
- * @update gess12/28/98
- * @param
- * @return
- */
- NS_IMETHOD GetTokenizer(nsITokenizer*& aTokenizer);
-
- /**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
- NS_IMETHOD WillResumeParse(void);
-
- /**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
- NS_IMETHOD WillInterruptParse(void);
-
- /**
- * Called by the parser to initiate dtd verification of the
- * internal context stack.
- * @update gess 7/23/98
- * @param
- * @return
- */
- virtual PRBool Verify(nsString& aURLRef,nsIParser* aParser);
-
- /**
- * Set this to TRUE if you want the DTD to verify its
- * context stack.
- * @update gess 7/23/98
- * @param
- * @return
- */
- virtual void SetVerification(PRBool aEnable);
-
- /**
- * This method is called to determine whether or not a tag
- * of one type can contain a tag of another type.
- *
- * @update gess 3/25/98
- * @param aParent -- int tag of parent container
- * @param aChild -- int tag of child container
- * @return PR_TRUE if parent can contain child
- */
- virtual PRBool CanContain(PRInt32 aParent,PRInt32 aChild) const;
-
- /**
- * This method gets called to determine whether a given
- * tag is itself a container
- *
- * @update gess 3/25/98
- * @param aTag -- tag to test for containership
- * @return PR_TRUE if given tag can contain other tags
- */
- virtual PRBool IsContainer(PRInt32 aTag) const;
-
- /**
- * Use this id you want to stop the building content model
- * --------------[ Sets DTD to STOP mode ]----------------
- * It's recommended to use this method in accordance with
- * the parser's terminate() method.
- *
- * @update harishd 07/22/99
- * @param
- * @return
- */
- virtual nsresult Terminate(nsIParser* aParser=nsnull);
-
- /**
- * Give rest of world access to our tag enums, so that CanContain(), etc,
- * become useful.
- */
- NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;
-
- NS_IMETHOD IntTagToStringTag(PRInt32 aIntTag, nsString& aTag) const;
-
- NS_IMETHOD ConvertEntityToUnicode(const nsString& aEntity, PRInt32* aUnicode) const;
-
- virtual PRBool IsBlockElement(PRInt32 aTagID,PRInt32 aParentID) const {return PR_FALSE;}
- virtual PRBool IsInlineElement(PRInt32 aTagID,PRInt32 aParentID) const {return PR_FALSE;}
-
- /**
- * Retrieve a ptr to the global token recycler...
- * @update gess8/4/98
- * @return ptr to recycler (or null)
- */
- virtual nsTokenAllocator* GetTokenAllocator(void);
-
- /**
- * Parse an XML buffer using expat
- * @update nra 2/29/99
- * @return NS_ERROR_FAILURE if expat encounters an error, else NS_OK
- */
- nsresult ParseXMLBuffer(const char *buffer);
-
-protected:
- /**
- * Sets up the callbacks for the expat parser
- * @update nra 2/24/99
- * @param none
- * @return none
- */
- void SetupExpatCallbacks(void);
-
- /* The callback handlers that get called from the expat parser */
- friend void DTD_HandleStartElement(void *userData, const XML_Char *name, const XML_Char **atts);
- friend void DTD_HandleEndElement(void *userData, const XML_Char *name);
- friend void DTD_HandleCharacterData(void *userData, const XML_Char *s, int len);
- friend void DTD_HandleProcessingInstruction(void *userData,
- const XML_Char *target,
- const XML_Char *data);
- friend void DTD_HandleDefault(void *userData, const XML_Char *s, int len);
- friend void DTD_HandleUnparsedEntityDecl(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName);
- friend void DTD_HandleNotationDecl(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
- friend void DTD_HandleExternalEntityRef(XML_Parser parser,
- const XML_Char *openEntityNames,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
- friend void DTD_HandleUnknownEncoding(void *encodingHandlerData,
- const XML_Char *name,
- XML_Encoding *info);
-
- XML_Parser mExpatParser;
- nsParser* mParser;
- nsIContentSink* mSink;
- nsString mFilename;
- PRInt32 mLineNumber;
- nsITokenizer* mTokenizer;
-};
-
-extern NS_HTMLPARS nsresult NS_New_Expat_DTD(nsIDTD** aInstancePtrResult);
-
-
-#endif
diff --git a/mozilla/parser/htmlparser/src/nsExpatTokenizer.cpp b/mozilla/parser/htmlparser/src/nsExpatTokenizer.cpp
index 28e82aab178..617f565cb67 100644
--- a/mozilla/parser/htmlparser/src/nsExpatTokenizer.cpp
+++ b/mozilla/parser/htmlparser/src/nsExpatTokenizer.cpp
@@ -117,23 +117,6 @@ nsresult nsExpatTokenizer::QueryInterface(const nsIID& aIID, void** aInstancePtr
return NS_OK;
}
-/**
- * This method is defined in nsIParser. It is used to
- * cause the COM-like construction of an nsParser.
- *
- * @update gess 4/8/98
- * @param nsIParser** ptr to newly instantiated parser
- * @return NS_xxx error result
- */
-NS_HTMLPARS nsresult NS_New_Expat_Tokenizer(nsITokenizer** aInstancePtrResult) {
- nsExpatTokenizer* it = new nsExpatTokenizer();
- if (it == 0) {
- return NS_ERROR_OUT_OF_MEMORY;
- }
- return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);
-}
-
-
NS_IMPL_ADDREF(nsExpatTokenizer)
NS_IMPL_RELEASE(nsExpatTokenizer)
diff --git a/mozilla/parser/htmlparser/src/nsExpatTokenizer.h b/mozilla/parser/htmlparser/src/nsExpatTokenizer.h
index d5047e28041..3bb488ccc22 100644
--- a/mozilla/parser/htmlparser/src/nsExpatTokenizer.h
+++ b/mozilla/parser/htmlparser/src/nsExpatTokenizer.h
@@ -190,7 +190,4 @@ protected:
XMLParserState* mState;
};
-
-extern NS_HTMLPARS nsresult NS_New_Expat_Tokenizer(nsITokenizer** aInstancePtrResult);
-
#endif