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: michael@0: #ifndef nsSAXXMLReader_h__ michael@0: #define nsSAXXMLReader_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIContentSink.h" michael@0: #include "nsIExtendedExpatSink.h" michael@0: #include "nsIParser.h" michael@0: #include "nsIURI.h" michael@0: #include "nsISAXXMLReader.h" michael@0: #include "nsISAXContentHandler.h" michael@0: #include "nsISAXDTDHandler.h" michael@0: #include "nsISAXErrorHandler.h" michael@0: #include "nsISAXLexicalHandler.h" michael@0: #include "nsIMozSAXXMLDeclarationHandler.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: #define NS_SAXXMLREADER_CONTRACTID "@mozilla.org/saxparser/xmlreader;1" michael@0: #define NS_SAXXMLREADER_CID \ michael@0: { 0xab1da296, 0x6125, 0x40ba, \ michael@0: { 0x96, 0xd0, 0x47, 0xa8, 0x28, 0x2a, 0xe3, 0xdb} } michael@0: michael@0: class nsSAXXMLReader MOZ_FINAL : public nsISAXXMLReader, michael@0: public nsIExtendedExpatSink, michael@0: public nsIContentSink michael@0: { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsSAXXMLReader, nsISAXXMLReader) michael@0: NS_DECL_NSIEXPATSINK michael@0: NS_DECL_NSIEXTENDEDEXPATSINK michael@0: NS_DECL_NSISAXXMLREADER michael@0: NS_DECL_NSIREQUESTOBSERVER michael@0: NS_DECL_NSISTREAMLISTENER michael@0: michael@0: nsSAXXMLReader(); michael@0: michael@0: //nsIContentSink michael@0: NS_IMETHOD WillParse() michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode); michael@0: NS_IMETHOD DidBuildModel(bool aTerminated); michael@0: NS_IMETHOD SetParser(nsParserBase* aParser); michael@0: michael@0: NS_IMETHOD WillInterrupt() michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHOD WillResume() michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: virtual void FlushPendingNotifications(mozFlushType aType) michael@0: { michael@0: } michael@0: michael@0: NS_IMETHOD SetDocumentCharset(nsACString& aCharset) michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: virtual nsISupports *GetTarget() michael@0: { michael@0: return nullptr; michael@0: } michael@0: michael@0: private: michael@0: nsCOMPtr mContentHandler; michael@0: nsCOMPtr mDTDHandler; michael@0: nsCOMPtr mErrorHandler; michael@0: nsCOMPtr mLexicalHandler; michael@0: nsCOMPtr mDeclarationHandler; michael@0: nsCOMPtr mBaseURI; michael@0: nsCOMPtr mListener; michael@0: nsCOMPtr mParserObserver; michael@0: bool mIsAsyncParse; michael@0: static bool TryChannelCharset(nsIChannel *aChannel, michael@0: int32_t& aCharsetSource, michael@0: nsACString& aCharset); michael@0: nsresult EnsureBaseURI(); michael@0: nsresult InitParser(nsIRequestObserver *aListener, nsIChannel *aChannel); michael@0: nsresult SplitExpatName(const char16_t *aExpatName, michael@0: nsString &aURI, michael@0: nsString &aLocalName, michael@0: nsString &aQName); michael@0: nsString mPublicId; michael@0: nsString mSystemId; michael@0: michael@0: // Feature flags michael@0: bool mEnableNamespacePrefixes; michael@0: }; michael@0: michael@0: #endif // nsSAXXMLReader_h__