~ubuntu-branches/ubuntu/trusty/libxml-bare-perl/trusty

« back to all changes in this revision

Viewing changes to bench/src/xmlio_testread.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Antonio Radici, Antonio Radici, gregor herrmann
  • Date: 2009-03-22 10:49:56 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090322104956-a5hx63ijvvmy4ao6
Tags: 0.43-1
[ Antonio Radici ]
* New upstream release
* debian/copyright:
  + added copyright for src/bench/xmlio_testread.cpp
  + removed repack.sh references because there are no licensing issues
  + set the proper license for the upstream source (it is dual licensed)
* debian/control:
  + upgrade to Standards-Version 3.8.1, no changes required
* removed debian/repack.sh
* debian/watch:
  + removed versionmangle and the reference to repack

[ gregor herrmann ]
* debian/control: add missing full stop to long description, thanks to
  Rhonda for spotting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
        Copyright (c) 2000 Paul T. Miller
 
3
  License: LGPL ( http://www.gnu.org/copyleft/lgpl.html )
 
4
  Modified from original sample/testread.cpp in xmlio distribution
 
5
    to be suitable for use in the benchmarking system included with
 
6
    XML::Bare.
 
7
*/
 
8
 
 
9
#include "sample.h"
 
10
#include "xmlinput.h"
 
11
#include "xmlfile.h"
 
12
#include <iostream>
 
13
 
 
14
static void sDocHandler(XML::Element &elem, void *userData)
 
15
{
 
16
        // found a Document - make a new one 
 
17
        Document *doc = new Document(elem.GetAttribute("name"));
 
18
 
 
19
        doc->Read(elem);
 
20
 
 
21
        Document::ObjectList::const_iterator it;
 
22
        for (it = doc->begin(); it != doc->end(); ++it)
 
23
        {
 
24
                const Object *obj = (*it);
 
25
        }
 
26
        delete doc;
 
27
}
 
28
 
 
29
int main(int argc, char **argv)
 
30
{
 
31
        XML::FileInputStream file(argv[1]);
 
32
        XML::Input input(file);
 
33
 
 
34
        // set up initial handler for Document
 
35
        XML::Handler handlers[] = {
 
36
                XML::Handler("Document", sDocHandler),
 
37
                XML::Handler::END
 
38
        };
 
39
 
 
40
        try {
 
41
                input.Process(handlers, NULL);
 
42
        }
 
43
        catch (const XML::ParseException &e)
 
44
        {
 
45
                fprintf(stderr, "ERROR: %s (line %d, column %d)\n", e.What(), e.GetLine(), e.GetColumn());
 
46
        }
 
47
        return 0;
 
48
}
 
49
 
 
50