Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
nsLoadSaveContentSink Class Reference

This class implements the core of the DOMBuilder for DOM3 Load/Save. More...

#include <nsLoadSaveContentSink.h>

Inheritance diagram for nsLoadSaveContentSink:
Inheritance graph
[legend]
Collaboration diagram for nsLoadSaveContentSink:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsLoadSaveContentSink ()
virtual ~nsLoadSaveContentSink ()
nsresult Init (nsIXMLContentSink *aBaseSink)
 Initializes the sink.
NS_DECL_ISUPPORTS
NS_DECL_NSIEXPATSINK
NS_IMETHOD 
WillBuildModel (void)
 This method gets called when the parser begins the process of building the content model via the content sink.
NS_IMETHOD DidBuildModel (void)
 This method gets called when the parser concludes the process of building the content model via the content sink.
NS_IMETHOD WillInterrupt (void)
 This method gets called when the parser gets i/o blocked, and wants to notify the sink that it may be a while before more data is available.
NS_IMETHOD WillResume (void)
 This method gets called when the parser i/o gets unblocked, and we're about to start dumping content again to the sink.
NS_IMETHOD SetParser (nsIParser *aParser)
 This method gets called by the parser so that the content sink can retain a reference to the parser.
virtual void FlushPendingNotifications (mozFlushType aType)
 Flush content so that the content model is in sync with the state of the sink.
NS_IMETHOD SetDocumentCharset (nsAString &aCharset)
NS_IMETHOD SetDocumentCharset (nsACString &aCharset)=0
 Set the document character set.
virtual nsISupports * GetTarget ()=0
 Returns the target object (often a document object) into which the content built by this content sink is being added, if any (IOW, may return null).
void HandleStartElement (in wstring aName,[array, size_is(aAttsCount)] in wstring aAtts, in unsigned long aAttsCount, in long aIndex, in unsigned long aLineNumber)
 Called to handle the opening tag of an element.
void HandleEndElement (in wstring aName)
 Called to handle the closing tag of an element.
void HandleComment (in wstring aCommentText)
 Called to handle a comment.
void HandleCDataSection ([size_is(aLength)] in wstring aData, in unsigned long aLength)
 Called to handle a CDATA section.
void HandleDoctypeDecl (in AString aSubset, in AString aName, in AString aSystemId, in AString aPublicId, in nsISupports aCatalogData)
 Called to handle the doctype declaration.
void HandleCharacterData ([size_is(aLength)] in wstring aData, in unsigned long aLength)
 Called to handle character data.
void HandleProcessingInstruction (in wstring aTarget, in wstring aData)
 Called to handle a processing instruction.
void HandleXMLDeclaration (in wstring aVersion, in wstring aEncoding, in long aStandalone)
 Handle the XML Declaration.
void ReportError (in wstring aErrorText, in wstring aSourceText)

Private Attributes

nsCOMPtr< nsIXMLContentSinkmBaseSink
 Pointers to the "real" sink.
nsCOMPtr< nsIExpatSinkmExpatSink

Detailed Description

This class implements the core of the DOMBuilder for DOM3 Load/Save.

It holds a reference to an actual content sink that constructs the content model.

Definition at line 52 of file nsLoadSaveContentSink.h.


Constructor & Destructor Documentation

Definition at line 63 of file nsLoadSaveContentSink.cpp.

{
}

Definition at line 67 of file nsLoadSaveContentSink.cpp.

{
}

Member Function Documentation

This method gets called when the parser concludes the process of building the content model via the content sink.

5/7/98 gess

Implements nsIContentSink.

Definition at line 101 of file nsLoadSaveContentSink.cpp.

{
  return mBaseSink->DidBuildModel();
}

Flush content so that the content model is in sync with the state of the sink.

Parameters:
aTypethe type of flush to perform

Implements nsIContentSink.

Definition at line 125 of file nsLoadSaveContentSink.cpp.

{
  mBaseSink->FlushPendingNotifications(aType);
}
virtual nsISupports* nsIContentSink::GetTarget ( ) [pure virtual, inherited]

Returns the target object (often a document object) into which the content built by this content sink is being added, if any (IOW, may return null).

Implemented in HTMLContentSink, RDFContentSinkImpl, XULContentSinkImpl, txStylesheetSink, mozSanitizingHTMLSerializer, RobotSink, nsPlainTextSerializer, nsSAXXMLReader, nsHTMLFragmentContentSink, nsXMLFragmentContentSink, nsXMLContentSink, and nsLoggingSink.

void nsIExpatSink::HandleCDataSection ( [size_is(aLength)] in wstring  aData,
in unsigned long  aLength 
) [inherited]

Called to handle a CDATA section.

Parameters:
aDatathe text in the CDATA section. This is null-terminated.
aLengththe length of the aData string
void nsIExpatSink::HandleCharacterData ( [size_is(aLength)] in wstring  aData,
in unsigned long  aLength 
) [inherited]

Called to handle character data.

Note that this does NOT get called for the contents of CDATA sections.

Parameters:
aDatathe data to handle. aData is NOT NULL-TERMINATED.
aLengththe length of the aData string
void nsIExpatSink::HandleComment ( in wstring  aCommentText) [inherited]

Called to handle a comment.

Parameters:
aCommentTextthe text of the comment (not including the "<!--" and "-->")
void nsIExpatSink::HandleDoctypeDecl ( in AString  aSubset,
in AString  aName,
in AString  aSystemId,
in AString  aPublicId,
in nsISupports  aCatalogData 
) [inherited]

Called to handle the doctype declaration.

void nsIExpatSink::HandleEndElement ( in wstring  aName) [inherited]

Called to handle the closing tag of an element.

Parameters:
aNamethe fully qualified tagname of the element
void nsIExpatSink::HandleProcessingInstruction ( in wstring  aTarget,
in wstring  aData 
) [inherited]

Called to handle a processing instruction.

Parameters:
aTargetthe PI target (e.g. xml-stylesheet)
aDataall the rest of the data in the PI
void nsIExpatSink::HandleStartElement ( in wstring  aName,
[array, size_is(aAttsCount)] in wstring  aAtts,
in unsigned long  aAttsCount,
in long  aIndex,
in unsigned long  aLineNumber 
) [inherited]

Called to handle the opening tag of an element.

Parameters:
aNamethe fully qualified tagname of the element
aAttsthe array of attribute names and values. There are aAttsCount/2 names and aAttsCount/2 values, so the total number of elements in the array is aAttsCount. The names and values alternate. Thus, if we number attributes starting with 0, aAtts[2*k] is the name of the k-th attribute and aAtts[2*k+1] is the value of that attribute Both explicitly specified attributes and attributes that are defined to have default values in a DTD are present in aAtts.
aAttsCountthe number of elements in aAtts.
aIndexIf the element has an attribute of type ID, then aAtts[aIndex] is the name of that attribute. Otherwise, aIndex is -1
aLineNumberthe line number of the start tag in the data stream.
void nsIExpatSink::HandleXMLDeclaration ( in wstring  aVersion,
in wstring  aEncoding,
in long  aStandalone 
) [inherited]

Handle the XML Declaration.

Parameters:
aVersionThe version string, can be null if not specified.
aEncodingThe encoding string, can be null if not specified.
aStandalone-1, 0, or 1 indicating respectively that there was no standalone parameter in the declaration, that it was given as no, or that it was given as yes.

Initializes the sink.

This will return an error if the arguments do not satisfy some basic sanity-checks.

Parameters:
aBaseSinka "real" sink that the LoadSave sink can use to build the document. This must be non-null and must also implement nsIExpatSink.

Definition at line 72 of file nsLoadSaveContentSink.cpp.

{
  NS_PRECONDITION(aBaseSink, "aBaseSink needs to exist");
  mBaseSink = aBaseSink;
  mExpatSink = do_QueryInterface(aBaseSink);
  if (!mExpatSink) {
    return NS_ERROR_INVALID_ARG;
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIExpatSink::ReportError ( in wstring  aErrorText,
in wstring  aSourceText 
) [inherited]

Definition at line 131 of file nsLoadSaveContentSink.cpp.

{
  return mBaseSink->SetDocumentCharset(aCharset);
}
NS_IMETHOD nsIContentSink::SetDocumentCharset ( nsACString &  aCharset) [pure virtual, inherited]

This method gets called by the parser so that the content sink can retain a reference to the parser.

The expectation is that the content sink will drop the reference when it gets the DidBuildModel notification i.e. when parsing is done.

Implements nsIContentSink.

Definition at line 119 of file nsLoadSaveContentSink.cpp.

{
  return mBaseSink->SetParser(aParser);
}

This method gets called when the parser begins the process of building the content model via the content sink.

5/7/98 gess

Implements nsIContentSink.

Definition at line 95 of file nsLoadSaveContentSink.cpp.

{
  return mBaseSink->WillBuildModel();
}

Here is the call graph for this function:

Here is the caller graph for this function:

This method gets called when the parser gets i/o blocked, and wants to notify the sink that it may be a while before more data is available.

5/7/98 gess

Implements nsIContentSink.

Definition at line 107 of file nsLoadSaveContentSink.cpp.

{
  return mBaseSink->WillInterrupt();
}

This method gets called when the parser i/o gets unblocked, and we're about to start dumping content again to the sink.

5/7/98 gess

Implements nsIContentSink.

Definition at line 113 of file nsLoadSaveContentSink.cpp.

{
  return mBaseSink->WillResume();
}

Member Data Documentation

Pointers to the "real" sink.

We hold on to both just for convenience sake.

Definition at line 85 of file nsLoadSaveContentSink.h.

Definition at line 86 of file nsLoadSaveContentSink.h.


The documentation for this class was generated from the following files: