summaryrefslogtreecommitdiff
path: root/library/xmlreader.h
authorkergoth <kergoth>2002-01-25 22:14:26 (UTC)
committer kergoth <kergoth>2002-01-25 22:14:26 (UTC)
commit15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff)
treec2fa0399a2c47fda8e2cd0092c73a809d17f68eb /library/xmlreader.h
downloadopie-15318cad33835e4e2dc620d033e43cd930676cdd.zip
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2
Initial revision
Diffstat (limited to 'library/xmlreader.h') (more/less context) (ignore whitespace changes)
-rw-r--r--library/xmlreader.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/library/xmlreader.h b/library/xmlreader.h
new file mode 100644
index 0000000..2a51176
--- a/dev/null
+++ b/library/xmlreader.h
@@ -0,0 +1,83 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef XMLREADER_H
21#define XMLREADER_H
22
23#include <qstring.h>
24#include <qxml.h>
25#include <qmap.h>
26
27class Node
28{
29public:
30 Node();
31 ~Node();
32
33 void addChild( Node *child );
34
35 void setAttributes( const QXmlAttributes &a );
36 QMap<QString, QString> attributeMap();
37 QString attribute( const QString& name );
38
39 Node *nextNode() const { return next; }
40 Node *prevNode() const { return prev; }
41 Node *parentNode() const { return parent; }
42 Node *lastChild() const { return last; }
43 Node *firstChild() const { return first; }
44
45 void setTagName( const QString &s ) { tagN = s; }
46 QString tagName() const { return tagN; }
47 void setData( const QString &s ) { dt = s; }
48 QString data() const { return dt; }
49 QString subData(const QString& tag) const;
50 void appendData( const QString s ) { dt += s; }
51
52
53private:
54 QMap<QString, QString> attributes;
55 QString dt, tagN;
56
57 Node *parent, *prev, *next, *first, *last;
58};
59
60class XmlHandlerPrivate;
61class XmlHandler : public QXmlDefaultHandler
62{
63public:
64 XmlHandler();
65 ~XmlHandler();
66
67 bool startDocument();
68 bool endDocument();
69 bool startElement( const QString &ns, const QString &ln, const QString &qName,
70 const QXmlAttributes &attr );
71 bool endElement( const QString &ns, const QString &ln, const QString &qName );
72 bool characters( const QString &ch );
73
74 Node *firstNode() const { return tree; }
75
76private:
77 Node *node, *tree;
78 XmlHandlerPrivate *d;
79};
80
81
82
83#endif