1/* 2 * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19#ifndef RSSAtomParser_h 20#define RSSAtomParser_h 21 22#include "KURL.h" 23#include "RSSParserBase.h" 24 25namespace WebCore { 26 27class RSSAtomLink { 28public: 29 enum Type { 30 TypeUnknown, 31 TypeAlternate, 32 TypeRelated, 33 TypeSelf, 34 TypeEnclosure, 35 TypeVia, 36 TypeUnsupported 37 }; 38 39 RSSAtomLink() 40 : m_typeInEnum(TypeUnknown) 41 { } 42 43 Type relType(); 44 45 String m_rel; 46 String m_href; 47 String m_hreflang; 48 String m_type; 49 String m_title; 50 String m_length; 51 52private: 53 Type m_typeInEnum; 54}; 55 56class RSSAtomParser : public RSSParserBase { 57public: 58 RSSAtomParser(); 59 60 bool parseBuffer(const char* buffer, int length, const char* url, const char* encoding); 61 62private: 63 bool parseXmlDoc(xmlDocPtr); 64 bool parseItemBaseAttribute(RSSItemBase*, const String& name, xmlNode*, const String& base); 65 RSSItem* parseItem(xmlNode*); 66 RSSFeed* parseFeed(xmlNode*); 67 RSSAtomLink* parseLink(xmlNode*); 68 RSSEnclosure* enclosureFromLink(RSSAtomLink*); 69 70 String parseContent(const String& base, xmlNode*); 71 String parseAuthor(xmlNode*); 72 String parseCategory(xmlNode*); 73 KURL m_url; 74}; 75 76} // namespace WebCore 77 78#endif // RSSAtomParser_h 79