summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/xml/simpleparse/main.cpp
blob: a1f346bc23cbd6a81dae811da0e49b1886ec7b0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include <qfile.h>
#include <qxml.h>
#include "handler.h"

#include <iostream>

int main(int argc, char **argv)
{
    if (argc != 2) {
        std::cout << "Usage: " << argv[0] << " <filename>" << std::endl;
        return 1;
    }

    QFile *file = new QFile(argv[1]);

//! [0]
    QXmlSimpleReader xmlReader;
    QXmlInputSource *source = new QXmlInputSource(file);
//! [0]

//! [1]
    Handler *handler = new Handler;
    xmlReader.setContentHandler(handler);
    xmlReader.setErrorHandler(handler);
//! [1]

//! [2]
    bool ok = xmlReader.parse(source);

    if (!ok)
        std::cout << "Parsing failed." << std::endl;
//! [2]
    else {
        QStringList names = handler->names();
        QList<int> indentations = handler->indentations();

        int items = names.count();

        for (int i = 0; i < items; ++i) {
            for (int j = 0; j < indentations[i]; ++j)
                std::cout << " ";
            std::cout << names[i].toLocal8Bit().constData() << std::endl;
        }
    }

    return 0;
}
Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
Commit message (Expand)AuthorAgeFilesLines
* [4b61afd660] Allow [info frame] to record line info for substituted command n...dgp2016-06-161-1/+3
|\
| * Improve fix and add test.bug_4b61afd660dgp2016-06-161-5/+2
| * Corrects reported bug, but makes many tests fail. Something subtle aboutdgp2016-06-101-0/+4
|/
* [e711ffb458] Replace TclIsLocalScalar() (which does the wrong thing).... withdgp2014-12-091-2/+2
* TclCompileScript() should not overwrite envPtr->numSrcBytes.dgp2013-06-201-1/+0
* Remove from tclCompile.h declarations used in only one source file.dgp2013-03-051-5/+6
* Restore the ReleaseCmdWordData cleanup routine from 8.4, to plug verydgp2013-02-221-18/+26
*-. Shift more burden of smart cleanup onto the TclFreeCompileEnv() routine.dgp2013-02-221-30/+43
|\ \
| | * Use iPtr field instead of source field to mark a CompileEnv as uninitialized.dgp2013-02-221-4/+4
| |/
| * Protect against multiple uses of a CompileEnv with only one initialization.dgp2013-02-211-31/+43
| * make some more internal tables constjan.nijtmans2012-04-231-1/+1
* | Use twoPtrValue.ptr1 in stead of otherValuePtr everywhere. This is exactly th...jan.nijtmans2013-01-311-7/+5
* | some formatting (*.decls)jan.nijtmans2012-04-041-1/+1
|\ \ | |/
* | Fix: Removed C99ism (in-block variable declaration) from commit [39f6ebe301] ...andreask2012-02-171-1/+3
* | bug fix: avoid segfaulting by deleted interp in RecordByteCodeStatssebres2012-02-171-2/+1
* | Avoid segfaults when RecordByteCodeStats() is called in a deleted interp.dgp2011-07-151-0/+5
|\ \ | |/
| * Avoid segfaults when RecordByteCodeStats() is called in a deleted interp.dgp2011-07-151-0/+5
| * wipdgp2011-07-121-6/+6
| * Type mismatches in *printf calls.dgp2011-07-111-2/+2
* | silence compiler warningdgp2011-05-251-1/+1
* | * generic/tclCompile.c (TclFixupForwardJump): Tracked down and fixedandreask2011-05-171-0/+64
* | Make sure SetFooFromAny routines react reasonably when passed a NULL interp.dgp2011-04-211-2/+6
|\ \ | |/
| * Make sure SetFooFromAny routines react reasonably when passed a NULL interp.dgp2011-04-211-2/+5
* | * generic/tclBasic.c: More replacements of Tcl_UtfBackslash() callsdgp2011-03-061-3/+5
|\ \ | |/
| * * generic/tclBasic.c: More replacements of Tcl_UtfBackslash() callsdgp2011-03-061-2/+2
* | Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-021-2/+0
|\ \ | |/
| * Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-011-2/+0
| * * generic/tclCompile.c: [Bug 2949302]: Fixed leak of supportandreas_kupries2010-02-111-18/+47
| * silence compiler warningsdgp2009-08-261-2/+2
| * * generic/tclBasic.c (Tcl_CreateInterp, Tcl_EvalTokensStandard,andreas_kupries2009-08-25