Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
COtherDTD.h File Reference
#include "nsIDTD.h"
#include "nsISupports.h"
#include "nsIParser.h"
#include "nsHTMLTokens.h"
#include "nsVoidArray.h"
#include "nsDeque.h"
#include "nsParserCIID.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


class  COtherDTD
class  CTransitionalDTD


 MODULE NOTES: gess 7/15/98.


nsresult NS_NewOtherHTMLDTD (nsIDTD **aInstancePtrResult)
 This method is defined in nsIParser.

Define Documentation

{0x8a5e89c0, 0xd16d,  0x11d1,  \
  {0x80, 0x22, 0x00,    0x60, 0x8, 0x14, 0x98, 0x89}}

MODULE NOTES: gess 7/15/98.

NavDTD is an implementation of the nsIDTD interface. In particular, this class captures the behaviors of the original Navigator parser productions.

This DTD, like any other in NGLayout, provides a few basic services:

  • First, the DTD collaborates with the Parser class to convert plain text into a sequence of HTMLTokens.
  • Second, the DTD describes containment rules for known elements.
  • Third the DTD controls and coordinates the interaction between the parsing system and content sink. (The content sink is the interface that serves as a proxy for content model).
  • Fourth the DTD maintains an internal style-stack to handle residual (leaky) style tags.

You're most likely working in this class file because you want to add or change a behavior inherent in this DTD. The remainder of this section will describe what you need to do to affect the kind of change you want in this DTD.

RESIDUAL-STYLE HANDLNG: There are a number of ways to represent style in an HTML document. 1) explicit style tags (, etc) 2) implicit styles (like those implicit in <Hn>) 3) CSS based styles

Residual style handling results from explicit style tags that are not closed. Consider this example:

text bold

When the

tag closes, the tag is NOT automatically closed. Unclosed style tags are handled by the process we call residual-style tag handling.

There are two aspects to residual style tag handling. The first is the construction and managing of a stack of residual style tags. The second is the automatic emission of residual style tags onto leaf content in subsequent portions of the document.This step is necessary to propagate the expected style behavior to subsequent portions of the document.

Construction and managing the residual style stack is an inline process that occurs during the model building phase of the parse process. During the model- building phase of the parse process, a content stack is maintained which tracks the open container hierarchy. If a style tag(s) fails to be closed when a normal container is closed, that style tag is placed onto the residual style stack. If that style tag is subsequently closed (in most contexts), it is popped off the residual style stack -- and are of no further concern.

Residual style tag emission occurs when the style stack is not empty, and leaf content occurs. In our earlier example, the tag "leaked" out of the

container. Just before the next leaf is emitted (in this or another container) the style tags that are on the stack are emitted in succession. These same residual style tags get closed automatically when the leaf's container closes, or if a child container is opened.

Definition at line 107 of file COtherDTD.h.

Function Documentation

nsresult NS_NewOtherHTMLDTD ( nsIDTD **  aInstancePtrResult)

This method is defined in nsIParser.

It is used to cause the COM-like construction of an nsParser.

gess 4/8/98

nsIParser**ptr to newly instantiated parser
NS_xxx error result

Definition at line 210 of file COtherDTD.cpp.

  COtherDTD* it = new COtherDTD();

  if (it == 0) {

  return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);