r=harishd, a=chofmann. Fix for bugs 11992, 10563. New lines get reported in the XML document prolog. Now, JS errors in XML report correct line numbers.

git-svn-id: svn://10.0.0.236/trunk@52750 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nisheeth%netscape.com 1999-11-03 23:50:16 +00:00
parent 13a4379130
commit e3cf2c3428
4 changed files with 24 additions and 10 deletions

View File

@ -126,7 +126,7 @@ void nsExpatTokenizer::SetupExpatCallbacks(void) {
XML_SetElementHandler(mExpatParser, HandleStartElement, HandleEndElement);
XML_SetCharacterDataHandler(mExpatParser, HandleCharacterData);
XML_SetProcessingInstructionHandler(mExpatParser, HandleProcessingInstruction);
XML_SetDefaultHandlerExpand(mExpatParser, NULL);
XML_SetDefaultHandlerExpand(mExpatParser, HandleDefault);
XML_SetUnparsedEntityDeclHandler(mExpatParser, HandleUnparsedEntityDecl);
XML_SetNotationDeclHandler(mExpatParser, HandleNotationDecl);
XML_SetExternalEntityRefHandler(mExpatParser, HandleExternalEntityRef);
@ -462,7 +462,7 @@ void nsExpatTokenizer::HandleProcessingInstruction(void *userData, const XML_Cha
CToken* theToken=gTokenRecycler->CreateTokenOfType(eToken_instruction,eHTMLTag_unknown);
if(theToken) {
nsString& theString=theToken->GetStringValueXXX();
theString.Append("<?");
theString. Append("<?");
theString.Append((PRUnichar *) target);
if(data) {
theString.Append(" ");
@ -477,7 +477,14 @@ void nsExpatTokenizer::HandleProcessingInstruction(void *userData, const XML_Cha
}
void nsExpatTokenizer::HandleDefault(void *userData, const XML_Char *s, int len) {
NS_NOTYETIMPLEMENTED("Error: nsExpatTokenizer::HandleDefault() not yet implemented.");
nsAutoString str((PRUnichar *)s, len);
PRInt32 offset = -1;
CToken* newLine = 0;
while ((offset = str.FindChar('\n', PR_FALSE, offset + 1)) != -1) {
newLine = gTokenRecycler->CreateTokenOfType(eToken_newline, eHTMLTag_unknown);
AddToken(newLine, NS_OK, *gTokenDeque, gTokenRecycler);
}
}
void nsExpatTokenizer::HandleUnparsedEntityDecl(void *userData,

View File

@ -125,7 +125,7 @@ CWellFormedDTD::CWellFormedDTD() : nsIDTD(), mFilename("") {
NS_INIT_REFCNT();
mParser=0;
mSink=0;
mLineNumber=0;
mLineNumber=1;
mTokenizer=0;
mDTDState=NS_OK;
}
@ -208,7 +208,7 @@ NS_IMETHODIMP CWellFormedDTD::WillBuildModel(nsString& aFilename,PRBool aNotifyS
mSink=aSink;
if((aNotifySink) && (mSink)) {
mLineNumber=0;
mLineNumber=1;
result = mSink->WillBuildModel();
#if 0

View File

@ -126,7 +126,7 @@ void nsExpatTokenizer::SetupExpatCallbacks(void) {
XML_SetElementHandler(mExpatParser, HandleStartElement, HandleEndElement);
XML_SetCharacterDataHandler(mExpatParser, HandleCharacterData);
XML_SetProcessingInstructionHandler(mExpatParser, HandleProcessingInstruction);
XML_SetDefaultHandlerExpand(mExpatParser, NULL);
XML_SetDefaultHandlerExpand(mExpatParser, HandleDefault);
XML_SetUnparsedEntityDeclHandler(mExpatParser, HandleUnparsedEntityDecl);
XML_SetNotationDeclHandler(mExpatParser, HandleNotationDecl);
XML_SetExternalEntityRefHandler(mExpatParser, HandleExternalEntityRef);
@ -462,7 +462,7 @@ void nsExpatTokenizer::HandleProcessingInstruction(void *userData, const XML_Cha
CToken* theToken=gTokenRecycler->CreateTokenOfType(eToken_instruction,eHTMLTag_unknown);
if(theToken) {
nsString& theString=theToken->GetStringValueXXX();
theString.Append("<?");
theString. Append("<?");
theString.Append((PRUnichar *) target);
if(data) {
theString.Append(" ");
@ -477,7 +477,14 @@ void nsExpatTokenizer::HandleProcessingInstruction(void *userData, const XML_Cha
}
void nsExpatTokenizer::HandleDefault(void *userData, const XML_Char *s, int len) {
NS_NOTYETIMPLEMENTED("Error: nsExpatTokenizer::HandleDefault() not yet implemented.");
nsAutoString str((PRUnichar *)s, len);
PRInt32 offset = -1;
CToken* newLine = 0;
while ((offset = str.FindChar('\n', PR_FALSE, offset + 1)) != -1) {
newLine = gTokenRecycler->CreateTokenOfType(eToken_newline, eHTMLTag_unknown);
AddToken(newLine, NS_OK, *gTokenDeque, gTokenRecycler);
}
}
void nsExpatTokenizer::HandleUnparsedEntityDecl(void *userData,

View File

@ -125,7 +125,7 @@ CWellFormedDTD::CWellFormedDTD() : nsIDTD(), mFilename("") {
NS_INIT_REFCNT();
mParser=0;
mSink=0;
mLineNumber=0;
mLineNumber=1;
mTokenizer=0;
mDTDState=NS_OK;
}
@ -208,7 +208,7 @@ NS_IMETHODIMP CWellFormedDTD::WillBuildModel(nsString& aFilename,PRBool aNotifyS
mSink=aSink;
if((aNotifySink) && (mSink)) {
mLineNumber=0;
mLineNumber=1;
result = mSink->WillBuildModel();
#if 0