Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsSAXXMLReader_h__
7 #define nsSAXXMLReader_h__
9 #include "nsCOMPtr.h"
10 #include "nsIContentSink.h"
11 #include "nsIExtendedExpatSink.h"
12 #include "nsIParser.h"
13 #include "nsIURI.h"
14 #include "nsISAXXMLReader.h"
15 #include "nsISAXContentHandler.h"
16 #include "nsISAXDTDHandler.h"
17 #include "nsISAXErrorHandler.h"
18 #include "nsISAXLexicalHandler.h"
19 #include "nsIMozSAXXMLDeclarationHandler.h"
20 #include "nsCycleCollectionParticipant.h"
21 #include "mozilla/Attributes.h"
23 #define NS_SAXXMLREADER_CONTRACTID "@mozilla.org/saxparser/xmlreader;1"
24 #define NS_SAXXMLREADER_CID \
25 { 0xab1da296, 0x6125, 0x40ba, \
26 { 0x96, 0xd0, 0x47, 0xa8, 0x28, 0x2a, 0xe3, 0xdb} }
28 class nsSAXXMLReader MOZ_FINAL : public nsISAXXMLReader,
29 public nsIExtendedExpatSink,
30 public nsIContentSink
31 {
32 public:
33 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
34 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsSAXXMLReader, nsISAXXMLReader)
35 NS_DECL_NSIEXPATSINK
36 NS_DECL_NSIEXTENDEDEXPATSINK
37 NS_DECL_NSISAXXMLREADER
38 NS_DECL_NSIREQUESTOBSERVER
39 NS_DECL_NSISTREAMLISTENER
41 nsSAXXMLReader();
43 //nsIContentSink
44 NS_IMETHOD WillParse()
45 {
46 return NS_OK;
47 }
49 NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode);
50 NS_IMETHOD DidBuildModel(bool aTerminated);
51 NS_IMETHOD SetParser(nsParserBase* aParser);
53 NS_IMETHOD WillInterrupt()
54 {
55 return NS_OK;
56 }
58 NS_IMETHOD WillResume()
59 {
60 return NS_OK;
61 }
63 virtual void FlushPendingNotifications(mozFlushType aType)
64 {
65 }
67 NS_IMETHOD SetDocumentCharset(nsACString& aCharset)
68 {
69 return NS_OK;
70 }
72 virtual nsISupports *GetTarget()
73 {
74 return nullptr;
75 }
77 private:
78 nsCOMPtr<nsISAXContentHandler> mContentHandler;
79 nsCOMPtr<nsISAXDTDHandler> mDTDHandler;
80 nsCOMPtr<nsISAXErrorHandler> mErrorHandler;
81 nsCOMPtr<nsISAXLexicalHandler> mLexicalHandler;
82 nsCOMPtr<nsIMozSAXXMLDeclarationHandler> mDeclarationHandler;
83 nsCOMPtr<nsIURI> mBaseURI;
84 nsCOMPtr<nsIStreamListener> mListener;
85 nsCOMPtr<nsIRequestObserver> mParserObserver;
86 bool mIsAsyncParse;
87 static bool TryChannelCharset(nsIChannel *aChannel,
88 int32_t& aCharsetSource,
89 nsACString& aCharset);
90 nsresult EnsureBaseURI();
91 nsresult InitParser(nsIRequestObserver *aListener, nsIChannel *aChannel);
92 nsresult SplitExpatName(const char16_t *aExpatName,
93 nsString &aURI,
94 nsString &aLocalName,
95 nsString &aQName);
96 nsString mPublicId;
97 nsString mSystemId;
99 // Feature flags
100 bool mEnableNamespacePrefixes;
101 };
103 #endif // nsSAXXMLReader_h__