| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. | 3 * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 4 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 5 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 5 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 xmlParserCtxtPtr context() const { return m_context; } | 56 xmlParserCtxtPtr context() const { return m_context; } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 XMLParserContext(xmlParserCtxtPtr context) | 59 XMLParserContext(xmlParserCtxtPtr context) |
| 60 : m_context(context) | 60 : m_context(context) |
| 61 { | 61 { |
| 62 } | 62 } |
| 63 xmlParserCtxtPtr m_context; | 63 xmlParserCtxtPtr m_context; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 class XMLDocumentParser : public ScriptableDocumentParser, public ResourceCl
ient { | 66 class XMLDocumentParser FINAL : public ScriptableDocumentParser, public Reso
urceClient { |
| 67 WTF_MAKE_FAST_ALLOCATED; | 67 WTF_MAKE_FAST_ALLOCATED; |
| 68 public: | 68 public: |
| 69 static PassRefPtr<XMLDocumentParser> create(Document* document, FrameVie
w* view) | 69 static PassRefPtr<XMLDocumentParser> create(Document* document, FrameVie
w* view) |
| 70 { | 70 { |
| 71 return adoptRef(new XMLDocumentParser(document, view)); | 71 return adoptRef(new XMLDocumentParser(document, view)); |
| 72 } | 72 } |
| 73 static PassRefPtr<XMLDocumentParser> create(DocumentFragment* fragment,
Element* element, ParserContentPolicy parserContentPolicy) | 73 static PassRefPtr<XMLDocumentParser> create(DocumentFragment* fragment,
Element* element, ParserContentPolicy parserContentPolicy) |
| 74 { | 74 { |
| 75 return adoptRef(new XMLDocumentParser(fragment, element, parserConte
ntPolicy)); | 75 return adoptRef(new XMLDocumentParser(fragment, element, parserConte
ntPolicy)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 ~XMLDocumentParser(); | 78 virtual ~XMLDocumentParser(); |
| 79 | 79 |
| 80 // Exposed for callbacks: | 80 // Exposed for callbacks: |
| 81 void handleError(XMLErrors::ErrorType, const char* message, TextPosition
); | 81 void handleError(XMLErrors::ErrorType, const char* message, TextPosition
); |
| 82 | 82 |
| 83 void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; } | 83 void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; } |
| 84 bool isXHTMLDocument() const { return m_isXHTMLDocument; } | 84 bool isXHTMLDocument() const { return m_isXHTMLDocument; } |
| 85 | 85 |
| 86 bool isCurrentlyParsing8BitChunk() { return m_isCurrentlyParsing8BitChun
k; } | 86 bool isCurrentlyParsing8BitChunk() { return m_isCurrentlyParsing8BitChun
k; } |
| 87 | 87 |
| 88 static bool parseDocumentFragment(const String&, DocumentFragment*, Elem
ent* parent = 0, ParserContentPolicy = AllowScriptingContent); | 88 static bool parseDocumentFragment(const String&, DocumentFragment*, Elem
ent* parent = 0, ParserContentPolicy = AllowScriptingContent); |
| 89 | 89 |
| 90 // Used by the XMLHttpRequest to check if the responseXML was well forme
d. | 90 // Used by the XMLHttpRequest to check if the responseXML was well forme
d. |
| 91 virtual bool wellFormed() const { return !m_sawError; } | 91 virtual bool wellFormed() const OVERRIDE { return !m_sawError; } |
| 92 | 92 |
| 93 TextPosition textPosition() const; | 93 virtual TextPosition textPosition() const OVERRIDE; |
| 94 | 94 |
| 95 static bool supportsXMLVersion(const String&); | 95 static bool supportsXMLVersion(const String&); |
| 96 | 96 |
| 97 class PendingCallback { | 97 class PendingCallback { |
| 98 public: | 98 public: |
| 99 virtual ~PendingCallback() { } | 99 virtual ~PendingCallback() { } |
| 100 virtual void call(XMLDocumentParser*) = 0; | 100 virtual void call(XMLDocumentParser*) = 0; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 XMLDocumentParser(Document*, FrameView* = 0); | 104 XMLDocumentParser(Document*, FrameView* = 0); |
| 105 XMLDocumentParser(DocumentFragment*, Element*, ParserContentPolicy); | 105 XMLDocumentParser(DocumentFragment*, Element*, ParserContentPolicy); |
| 106 | 106 |
| 107 // From DocumentParser | 107 // From DocumentParser |
| 108 virtual void insert(const SegmentedString&); | 108 virtual void insert(const SegmentedString&) OVERRIDE; |
| 109 virtual void append(PassRefPtr<StringImpl>); | 109 virtual void append(PassRefPtr<StringImpl>) OVERRIDE; |
| 110 virtual void finish(); | 110 virtual void finish() OVERRIDE; |
| 111 virtual bool isWaitingForScripts() const; | 111 virtual bool isWaitingForScripts() const OVERRIDE; |
| 112 virtual void stopParsing(); | 112 virtual void stopParsing() OVERRIDE; |
| 113 virtual void detach(); | 113 virtual void detach() OVERRIDE; |
| 114 virtual OrdinalNumber lineNumber() const; | 114 virtual OrdinalNumber lineNumber() const OVERRIDE; |
| 115 OrdinalNumber columnNumber() const; | 115 OrdinalNumber columnNumber() const; |
| 116 | 116 |
| 117 // from ResourceClient | 117 // from ResourceClient |
| 118 virtual void notifyFinished(Resource*); | 118 virtual void notifyFinished(Resource*) OVERRIDE; |
| 119 | 119 |
| 120 void end(); | 120 void end(); |
| 121 | 121 |
| 122 void pauseParsing(); | 122 void pauseParsing(); |
| 123 void resumeParsing(); | 123 void resumeParsing(); |
| 124 | 124 |
| 125 bool appendFragmentSource(const String&); | 125 bool appendFragmentSource(const String&); |
| 126 | 126 |
| 127 public: | 127 public: |
| 128 // callbacks from parser SAX | 128 // callbacks from parser SAX |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 SegmentedString m_pendingSrc; | 191 SegmentedString m_pendingSrc; |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 xmlDocPtr xmlDocPtrForString(ResourceFetcher*, const String& source, const Strin
g& url); | 194 xmlDocPtr xmlDocPtrForString(ResourceFetcher*, const String& source, const Strin
g& url); |
| 195 | 195 |
| 196 HashMap<String, String> parseAttributes(const String&, bool& attrsOK); | 196 HashMap<String, String> parseAttributes(const String&, bool& attrsOK); |
| 197 | 197 |
| 198 } // namespace WebCore | 198 } // namespace WebCore |
| 199 | 199 |
| 200 #endif // XMLDocumentParser_h | 200 #endif // XMLDocumentParser_h |
| OLD | NEW |