#ifndef XML_Tokenizer_h_
#define XML_Tokenizer_h_
#include "StringHash.h"
#include <wtf/HashMap.h>
namespace WebCore {
class DocLoader;
class DocumentFragment;
class Document;
class Element;
class FrameView;
class SegmentedString;
class Tokenizer
{
public:
Tokenizer(bool viewSourceMode = false)
: m_parserStopped(false)
, m_inViewSourceMode(viewSourceMode)
{}
virtual ~Tokenizer() {}
virtual bool write(const SegmentedString&, bool appendData) = 0;
virtual void finish() = 0;
virtual bool isWaitingForScripts() const = 0;
virtual void stopParsing() { m_parserStopped = true; }
virtual bool processingData() const { return false; }
virtual int executingScript() const { return 0; }
virtual void parsePending() { }
virtual bool wantsRawData() const { return false; }
virtual bool writeRawData(const char* data, int len) { return false; }
bool inViewSourceMode() const { return m_inViewSourceMode; }
void setInViewSourceMode(bool mode) { m_inViewSourceMode = mode; }
virtual int lineNumber() const { return -1; }
virtual int columnNumber() const { return -1; }
protected:
bool m_parserStopped;
bool m_inViewSourceMode;
};
Tokenizer* newXMLTokenizer(Document*, FrameView* = 0);
#if KHTML_XSLT
void* xmlDocPtrForString(DocLoader*, const DeprecatedString& source, const DeprecatedString& URL);
void setLoaderForLibXMLCallbacks(DocLoader*);
#endif
HashMap<String, String> parseAttributes(const String&, bool& attrsOK);
bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent = 0);
}
#endif