2
Copyright (c) 2009 Volker Krause <vkrause@kde.org>
4
This library is free software; you can redistribute it and/or modify it
5
under the terms of the GNU Library General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or (at your
7
option) any later version.
9
This library is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12
License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to the
16
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20
#ifndef AKONADI_XMLDOCUMENT_H
21
#define AKONADI_XMLDOCUMENT_H
23
#include "akonadi-xml_export.h"
25
#include <akonadi/collection.h>
26
#include <akonadi/item.h>
28
#include <QtXml/QDomDocument>
32
class XmlDocumentPrivate;
35
Represents a document of the KNUT XML serialization format for Akonadi objects.
37
class AKONADI_XML_EXPORT XmlDocument
41
Creates an empty document.
46
Creates a new XmlDocument object and calls loadFile().
50
XmlDocument( const QString &fileName );
54
Parses the given XML file and validates it.
55
In case of an error, isValid() will return @c false and
56
lastError() will return an error message.
58
@see isValid(), lastError()
60
bool loadFile( const QString &fileName );
63
Writes the current document into the given file.
65
bool writeToFile( const QString &fileName ) const;
68
Returns true if the document could be parsed successfully.
74
Returns the last error occurred during file loading/parsing.
75
Empty if isValid() returns @c true.
78
QString lastError() const;
81
Returns the DOM document for this XML document.
83
QDomDocument& document() const;
86
Returns the DOM element representing the collection with the given remote id
87
@deprecated Not HRID aware, use collectionElement() instead
89
KDE_DEPRECATED QDomElement collectionElementByRemoteId( const QString &rid ) const;
92
Returns the DOM element representing @p collection.
94
QDomElement collectionElement( const Collection &collection ) const;
97
Returns the DOM element representing the item with the given remote id
99
QDomElement itemElementByRemoteId( const QString &rid ) const;
102
Returns the collection with the given remote id.
104
Collection collectionByRemoteId( const QString &rid ) const;
107
Returns the item with the given remote id.
109
Item itemByRemoteId( const QString& rid, bool includePayload = true ) const;
112
Returns the collections defined in this document.
114
Collection::List collections() const;
117
Returns immediate child collections of the specified parent collection.
118
@deprecated Not HRID aware, use childCollections( Akonadi::Collection ) instead
120
KDE_DEPRECATED Collection::List childCollections( const QString &parentCollectionRid ) const;
123
Returns the immediate child collections of @p parentCollection.
125
Collection::List childCollections( const Collection &parentCollection ) const;
128
Returns the items in the given collection.
130
Item::List items( const Collection& collection, bool includePayload = true ) const;
133
XmlDocumentPrivate * const d;