1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsIXMLContentSink_h___
7 #define nsIXMLContentSink_h___
8 
9 #include "nsIContentSink.h"
10 #include "nsISupports.h"
11 
12 class nsIURI;
13 class nsIChannel;
14 namespace mozilla {
15 namespace dom {
16 class Document;
17 }
18 }  // namespace mozilla
19 
20 #define NS_IXMLCONTENT_SINK_IID                      \
21   {                                                  \
22     0x63fedea0, 0x9b0f, 0x4d64, {                    \
23       0x9b, 0xa5, 0x37, 0xc6, 0x99, 0x73, 0x29, 0x35 \
24     }                                                \
25   }
26 
27 /**
28  * This interface represents a content sink for generic XML files.
29  * The goal of this sink is to deal with XML documents that do not
30  * have pre-built semantics, though it may also be implemented for
31  * cases in which semantics are hard-wired.
32  *
33  * The expectation is that the parser has already performed
34  * well-formedness and validity checking.
35  *
36  * XXX The expectation is that entity expansion will be done by the sink
37  * itself. This would require, however, that the sink has the ability
38  * to query the parser for entity replacement text.
39  *
40  * XXX This interface does not contain a mechanism for the sink to
41  * get specific schema/DTD information from the parser. This information
42  * may be necessary for entity expansion. It is also necessary for
43  * building the DOM portions that relate to the schema.
44  *
45  * XXX This interface does not deal with the presence of an external
46  * subset. It seems possible that this could be dealt with completely
47  * at the parser level.
48  */
49 
50 class nsIXMLContentSink : public nsIContentSink {
51  public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXMLCONTENT_SINK_IID)52   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXMLCONTENT_SINK_IID)
53   virtual bool IsPrettyPrintXML() const { return false; }
IsPrettyPrintHasSpecialRoot()54   virtual bool IsPrettyPrintHasSpecialRoot() const { return false; }
55 };
56 
57 NS_DEFINE_STATIC_IID_ACCESSOR(nsIXMLContentSink, NS_IXMLCONTENT_SINK_IID)
58 
59 nsresult NS_NewXMLContentSink(nsIXMLContentSink** aInstancePtrResult,
60                               mozilla::dom::Document* aDoc, nsIURI* aURL,
61                               nsISupports* aContainer, nsIChannel* aChannel);
62 
63 #endif  // nsIXMLContentSink_h___
64