michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef nsIHTMLContentSink_h___ michael@0: #define nsIHTMLContentSink_h___ michael@0: michael@0: /** michael@0: * This interface is OBSOLETE and in the process of being REMOVED. michael@0: * Do NOT implement! michael@0: * michael@0: * This file declares the concrete HTMLContentSink class. michael@0: * This class is used during the parsing process as the michael@0: * primary interface between the parser and the content michael@0: * model. michael@0: * michael@0: * After the tokenizer completes, the parser iterates over michael@0: * the known token list. As the parser identifies valid michael@0: * elements, it calls the contentsink interface to notify michael@0: * the content model that a new node or child node is being michael@0: * created and added to the content model. michael@0: * michael@0: * The HTMLContentSink interface assumes 4 underlying michael@0: * containers: HTML, HEAD, BODY and FRAMESET. Before michael@0: * accessing any these, the parser will call the appropriate michael@0: * OpennsIHTMLContentSink method: OpenHTML,OpenHead,OpenBody,OpenFrameSet; michael@0: * likewise, the ClosensIHTMLContentSink version will be called when the michael@0: * parser is done with a given section. michael@0: * michael@0: * IMPORTANT: The parser may Open each container more than michael@0: * once! This is due to the irregular nature of HTML files. michael@0: * For example, it is possible to encounter plain text at michael@0: * the start of an HTML document (that precedes the HTML tag). michael@0: * Such text is treated as if it were part of the body. michael@0: * In such cases, the parser will Open the body, pass the text- michael@0: * node in and then Close the body. The body will likely be michael@0: * re-Opened later when the actual tag has been seen. michael@0: * michael@0: * Containers within the body are Opened and Closed michael@0: * using the OpenContainer(...) and CloseContainer(...) calls. michael@0: * It is assumed that the document or contentSink is michael@0: * maintaining its state to manage where new content should michael@0: * be added to the underlying document. michael@0: * michael@0: * NOTE: OpenHTML() and OpenBody() may get called multiple times michael@0: * in the same document. That's fine, and it doesn't mean michael@0: * that we have multiple bodies or HTML's. michael@0: * michael@0: * NOTE: I haven't figured out how sub-documents (non-frames) michael@0: * are going to be handled. Stay tuned. michael@0: */ michael@0: #include "nsIContentSink.h" michael@0: #include "nsHTMLTags.h" michael@0: michael@0: #define NS_IHTML_CONTENT_SINK_IID \ michael@0: {0xefc5af86, 0x5cfd, 0x4918, {0x9d, 0xd3, 0x5f, 0x7a, 0xb2, 0x88, 0xb2, 0x68}} michael@0: michael@0: /** michael@0: * This interface is OBSOLETE and in the process of being REMOVED. michael@0: * Do NOT implement! michael@0: */ michael@0: class nsIHTMLContentSink : public nsIContentSink michael@0: { michael@0: public: michael@0: michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTML_CONTENT_SINK_IID) michael@0: michael@0: enum ElementType { eHTML, eBody }; michael@0: michael@0: /** michael@0: * This method is used to open a generic container in the sink. michael@0: * michael@0: * @update 4/1/98 gess michael@0: */ michael@0: NS_IMETHOD OpenContainer(ElementType aNodeType) = 0; michael@0: michael@0: /** michael@0: * This method gets called by the parser when a close michael@0: * container tag has been consumed and needs to be closed. michael@0: * michael@0: * @param aTag - The tag to be closed. michael@0: */ michael@0: NS_IMETHOD CloseContainer(ElementType aTag) = 0; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLContentSink, NS_IHTML_CONTENT_SINK_IID) michael@0: michael@0: #endif /* nsIHTMLContentSink_h___ */ michael@0: