From 0127c619d00deb330d81d71bfc91503ffe5d2cfd Mon Sep 17 00:00:00 2001 From: "nisheeth%netscape.com" Date: Sat, 6 Mar 1999 02:01:11 +0000 Subject: [PATCH] Changed nsIContentSink->NotifyError() to accept an nsParserError argument. This change is needed for propagating errors from the new expat parser. git-svn-id: svn://10.0.0.236/trunk@23031 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLContentSink.cpp | 4 ++-- .../xml/document/src/nsXMLContentSink.cpp | 17 ++++++++++++++--- .../content/xml/document/src/nsXMLContentSink.h | 2 +- mozilla/htmlparser/robot/nsRobotSink.cpp | 4 ++-- .../html/document/src/nsHTMLContentSink.cpp | 4 ++-- .../xml/document/src/nsXMLContentSink.cpp | 17 ++++++++++++++--- .../layout/xml/document/src/nsXMLContentSink.h | 2 +- mozilla/parser/htmlparser/robot/nsRobotSink.cpp | 4 ++-- mozilla/rdf/base/src/nsRDFContentSink.cpp | 4 ++-- mozilla/rdf/datasource/src/nsXULContentSink.cpp | 4 ++-- 10 files changed, 42 insertions(+), 20 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 050fd2cd297..baea07dd3c3 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -178,7 +178,7 @@ public: NS_IMETHOD OpenContainer(const nsIParserNode& aNode); NS_IMETHOD CloseContainer(const nsIParserNode& aNode); NS_IMETHOD AddLeaf(const nsIParserNode& aNode); - NS_IMETHOD NotifyError(nsresult aErrorResult); + NS_IMETHOD NotifyError(const nsParserError* aError); NS_IMETHOD AddComment(const nsIParserNode& aNode); NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode); @@ -3083,7 +3083,7 @@ HTMLContentSink::LoadStyleSheet(nsIURL* aURL, } NS_IMETHODIMP -HTMLContentSink::NotifyError(nsresult aErrorResult) +HTMLContentSink::NotifyError(const nsParserError* aError) { // Errors in HTML? Who would have thought! // Why are you telling us, parser. Deal with it yourself. diff --git a/mozilla/content/xml/document/src/nsXMLContentSink.cpp b/mozilla/content/xml/document/src/nsXMLContentSink.cpp index d5c998f27d5..6ea00b3c3fa 100644 --- a/mozilla/content/xml/document/src/nsXMLContentSink.cpp +++ b/mozilla/content/xml/document/src/nsXMLContentSink.cpp @@ -720,9 +720,20 @@ nsXMLContentSink::AddLeaf(const nsIParserNode& aNode) } NS_IMETHODIMP -nsXMLContentSink::NotifyError(nsresult aErrorResult) -{ - printf("nsXMLContentSink::NotifyError\n"); +nsXMLContentSink::NotifyError(const nsParserError* aError) +{ + nsString errorText("XML Parser Error: '"); + + if (aError) { + errorText.Append(aError->description); + errorText.Append("', Line: "); + errorText.Append(aError->lineNumber, 10); + errorText.Append(", Column: "); + errorText.Append(aError->colNumber, 10); + } + + AddText(errorText); + FlushText(); return NS_OK; } diff --git a/mozilla/content/xml/document/src/nsXMLContentSink.h b/mozilla/content/xml/document/src/nsXMLContentSink.h index 1fbc4574efd..f9a820ffeb1 100644 --- a/mozilla/content/xml/document/src/nsXMLContentSink.h +++ b/mozilla/content/xml/document/src/nsXMLContentSink.h @@ -73,7 +73,7 @@ public: NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddComment(const nsIParserNode& aNode); NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode); - NS_IMETHOD NotifyError(nsresult aErrorResult); + NS_IMETHOD NotifyError(const nsParserError* aError); // nsIXMLContentSink NS_IMETHOD AddXMLDecl(const nsIParserNode& aNode); diff --git a/mozilla/htmlparser/robot/nsRobotSink.cpp b/mozilla/htmlparser/robot/nsRobotSink.cpp index 1fb2c0292d0..4c5eb9e457b 100644 --- a/mozilla/htmlparser/robot/nsRobotSink.cpp +++ b/mozilla/htmlparser/robot/nsRobotSink.cpp @@ -63,7 +63,7 @@ public: NS_IMETHOD CloseFrameset(const nsIParserNode& aNode); NS_IMETHOD OpenContainer(const nsIParserNode& aNode); NS_IMETHOD CloseContainer(const nsIParserNode& aNode); - NS_IMETHOD NotifyError(nsresult aErrorResult); + NS_IMETHOD NotifyError(const nsParserError* aError); NS_IMETHOD CloseTopmostContainer(); NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddComment(const nsIParserNode& aNode); @@ -249,7 +249,7 @@ NS_IMETHODIMP RobotSink::AddLeaf(const nsIParserNode& aNode) return NS_OK; } -NS_IMETHODIMP RobotSink::NotifyError(nsresult aErrorResult) +NS_IMETHODIMP RobotSink::NotifyError(const nsParserError* aError) { return NS_OK; } diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index 050fd2cd297..baea07dd3c3 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -178,7 +178,7 @@ public: NS_IMETHOD OpenContainer(const nsIParserNode& aNode); NS_IMETHOD CloseContainer(const nsIParserNode& aNode); NS_IMETHOD AddLeaf(const nsIParserNode& aNode); - NS_IMETHOD NotifyError(nsresult aErrorResult); + NS_IMETHOD NotifyError(const nsParserError* aError); NS_IMETHOD AddComment(const nsIParserNode& aNode); NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode); @@ -3083,7 +3083,7 @@ HTMLContentSink::LoadStyleSheet(nsIURL* aURL, } NS_IMETHODIMP -HTMLContentSink::NotifyError(nsresult aErrorResult) +HTMLContentSink::NotifyError(const nsParserError* aError) { // Errors in HTML? Who would have thought! // Why are you telling us, parser. Deal with it yourself. diff --git a/mozilla/layout/xml/document/src/nsXMLContentSink.cpp b/mozilla/layout/xml/document/src/nsXMLContentSink.cpp index d5c998f27d5..6ea00b3c3fa 100644 --- a/mozilla/layout/xml/document/src/nsXMLContentSink.cpp +++ b/mozilla/layout/xml/document/src/nsXMLContentSink.cpp @@ -720,9 +720,20 @@ nsXMLContentSink::AddLeaf(const nsIParserNode& aNode) } NS_IMETHODIMP -nsXMLContentSink::NotifyError(nsresult aErrorResult) -{ - printf("nsXMLContentSink::NotifyError\n"); +nsXMLContentSink::NotifyError(const nsParserError* aError) +{ + nsString errorText("XML Parser Error: '"); + + if (aError) { + errorText.Append(aError->description); + errorText.Append("', Line: "); + errorText.Append(aError->lineNumber, 10); + errorText.Append(", Column: "); + errorText.Append(aError->colNumber, 10); + } + + AddText(errorText); + FlushText(); return NS_OK; } diff --git a/mozilla/layout/xml/document/src/nsXMLContentSink.h b/mozilla/layout/xml/document/src/nsXMLContentSink.h index 1fbc4574efd..f9a820ffeb1 100644 --- a/mozilla/layout/xml/document/src/nsXMLContentSink.h +++ b/mozilla/layout/xml/document/src/nsXMLContentSink.h @@ -73,7 +73,7 @@ public: NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddComment(const nsIParserNode& aNode); NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode); - NS_IMETHOD NotifyError(nsresult aErrorResult); + NS_IMETHOD NotifyError(const nsParserError* aError); // nsIXMLContentSink NS_IMETHOD AddXMLDecl(const nsIParserNode& aNode); diff --git a/mozilla/parser/htmlparser/robot/nsRobotSink.cpp b/mozilla/parser/htmlparser/robot/nsRobotSink.cpp index 1fb2c0292d0..4c5eb9e457b 100644 --- a/mozilla/parser/htmlparser/robot/nsRobotSink.cpp +++ b/mozilla/parser/htmlparser/robot/nsRobotSink.cpp @@ -63,7 +63,7 @@ public: NS_IMETHOD CloseFrameset(const nsIParserNode& aNode); NS_IMETHOD OpenContainer(const nsIParserNode& aNode); NS_IMETHOD CloseContainer(const nsIParserNode& aNode); - NS_IMETHOD NotifyError(nsresult aErrorResult); + NS_IMETHOD NotifyError(const nsParserError* aError); NS_IMETHOD CloseTopmostContainer(); NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddComment(const nsIParserNode& aNode); @@ -249,7 +249,7 @@ NS_IMETHODIMP RobotSink::AddLeaf(const nsIParserNode& aNode) return NS_OK; } -NS_IMETHODIMP RobotSink::NotifyError(nsresult aErrorResult) +NS_IMETHODIMP RobotSink::NotifyError(const nsParserError* aError) { return NS_OK; } diff --git a/mozilla/rdf/base/src/nsRDFContentSink.cpp b/mozilla/rdf/base/src/nsRDFContentSink.cpp index 1a6eedaf0e5..081dd0d81e0 100644 --- a/mozilla/rdf/base/src/nsRDFContentSink.cpp +++ b/mozilla/rdf/base/src/nsRDFContentSink.cpp @@ -157,7 +157,7 @@ public: NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddComment(const nsIParserNode& aNode); NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode); - NS_IMETHOD NotifyError(nsresult aErrorResult); + NS_IMETHOD NotifyError(const nsParserError* aError); // nsIXMLContentSink NS_IMETHOD AddXMLDecl(const nsIParserNode& aNode); @@ -439,7 +439,7 @@ RDFContentSinkImpl::AddLeaf(const nsIParserNode& aNode) } NS_IMETHODIMP -RDFContentSinkImpl::NotifyError(nsresult aErrorResult) +RDFContentSinkImpl::NotifyError(const nsParserError* aError) { printf("RDFContentSinkImpl::NotifyError\n"); return NS_OK; diff --git a/mozilla/rdf/datasource/src/nsXULContentSink.cpp b/mozilla/rdf/datasource/src/nsXULContentSink.cpp index ef90f0eb5e5..b7e94c14b66 100644 --- a/mozilla/rdf/datasource/src/nsXULContentSink.cpp +++ b/mozilla/rdf/datasource/src/nsXULContentSink.cpp @@ -131,7 +131,7 @@ public: NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddComment(const nsIParserNode& aNode); NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode); - NS_IMETHOD NotifyError(nsresult aErrorResult); + NS_IMETHOD NotifyError(const nsParserError* aError); // nsIXMLContentSink NS_IMETHOD AddXMLDecl(const nsIParserNode& aNode); @@ -530,7 +530,7 @@ XULContentSinkImpl::AddLeaf(const nsIParserNode& aNode) } NS_IMETHODIMP -XULContentSinkImpl::NotifyError(nsresult aErrorResult) +XULContentSinkImpl::NotifyError(const nsParserError* aError) { printf("XULContentSinkImpl::NotifyError\n"); return NS_OK;