2001-11-28 09:13:11 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-01-09 04:09:02 +03:00
|
|
|
|
1998-07-16 02:30:39 +04:00
|
|
|
#ifndef nsIDTD_h___
|
|
|
|
#define nsIDTD_h___
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MODULE NOTES:
|
1998-07-23 12:21:02 +04:00
|
|
|
* @update gess 7/20/98
|
2001-11-28 09:13:11 +03:00
|
|
|
*
|
|
|
|
* This interface defines standard interface for DTD's. Note that this
|
|
|
|
* isn't HTML specific. DTD's have several functions within the parser
|
|
|
|
* system:
|
|
|
|
* 1) To coordinate the consumption of an input stream via the
|
|
|
|
* parser
|
|
|
|
* 2) To serve as proxy to represent the containment rules of the
|
|
|
|
* underlying document
|
|
|
|
* 3) To offer autodetection services to the parser (mainly for doc
|
|
|
|
* conversion)
|
|
|
|
* */
|
1998-07-23 12:21:02 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsISupports.h"
|
2013-09-23 21:25:00 +04:00
|
|
|
#include "nsString.h"
|
1999-01-09 04:09:02 +03:00
|
|
|
#include "nsITokenizer.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-07-16 02:30:39 +04:00
|
|
|
#define NS_IDTD_IID \
|
2012-01-20 15:16:27 +04:00
|
|
|
{ 0x3de05873, 0xefa7, 0x410d, \
|
|
|
|
{ 0xa4, 0x61, 0x80, 0x33, 0xaf, 0xd9, 0xe3, 0x26 } }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-02-19 02:45:44 +03:00
|
|
|
enum eAutoDetectResult {
|
2001-11-28 09:13:11 +03:00
|
|
|
eUnknownDetect,
|
|
|
|
eValidDetect,
|
|
|
|
ePrimaryDetect,
|
|
|
|
eInvalidDetect
|
1999-02-19 02:45:44 +03:00
|
|
|
};
|
|
|
|
|
2000-05-04 09:53:52 +04:00
|
|
|
enum nsDTDMode {
|
2001-11-28 09:13:11 +03:00
|
|
|
eDTDMode_unknown = 0,
|
|
|
|
eDTDMode_quirks, //pre 4.0 versions
|
2002-06-26 01:16:17 +04:00
|
|
|
eDTDMode_almost_standards,
|
|
|
|
eDTDMode_full_standards,
|
2002-08-29 12:17:41 +04:00
|
|
|
eDTDMode_autodetect,
|
|
|
|
eDTDMode_fragment
|
1999-10-05 08:54:53 +04:00
|
|
|
};
|
1999-02-19 02:45:44 +03:00
|
|
|
|
2000-05-04 09:53:52 +04:00
|
|
|
|
1999-01-26 04:24:31 +03:00
|
|
|
class nsIContentSink;
|
2000-03-25 06:35:50 +03:00
|
|
|
class CParserContext;
|
1998-08-05 06:01:44 +04:00
|
|
|
|
2001-11-28 09:13:11 +03:00
|
|
|
class nsIDTD : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDTD_IID)
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-11-28 09:13:11 +03:00
|
|
|
NS_IMETHOD WillBuildModel(const CParserContext& aParserContext,
|
2002-04-11 02:16:46 +04:00
|
|
|
nsITokenizer* aTokenizer,
|
|
|
|
nsIContentSink* aSink) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-04-25 23:45:14 +04:00
|
|
|
/**
|
1998-07-23 12:21:02 +04:00
|
|
|
* Called by the parser after the parsing process has concluded
|
2001-11-28 09:13:11 +03:00
|
|
|
* @update gess5/18/98
|
|
|
|
* @param anErrorCode - contains error code resulting from parse process
|
1998-06-18 03:13:28 +04:00
|
|
|
* @return
|
1998-04-25 23:45:14 +04:00
|
|
|
*/
|
2009-06-24 01:22:17 +04:00
|
|
|
NS_IMETHOD DidBuildModel(nsresult anErrorCode) = 0;
|
1999-01-09 04:09:02 +03:00
|
|
|
|
|
|
|
/**
|
2009-06-24 01:22:17 +04:00
|
|
|
* Called (possibly repeatedly) by the parser to parse tokens and construct
|
|
|
|
* the document model via the sink provided to WillBuildModel.
|
|
|
|
*
|
|
|
|
* @param aTokenizer - tokenizer providing the token stream to be parsed
|
|
|
|
* @param aCountLines - informs the DTD whether to count newlines
|
|
|
|
* (not wanted, e.g., when handling document.write)
|
|
|
|
* @param aCharsetPtr - address of an nsCString containing the charset
|
|
|
|
* that the DTD should use (pointer in case the DTD
|
|
|
|
* opts to ignore this parameter)
|
1999-01-09 04:09:02 +03:00
|
|
|
*/
|
2013-08-12 19:28:41 +04:00
|
|
|
NS_IMETHOD BuildModel(nsITokenizer* aTokenizer, nsIContentSink* aSink) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-06-19 02:57:25 +04:00
|
|
|
/**
|
2001-11-28 09:13:11 +03:00
|
|
|
* This method is called to determine whether or not a tag of one
|
|
|
|
* type can contain a tag of another type.
|
|
|
|
*
|
|
|
|
* @update gess 3/25/98
|
|
|
|
* @param aParent -- int tag of parent container
|
|
|
|
* @param aChild -- int tag of child container
|
2011-10-17 18:59:28 +04:00
|
|
|
* @return true if parent can contain child
|
1998-06-19 02:57:25 +04:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD_(bool) CanContain(int32_t aParent,int32_t aChild) const = 0;
|
1998-07-10 09:35:23 +04:00
|
|
|
|
1998-08-29 09:08:20 +04:00
|
|
|
/**
|
2001-11-28 09:13:11 +03:00
|
|
|
* This method gets called to determine whether a given
|
|
|
|
* tag is itself a container
|
|
|
|
*
|
|
|
|
* @update gess 3/25/98
|
|
|
|
* @param aTag -- tag to test for containership
|
2011-10-17 18:59:28 +04:00
|
|
|
* @return true if given tag can contain other tags
|
1998-08-29 09:08:20 +04:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD_(bool) IsContainer(int32_t aTag) const = 0;
|
1998-08-29 09:08:20 +04:00
|
|
|
|
1999-07-27 04:54:46 +04:00
|
|
|
/**
|
|
|
|
* Use this id you want to stop the building content model
|
|
|
|
* --------------[ Sets DTD to STOP mode ]----------------
|
|
|
|
* It's recommended to use this method in accordance with
|
|
|
|
* the parser's terminate() method.
|
|
|
|
*
|
2001-11-28 09:13:11 +03:00
|
|
|
* @update harishd 07/22/99
|
|
|
|
* @param
|
1999-07-27 04:54:46 +04:00
|
|
|
* @return
|
|
|
|
*/
|
2002-02-15 02:45:20 +03:00
|
|
|
NS_IMETHOD_(void) Terminate() = 0;
|
1999-07-27 04:54:46 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD_(int32_t) GetType() = 0;
|
2009-06-24 01:22:16 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this method after calling WillBuildModel to determine what mode the
|
|
|
|
* DTD actually is using, as it may differ from aParserContext.mDTDMode.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD_(nsDTDMode) GetMode() const = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDTD, NS_IDTD_IID)
|
|
|
|
|
2002-01-09 04:37:50 +03:00
|
|
|
#define NS_DECL_NSIDTD \
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD WillBuildModel( const CParserContext& aParserContext, nsITokenizer* aTokenizer, nsIContentSink* aSink) override;\
|
|
|
|
NS_IMETHOD DidBuildModel(nsresult anErrorCode) override;\
|
|
|
|
NS_IMETHOD BuildModel(nsITokenizer* aTokenizer, nsIContentSink* aSink) override;\
|
|
|
|
NS_IMETHOD_(bool) CanContain(int32_t aParent,int32_t aChild) const override;\
|
|
|
|
NS_IMETHOD_(bool) IsContainer(int32_t aTag) const override;\
|
|
|
|
NS_IMETHOD_(void) Terminate() override;\
|
|
|
|
NS_IMETHOD_(int32_t) GetType() override;\
|
|
|
|
NS_IMETHOD_(nsDTDMode) GetMode() const override;
|
1998-07-16 02:30:39 +04:00
|
|
|
#endif /* nsIDTD_h___ */
|