2006-04-17 05:13:07 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
2006-04-17 05:13:07 +04:00
|
|
|
|
|
|
|
#ifndef nsSAXXMLReader_h__
|
|
|
|
#define nsSAXXMLReader_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIContentSink.h"
|
|
|
|
#include "nsIExtendedExpatSink.h"
|
|
|
|
#include "nsIParser.h"
|
|
|
|
#include "nsIURI.h"
|
|
|
|
#include "nsISAXXMLReader.h"
|
|
|
|
#include "nsISAXContentHandler.h"
|
|
|
|
#include "nsISAXDTDHandler.h"
|
|
|
|
#include "nsISAXErrorHandler.h"
|
|
|
|
#include "nsISAXLexicalHandler.h"
|
2012-12-18 05:53:38 +04:00
|
|
|
#include "nsIMozSAXXMLDeclarationHandler.h"
|
2007-09-28 07:00:35 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-06-13 08:07:59 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2017-06-18 14:37:50 +03:00
|
|
|
#include "mozilla/NotNull.h"
|
2006-04-17 05:13:07 +04:00
|
|
|
|
|
|
|
#define NS_SAXXMLREADER_CONTRACTID "@mozilla.org/saxparser/xmlreader;1"
|
|
|
|
#define NS_SAXXMLREADER_CID \
|
|
|
|
{ 0xab1da296, 0x6125, 0x40ba, \
|
|
|
|
{ 0x96, 0xd0, 0x47, 0xa8, 0x28, 0x2a, 0xe3, 0xdb} }
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsSAXXMLReader final : public nsISAXXMLReader,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsIExtendedExpatSink,
|
|
|
|
public nsIContentSink
|
2006-04-17 05:13:07 +04:00
|
|
|
{
|
|
|
|
public:
|
2007-09-28 07:00:35 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsSAXXMLReader, nsISAXXMLReader)
|
2006-04-17 05:13:07 +04:00
|
|
|
NS_DECL_NSIEXPATSINK
|
|
|
|
NS_DECL_NSIEXTENDEDEXPATSINK
|
|
|
|
NS_DECL_NSISAXXMLREADER
|
2006-04-24 21:01:40 +04:00
|
|
|
NS_DECL_NSIREQUESTOBSERVER
|
|
|
|
NS_DECL_NSISTREAMLISTENER
|
2006-04-17 05:13:07 +04:00
|
|
|
|
|
|
|
nsSAXXMLReader();
|
|
|
|
|
|
|
|
//nsIContentSink
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD WillParse() override
|
2007-01-31 00:21:06 +03:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) override;
|
|
|
|
NS_IMETHOD DidBuildModel(bool aTerminated) override;
|
|
|
|
NS_IMETHOD SetParser(nsParserBase* aParser) override;
|
2006-04-17 05:13:07 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD WillInterrupt() override
|
2006-04-17 05:13:07 +04:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD WillResume() override
|
2006-04-17 05:13:07 +04:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-01-05 10:31:56 +03:00
|
|
|
virtual void FlushPendingNotifications(mozilla::FlushType aType) override
|
2006-04-17 05:13:07 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-06-18 14:37:50 +03:00
|
|
|
virtual void SetDocumentCharset(NotNull<const Encoding*> aEncoding) override
|
2006-04-17 05:13:07 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsISupports *GetTarget() override
|
2006-04-17 05:13:07 +04:00
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2006-04-17 05:13:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-06-27 22:41:03 +04:00
|
|
|
~nsSAXXMLReader() {}
|
|
|
|
|
2006-04-17 05:13:07 +04:00
|
|
|
nsCOMPtr<nsISAXContentHandler> mContentHandler;
|
|
|
|
nsCOMPtr<nsISAXDTDHandler> mDTDHandler;
|
|
|
|
nsCOMPtr<nsISAXErrorHandler> mErrorHandler;
|
|
|
|
nsCOMPtr<nsISAXLexicalHandler> mLexicalHandler;
|
2012-12-18 05:53:38 +04:00
|
|
|
nsCOMPtr<nsIMozSAXXMLDeclarationHandler> mDeclarationHandler;
|
2006-04-17 05:13:07 +04:00
|
|
|
nsCOMPtr<nsIURI> mBaseURI;
|
2006-04-24 21:01:40 +04:00
|
|
|
nsCOMPtr<nsIStreamListener> mListener;
|
|
|
|
nsCOMPtr<nsIRequestObserver> mParserObserver;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsAsyncParse;
|
|
|
|
static bool TryChannelCharset(nsIChannel *aChannel,
|
2017-06-18 14:37:50 +03:00
|
|
|
int32_t& aCharsetSource,
|
|
|
|
NotNull<const Encoding*>& aEncoding);
|
2006-07-10 19:32:58 +04:00
|
|
|
nsresult EnsureBaseURI();
|
2006-06-07 03:06:12 +04:00
|
|
|
nsresult InitParser(nsIRequestObserver *aListener, nsIChannel *aChannel);
|
2014-01-04 19:02:17 +04:00
|
|
|
nsresult SplitExpatName(const char16_t *aExpatName,
|
2006-04-17 05:13:07 +04:00
|
|
|
nsString &aURI,
|
|
|
|
nsString &aLocalName,
|
|
|
|
nsString &aQName);
|
2006-09-13 22:20:05 +04:00
|
|
|
nsString mPublicId;
|
|
|
|
nsString mSystemId;
|
2012-11-05 00:38:00 +04:00
|
|
|
|
|
|
|
// Feature flags
|
|
|
|
bool mEnableNamespacePrefixes;
|
2006-04-17 05:13:07 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsSAXXMLReader_h__
|