• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

syndication/rss2

  • syndication
  • rss2
parser.cpp
1/*
2 * This file is part of the syndication library
3 *
4 * Copyright (C) 2005 Frank Osterfeld <osterfeld@kde.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#include "parser.h"
24#include "document.h"
25
26#include <documentsource.h>
27
28#include <QtXml/QDomDocument>
29#include <QtXml/QDomElement>
30#include <QtCore/QString>
31
32namespace Syndication {
33namespace RSS2 {
34
35class Parser::ParserPrivate {};
36
37bool Parser::accept(const Syndication::DocumentSource& source) const
38{
39 QDomDocument doc = source.asDomDocument();
40 if (doc.isNull())
41 return false;
42
43 QDomNode root = doc.namedItem(QLatin1String("rss")).toElement();
44
45 return !root.isNull();
46}
47
48Syndication::SpecificDocumentPtr Parser::parse(const DocumentSource& source) const
49{
50 return DocumentPtr(new Document(Document::fromXML(source.asDomDocument())));
51}
52
53QString Parser::format() const
54{
55 return QLatin1String("rss2");
56}
57
58Parser::Parser() : d(0) {}
59Parser::Parser(const Parser& other) : AbstractParser(other), d(0) {}
60Parser::~Parser() {}
61Parser& Parser::operator=(const Parser& /*other*/) { return *this; }
62
63} // namespace RSS2
64} // namespace Syndication
Syndication::RSS2::Document
document implementation, representing an RSS feed from the 0.91-0.94/2.0 family.
Definition: document.h:57
Syndication::RSS2::Document::fromXML
static Document fromXML(const QDomDocument &document)
Parses an RSS2 document from an XML document.
Definition: document.cpp:66
Syndication::RSS2::Parser
Parser implementation for the RSS 0.9x/2.0 format family.
Definition: parser.h:43
Syndication::RSS2::Parser::~Parser
virtual ~Parser()
destructor
Definition: parser.cpp:60
Syndication::RSS2::Parser::Parser
Parser()
default constructor
Definition: parser.cpp:58
Syndication::RSS2::Parser::accept
bool accept(const DocumentSource &source) const
checks whether a document source looks like an RSS0.9x/2.0 document
Definition: parser.cpp:37
Syndication::RSS2::Parser::format
QString format() const
returns the format string of this parser implementation, which is "rss2".
Definition: parser.cpp:53
Syndication::RSS2::Parser::parse
Syndication::SpecificDocumentPtr parse(const DocumentSource &source) const
creates an RSS2 wrapper for a document source.
Definition: parser.cpp:48
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

syndication/rss2

Skip menu "syndication/rss2"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Members
  • File List

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal