blob: 9715ef8a5f134ebba505a7398ccfff5a01eb0094 (
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
|
/****************************************************************************
**
** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved.
**
** This file is part of an example program for TQt. This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/
#include "structureparser.h"
#include <tqapplication.h>
#include <tqfile.h>
#include <tqxml.h>
#include <tqlistview.h>
#include <tqgrid.h>
#include <tqmainwindow.h>
#include <tqlabel.h>
int main( int argc, char **argv )
{
TQApplication app( argc, argv );
TQFile xmlFile( argc == 2 ? argv[1] : "fnord.xml" );
TQXmlInputSource source( &xmlFile );
TQXmlSimpleReader reader;
TQGrid * container = new TQGrid( 3 );
TQListView * nameSpace = new TQListView( container, "table_namespace" );
StructureParser * handler = new StructureParser( nameSpace );
reader.setContentHandler( handler );
reader.parse( source );
TQListView * namespacePrefix = new TQListView( container,
"table_namespace_prefix" );
handler->setListView( namespacePrefix );
reader.setFeature( "http://xml.org/sax/features/namespace-prefixes",
TRUE );
source.reset();
reader.parse( source );
TQListView * prefix = new TQListView( container, "table_prefix");
handler->setListView( prefix );
reader.setFeature( "http://xml.org/sax/features/namespaces", FALSE );
source.reset();
reader.parse( source );
// namespace label
(void) new TQLabel(
"Default:\n"
"http://xml.org/sax/features/namespaces: TRUE\n"
"http://xml.org/sax/features/namespace-prefixes: FALSE\n",
container );
// namespace prefix label
(void) new TQLabel(
"\n"
"http://xml.org/sax/features/namespaces: TRUE\n"
"http://xml.org/sax/features/namespace-prefixes: TRUE\n",
container );
// prefix label
(void) new TQLabel(
"\n"
"http://xml.org/sax/features/namespaces: FALSE\n"
"http://xml.org/sax/features/namespace-prefixes: TRUE\n",
container );
app.setMainWidget( container );
container->show();
return app.exec();
}
|