diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2001-08-19 18:13:14 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2001-08-19 18:13:14 (GMT) |
commit | 2f7902073680b977b74f3faeada95119ec767eb3 (patch) | |
tree | 3ff0575884709cdc92f9e462441672f3549ab054 /addon | |
parent | eed6800521ab6f21c41f485820ec1ee2def42e94 (diff) | |
download | Doxygen-2f7902073680b977b74f3faeada95119ec767eb3.zip Doxygen-2f7902073680b977b74f3faeada95119ec767eb3.tar.gz Doxygen-2f7902073680b977b74f3faeada95119ec767eb3.tar.bz2 |
Release-1.2.9-20010819
Diffstat (limited to 'addon')
-rw-r--r-- | addon/xmlparse/dochandler.h | 4 | ||||
-rw-r--r-- | addon/xmlparse/main.cpp | 60 |
2 files changed, 51 insertions, 13 deletions
diff --git a/addon/xmlparse/dochandler.h b/addon/xmlparse/dochandler.h index 0b11e25..c7c8095 100644 --- a/addon/xmlparse/dochandler.h +++ b/addon/xmlparse/dochandler.h @@ -232,7 +232,9 @@ class SimpleSectHandler : public DocNode, enum Types { See, Return, Author, Version, Since, Date, Bug, Note, Warning, Par, Deprecated, Pre, - Post, Invar, Remark, Attention + Post, Invar, Remark, Attention, + Todo, Test, RCS, EnumValues, + Examples }; SimpleSectHandler(IBaseHandler *parent); virtual ~SimpleSectHandler(); diff --git a/addon/xmlparse/main.cpp b/addon/xmlparse/main.cpp index 7fdb60a..3575c16 100644 --- a/addon/xmlparse/main.cpp +++ b/addon/xmlparse/main.cpp @@ -21,6 +21,13 @@ #include <qdict.h> #include <qlist.h> +//#define USE_DOM +#define USE_SAX + +#ifdef USE_DOM +#include <qdom.h> +#endif + class ErrorHandler : public QXmlErrorHandler { public: @@ -55,18 +62,47 @@ int main(int argc,char **argv) exit(1); } - //for (;;) - //{ - QFile xmlFile(argv[1]); - MainHandler handler; - ErrorHandler errorHandler; - QXmlInputSource source( xmlFile ); - QXmlSimpleReader reader; - reader.setContentHandler( &handler ); - reader.setErrorHandler( &errorHandler ); - reader.parse( source ); - //} - + QFile xmlFile(argv[1]); + if (!xmlFile.open( IO_ReadOnly )) + { + qFatal("Could not read %s",argv[1] ); + } + +#ifdef USE_SAX + MainHandler handler; + ErrorHandler errorHandler; + QXmlInputSource source( xmlFile ); + QXmlSimpleReader reader; + reader.setContentHandler( &handler ); + reader.setErrorHandler( &errorHandler ); + reader.parse( source ); +#endif + +#ifdef USE_DOM + QDomDocument doc; + doc.setContent( &xmlFile ); + + QDomElement de = doc.documentElement(); + + printf("docElem=%s\n",de.tagName().data()); + + QDomNode n = de.firstChild(); + while( !n.isNull() ) + { + QDomElement e = n.toElement(); // try to convert the node to an element. + if( !e.isNull() ) + { // the node was really an element. + printf("direct child %s id=%s kind=%s\n", + e.tagName().data(), + e.attribute("id").data(), + e.attribute("kind").data() + ); + } + n = n.nextSibling(); + } + +#endif + return 0; } |