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

Syndication Library

  • syndication
elementwrapper.h
1/*
2 * This file is part of the syndication library
3 *
4 * Copyright (C) 2006 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#ifndef SYNDICATION_ELEMENTWRAPPER_H
23#define SYNDICATION_ELEMENTWRAPPER_H
24
25#include <QtCore/QString>
26
27#include <boost/shared_ptr.hpp>
28
29#include "ksyndication_export.h"
30
31class QDomElement;
32template <class T> class QList;
33
34namespace Syndication {
35
43class SYNDICATION_EXPORT ElementWrapper
44{
45 public:
46
51 ElementWrapper();
52
57 ElementWrapper(const ElementWrapper& other);
58
63 ElementWrapper(const QDomElement& element); // implicit
64
68 virtual ~ElementWrapper();
69
77 ElementWrapper& operator=(const ElementWrapper& other);
78
84 bool operator==(const ElementWrapper& other) const;
85
89 const QDomElement& element() const;
90
96 bool isNull() const;
97
106 QString xmlBase() const;
107
115 QString xmlLang() const;
116
135 QString completeURI(const QString& uri) const;
136
159
160 QString extractElementTextNS(const QString& namespaceURI,
161 const QString& localName) const;
162
178 QString extractElementText(const QString& tagName) const;
179
188 QList<QDomElement> elementsByTagName(const QString& tagName) const;
189
196 QString childNodesAsXML() const;
197
215 static QString childNodesAsXML(const QDomElement& parent);
216
229 QList<QDomElement> elementsByTagNameNS(const QString& nsURI,
230 const QString& tagName) const;
231
242 QDomElement firstElementByTagNameNS(const QString& nsURI,
243 const QString& tagName) const;
244
249 QString text() const;
250
259 QString attribute(const QString& name,
260 const QString& defValue=QString()) const;
261
272 QString attributeNS(const QString& nsURI, const QString& localName,
273 const QString& defValue=QString()) const;
274
275
282 bool hasAttribute(const QString& name) const;
283
291 bool hasAttributeNS(const QString& nsURI, const QString& localName) const;
292
293 private:
294
295 class ElementWrapperPrivate;
296 boost::shared_ptr<ElementWrapperPrivate> d;
297};
298
299} // namespace Syndication
300
301#endif // SYNDICATION_ELEMENTWRAPPER_H
Syndication::ElementWrapper::element
const QDomElement & element() const
returns the wrapped resource.
Definition elementwrapper.cpp:86
Syndication::ElementWrapper::hasAttributeNS
bool hasAttributeNS(const QString &nsURI, const QString &localName) const
Returns true if this element has an attribute with the local name localName and the namespace URI nsU...
Definition elementwrapper.cpp:294
Syndication::ElementWrapper::xmlBase
QString xmlBase() const
returns the xml:base value to be used for the wrapped element.
Definition elementwrapper.cpp:91
Syndication::ElementWrapper::text
QString text() const
Returns the wrapped element's text or an empty string.
Definition elementwrapper.cpp:274
Syndication::ElementWrapper::extractElementText
QString extractElementText(const QString &tagName) const
extracts the text from a child element, ignoring namespaces.
Definition elementwrapper.cpp:173
Syndication::ElementWrapper::firstElementByTagNameNS
QDomElement firstElementByTagNameNS(const QString &nsURI, const QString &tagName) const
searches the direct children of the wrapped element for an element with a given namespace and tag nam...
Definition elementwrapper.cpp:237
Syndication::ElementWrapper::operator==
bool operator==(const ElementWrapper &other) const
compares two wrappers.
Definition elementwrapper.cpp:76
Syndication::ElementWrapper::ElementWrapper
ElementWrapper()
creates a element wrapper wrapping a null element.
Definition elementwrapper.cpp:47
Syndication::ElementWrapper::completeURI
QString completeURI(const QString &uri) const
completes relative URIs with a prefix specified via xml:base.
Definition elementwrapper.cpp:137
Syndication::ElementWrapper::isNull
bool isNull() const
returns whether the wrapped element is a null element
Definition elementwrapper.cpp:81
Syndication::ElementWrapper::hasAttribute
bool hasAttribute(const QString &name) const
Returns true if this element has an attribute called name; otherwise returns false.
Definition elementwrapper.cpp:289
Syndication::ElementWrapper::xmlLang
QString xmlLang() const
returns the xml:lang value to be used for the wrapped element.
Definition elementwrapper.cpp:147
Syndication::ElementWrapper::childNodesAsXML
QString childNodesAsXML() const
returns the child nodes of the wrapped element as XML.
Definition elementwrapper.cpp:217
Syndication::ElementWrapper::elementsByTagName
QList< QDomElement > elementsByTagName(const QString &tagName) const
returns all child elements with tag name tagName Contrary to QDomElement::elementsByTagName() only di...
Definition elementwrapper.cpp:222
Syndication::ElementWrapper::elementsByTagNameNS
QList< QDomElement > elementsByTagNameNS(const QString &nsURI, const QString &tagName) const
returns all child elements with tag name tagname and namespace URI nsURI.
Definition elementwrapper.cpp:256
Syndication::ElementWrapper::operator=
ElementWrapper & operator=(const ElementWrapper &other)
Assigns another element wrapper to this one.
Definition elementwrapper.cpp:70
Syndication::ElementWrapper::attribute
QString attribute(const QString &name, const QString &defValue=QString()) const
Returns the attribute called name.
Definition elementwrapper.cpp:279
Syndication::ElementWrapper::extractElementTextNS
QString extractElementTextNS(const QString &namespaceURI, const QString &localName) const
extracts the text from a child element, respecting namespaces.
Definition elementwrapper.cpp:179
Syndication::ElementWrapper::attributeNS
QString attributeNS(const QString &nsURI, const QString &localName, const QString &defValue=QString()) const
Returns the attribute with the local name localName and the namespace URI nsURI.
Definition elementwrapper.cpp:284
Syndication
TODO.
Definition abstractparser.cpp:25
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Syndication Library

Skip menu "Syndication Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

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