head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.41; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.58; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.54.05; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.22.02; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# testEasyXML.cxx

    00001 #include <string>
    00002 #include <iostream>
    00003 #include <fstream>
    00004 #include "easyxml.hxx"
    00005
    00006 using std::string;
    00007 using std::ifstream;
    00008 using std::cout;
    00009 using std::cerr;
    00010 using std::endl;
    00011
    00012 class MyVisitor : public XMLVisitor
    00013 {
    00014 public:
    00015   virtual void startXML () {
    00016     cout << "Start XML" << endl;
    00017   }
    00018   virtual void endXML () {
    00019     cout << "End XML" << endl;
    00020   }
    00021   virtual void startElement (const char * name, const XMLAttributes &atts) {
    00022     cout << "Start element " << name << endl;
    00023     for (int i = 0; i < atts.size(); i++)
    00024       cout << "  " << atts.getName(i) << '=' << atts.getValue(i) << endl;
    00025   }
    00026   virtual void endElement (const char * name) {
    00027     cout << "End element " << name << endl;
    00028   }
    00029   virtual void data (const char * s, int len) {
    00030     cout << "Character data " << string(s,len) << endl;
    00031   }
    00032   virtual void pi (const char * target, const char * data) {
    00033     cout << "Processing instruction " << target << ' ' << data << endl;
    00034   }
    00035   virtual void warning (const char * message, int line, int column) {
    00036     cout << "Warning: " << message << " (" << line << ',' << column << ')'
    00037          << endl;
    00038   }
    00039   virtual void error (const char * message, int line, int column) {
    00040     cout << "Error: " << message << " (" << line << ',' << column << ')'
    00041          << endl;
    00042   }
    00043 };
    00044
    00045 main (int ac, const char ** av)
    00046 {
    00047   MyVisitor visitor;
    00048
    00049   for (int i = 1; i < ac; i++) {
    00050     ifstream input(av[i]);
    00051     cout << "Reading " << av[i] << endl;
    00052     if (!readXML(input, visitor)) {
    00053       cerr << "Error reading from " << av[i] << endl;
    00054     }
    00055   }
    00056 }

@ 1.3 log @Oops, try again. @ text @d65 1 a65 1