xmlreader.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef XMLREADER_H
00021 #define XMLREADER_H
00022
00023 #include <qstring.h>
00024 #include <qxml.h>
00025 #include <qmap.h>
00026
00027 class Node
00028 {
00029 public:
00030 Node();
00031 ~Node();
00032
00033 void addChild( Node *child );
00034
00035 void setAttributes( const QXmlAttributes &a );
00036 QMap<QString, QString> attributeMap();
00037 QString attribute( const QString& name );
00038
00039 Node *nextNode() const { return next; }
00040 Node *prevNode() const { return prev; }
00041 Node *parentNode() const { return parent; }
00042 Node *lastChild() const { return last; }
00043 Node *firstChild() const { return first; }
00044
00045 void setTagName( const QString &s ) { tagN = s; }
00046 QString tagName() const { return tagN; }
00047 void setData( const QString &s ) { dt = s; }
00048 QString data() const { return dt; }
00049 QString subData(const QString& tag) const;
00050 void appendData( const QString s ) { dt += s; }
00051
00052
00053 private:
00054 QMap<QString, QString> attributes;
00055 QString dt, tagN;
00056
00057 Node *parent, *prev, *next, *first, *last;
00058 };
00059
00060 class XmlHandlerPrivate;
00061 class XmlHandler : public QXmlDefaultHandler
00062 {
00063 public:
00064 XmlHandler();
00065 ~XmlHandler();
00066
00067 bool startDocument();
00068 bool endDocument();
00069 bool startElement( const QString &ns, const QString &ln, const QString &qName,
00070 const QXmlAttributes &attr );
00071 bool endElement( const QString &ns, const QString &ln, const QString &qName );
00072 bool characters( const QString &ch );
00073
00074 Node *firstNode() const { return tree; }
00075
00076 private:
00077 Node *node, *tree;
00078 XmlHandlerPrivate *d;
00079 };
00080
00081
00082
00083 #endif
This file is part of the documentation for OPIE Version 1.5.5.