Added XML display support. Added NotifyError method to nsIContentSink

git-svn-id: svn://10.0.0.236/trunk@14466 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
vidur%netscape.com
1998-11-11 22:04:42 +00:00
parent 4b5a532b07
commit 38bf6d6724
16 changed files with 82 additions and 12 deletions

View File

@@ -67,6 +67,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 CloseTopmostContainer();
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
NS_IMETHOD AddComment(const nsIParserNode& aNode);
@@ -251,6 +252,11 @@ NS_IMETHODIMP RobotSink::AddLeaf(const nsIParserNode& aNode)
return NS_OK;
}
NS_IMETHODIMP RobotSink::NotifyError(nsresult aErrorResult)
{
return NS_OK;
}
/**
* This gets called by the parsing system when we find a comment
* @update gess11/9/98

View File

@@ -93,7 +93,6 @@ static eHTMLTags gWhitespaceTags[]={
static CTokenRecycler gTokenRecycler;
/************************************************************************
And now for the main class -- CNavDTD...
************************************************************************/
@@ -3200,7 +3199,9 @@ CNavDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
* @return new token or null
*/
nsresult
CNavDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
CNavDTD::ConsumeWhitespace(PRUnichar aChar,
CScanner& aScanner,
CToken*& aToken) {
aToken = gTokenRecycler.CreateTokenOfType(eToken_whitespace,eHTMLTag_whitespace,gEmpty);
nsresult result=kNoError;
if(aToken) {

View File

@@ -908,7 +908,11 @@ nsHTMLContentSinkStream::WillResume(void) {
return NS_OK;
}
NS_IMETHODIMP
nsHTMLContentSinkStream::NotifyError(nsresult aErrorResult)
{
return NS_OK;
}
/**

View File

@@ -92,6 +92,7 @@ class nsHTMLContentSinkStream : public nsIHTMLContentSink {
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 AddComment(const nsIParserNode& aNode);
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);

View File

@@ -46,6 +46,8 @@ 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 AddProcessingInstruction(const nsIParserNode& aNode);
NS_IMETHOD AddComment(const nsIParserNode& aNode);
@@ -568,5 +570,9 @@ nsHTMLNullSink::WillResume(void) {
return NS_OK;
}
NS_IMETHODIMP
nsHTMLNullSink::NotifyError(nsresult aErrorResult)
{
return NS_OK;
}

View File

@@ -122,6 +122,13 @@ public:
*/
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) = 0;
/**
* This gets called by the parser if it hits an unrecoverable
* error (in XML, if the document is not well-formed or valid).
*
* @param aErrorResult the error code
*/
NS_IMETHOD NotifyError(nsresult aErrorResult)=0;
};
#endif /* nsIContentSink_h___ */

View File

@@ -79,6 +79,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 AddComment(const nsIParserNode& aNode);
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
@@ -241,6 +242,12 @@ nsLoggingSink::AddLeaf(const nsIParserNode& aNode)
return LeafNode(aNode);
}
NS_IMETHODIMP
nsLoggingSink::NotifyError(nsresult aErrorResult)
{
return NS_OK;
}
/**
* This gets called by the parser when you want to add

View File

@@ -200,6 +200,7 @@ NS_IMETHODIMP CWellFormedDTD::WillBuildModel(nsString& aFilename,PRBool aNotifyS
mLineNumber=0;
result = mSink->WillBuildModel();
#if 0
/* COMMENT OUT THIS BLOCK IF: you aren't using an nsHTMLContentSink...*/
{
nsIHTMLContentSink* theSink=(nsIHTMLContentSink*)mSink;
@@ -215,6 +216,7 @@ NS_IMETHODIMP CWellFormedDTD::WillBuildModel(nsString& aFilename,PRBool aNotifyS
theSink->OpenBody(theBodyNode);
}
/* COMMENT OUT THIS BLOCK IF: you aren't using an nsHTMLContentSink...*/
#endif
}
return result;
@@ -232,7 +234,9 @@ NS_IMETHODIMP CWellFormedDTD::DidBuildModel(PRInt32 anErrorCode,PRBool aNotifySi
//ADD CODE HERE TO CLOSE OPEN CONTAINERS...
if((aNotifySink) && (mSink)) {
result = mSink->DidBuildModel(1);
#if 0
/* COMMENT OUT THIS BLOCK IF: you aren't using an nsHTMLContentSink...*/
{
nsIHTMLContentSink* theSink=(nsIHTMLContentSink*)mSink;
@@ -247,10 +251,9 @@ NS_IMETHODIMP CWellFormedDTD::DidBuildModel(PRInt32 anErrorCode,PRBool aNotifySi
nsCParserNode theHTMLNode(&theBodyToken,0);
theSink->CloseHTML(theBodyNode);
result = mSink->DidBuildModel(1);
}
/* COMMENT OUT THIS BLOCK IF: you aren't using an nsHTMLContentSink...*/
#endif
}
return result;
}

View File

@@ -67,6 +67,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 CloseTopmostContainer();
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
NS_IMETHOD AddComment(const nsIParserNode& aNode);
@@ -251,6 +252,11 @@ NS_IMETHODIMP RobotSink::AddLeaf(const nsIParserNode& aNode)
return NS_OK;
}
NS_IMETHODIMP RobotSink::NotifyError(nsresult aErrorResult)
{
return NS_OK;
}
/**
* This gets called by the parsing system when we find a comment
* @update gess11/9/98

View File

@@ -93,7 +93,6 @@ static eHTMLTags gWhitespaceTags[]={
static CTokenRecycler gTokenRecycler;
/************************************************************************
And now for the main class -- CNavDTD...
************************************************************************/
@@ -3200,7 +3199,9 @@ CNavDTD::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
* @return new token or null
*/
nsresult
CNavDTD::ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,CToken*& aToken) {
CNavDTD::ConsumeWhitespace(PRUnichar aChar,
CScanner& aScanner,
CToken*& aToken) {
aToken = gTokenRecycler.CreateTokenOfType(eToken_whitespace,eHTMLTag_whitespace,gEmpty);
nsresult result=kNoError;
if(aToken) {

View File

@@ -908,7 +908,11 @@ nsHTMLContentSinkStream::WillResume(void) {
return NS_OK;
}
NS_IMETHODIMP
nsHTMLContentSinkStream::NotifyError(nsresult aErrorResult)
{
return NS_OK;
}
/**

View File

@@ -92,6 +92,7 @@ class nsHTMLContentSinkStream : public nsIHTMLContentSink {
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 AddComment(const nsIParserNode& aNode);
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);

View File

@@ -46,6 +46,8 @@ 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 AddProcessingInstruction(const nsIParserNode& aNode);
NS_IMETHOD AddComment(const nsIParserNode& aNode);
@@ -568,5 +570,9 @@ nsHTMLNullSink::WillResume(void) {
return NS_OK;
}
NS_IMETHODIMP
nsHTMLNullSink::NotifyError(nsresult aErrorResult)
{
return NS_OK;
}

View File

@@ -122,6 +122,13 @@ public:
*/
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) = 0;
/**
* This gets called by the parser if it hits an unrecoverable
* error (in XML, if the document is not well-formed or valid).
*
* @param aErrorResult the error code
*/
NS_IMETHOD NotifyError(nsresult aErrorResult)=0;
};
#endif /* nsIContentSink_h___ */

View File

@@ -79,6 +79,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 AddComment(const nsIParserNode& aNode);
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
@@ -241,6 +242,12 @@ nsLoggingSink::AddLeaf(const nsIParserNode& aNode)
return LeafNode(aNode);
}
NS_IMETHODIMP
nsLoggingSink::NotifyError(nsresult aErrorResult)
{
return NS_OK;
}
/**
* This gets called by the parser when you want to add

View File

@@ -200,6 +200,7 @@ NS_IMETHODIMP CWellFormedDTD::WillBuildModel(nsString& aFilename,PRBool aNotifyS
mLineNumber=0;
result = mSink->WillBuildModel();
#if 0
/* COMMENT OUT THIS BLOCK IF: you aren't using an nsHTMLContentSink...*/
{
nsIHTMLContentSink* theSink=(nsIHTMLContentSink*)mSink;
@@ -215,6 +216,7 @@ NS_IMETHODIMP CWellFormedDTD::WillBuildModel(nsString& aFilename,PRBool aNotifyS
theSink->OpenBody(theBodyNode);
}
/* COMMENT OUT THIS BLOCK IF: you aren't using an nsHTMLContentSink...*/
#endif
}
return result;
@@ -232,7 +234,9 @@ NS_IMETHODIMP CWellFormedDTD::DidBuildModel(PRInt32 anErrorCode,PRBool aNotifySi
//ADD CODE HERE TO CLOSE OPEN CONTAINERS...
if((aNotifySink) && (mSink)) {
result = mSink->DidBuildModel(1);
#if 0
/* COMMENT OUT THIS BLOCK IF: you aren't using an nsHTMLContentSink...*/
{
nsIHTMLContentSink* theSink=(nsIHTMLContentSink*)mSink;
@@ -247,10 +251,9 @@ NS_IMETHODIMP CWellFormedDTD::DidBuildModel(PRInt32 anErrorCode,PRBool aNotifySi
nsCParserNode theHTMLNode(&theBodyToken,0);
theSink->CloseHTML(theBodyNode);
result = mSink->DidBuildModel(1);
}
/* COMMENT OUT THIS BLOCK IF: you aren't using an nsHTMLContentSink...*/
#endif
}
return result;
}