~neon/qt/qtxmlpatterns

« back to all changes in this revision

Viewing changes to examples/xmlpatterns/xquery/doc/src/globalVariables.qdoc

  • Committer: Frederik Gladhorn
  • Date: 2015-01-19 13:09:01 UTC
  • mfrom: (184.1.13)
  • Revision ID: git-v1:8f012dd05873d33d0ce9dc7b076418cc3096106e
Merge remote-tracking branch 'origin/5.4' into dev

Conflicts:
        .qmake.conf

Change-Id: Id327fd1d5933b38c3fcc3f7e9edadb34aaf7a059

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/****************************************************************************
2
2
**
3
 
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 
3
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4
4
** Contact: http://www.qt-project.org/legal
5
5
**
6
6
** This file is part of the documentation of the Qt Toolkit.
26
26
****************************************************************************/
27
27
 
28
28
/*!
29
 
    \example xmlpatterns/xquery
 
29
    \example xquery
30
30
    \title C++ Source Code Analyzer Example
31
31
    \ingroup xmlpattern_examples
32
32
 
 
33
    \brief Using XQuery and the \c xmlpatterns command line utility to
 
34
    query C++ source code.
 
35
 
33
36
    This example uses XQuery and the \c xmlpatterns command line utility to
34
37
    query C++ source code.
35
38
 
68
71
 
69
72
    Consider the declarations in this hypothetical C++ application:
70
73
 
71
 
    \snippet xmlpatterns/xquery/globalVariables/globals.cpp 0
 
74
    \snippet xquery/globalVariables/globals.cpp 0
72
75
 
73
76
    \section3 The XML description of the C++ application
74
77
 
76
79
    \l{http://public.kitware.com/GCC_XML/HTML/Index.html} {GCC-XML}
77
80
    produces this XML description:
78
81
 
79
 
    \quotefromfile xmlpatterns/xquery/globalVariables/globals.gccxml
 
82
    \quotefromfile xquery/globalVariables/globals.gccxml
80
83
    \printuntil
81
84
 
82
85
    \section3 The XQuery for finding global variables
85
88
    description. Here is our XQuery source. We walk through it in
86
89
    \l{XQuery Code Walk-Through}.
87
90
 
88
 
    \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
 
91
    \quotefromfile xquery/globalVariables/reportGlobals.xq
89
92
    \printuntil
90
93
 
91
94
    \section3 Running the XQuery
93
96
    To run the XQuery using the \c xmlpatterns command line utility,
94
97
    enter the following command:
95
98
 
96
 
    \code
 
99
    \badcode
97
100
    xmlpatterns reportGlobals.xq -param fileToOpen=globals.gccxml -output globals.html
98
101
    \endcode
99
102
 
128
131
    \c{examples/xmlpatterns/xquery/globalVariables/reportGlobals.xq}
129
132
    It begins with two variable declarations that begin the XQuery:
130
133
 
131
 
    \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
 
134
    \quotefromfile xquery/globalVariables/reportGlobals.xq
132
135
    \skipto declare variable
133
136
    \printto (:
134
137
 
149
152
    instructions for displaying the text, and then the \c{<body>}
150
153
    element.
151
154
 
152
 
    \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
 
155
    \quotefromfile xquery/globalVariables/reportGlobals.xq
153
156
    \skipto <html xmlns
154
157
    \printuntil
155
158
 
158
161
    the two \c{return} clauses separated by the \e {comma operator}
159
162
    about halfway down:
160
163
 
161
 
    \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
 
164
    \quotefromfile xquery/globalVariables/reportGlobals.xq
162
165
    \skipto declare function local:report()
163
166
    \printuntil };
164
167
 
172
175
    Here is the html generated for the \c{<body>} element. Compare
173
176
    it with the XQuery code above:
174
177
 
175
 
    \quotefromfile xmlpatterns/xquery/globalVariables/globals.html
 
178
    \quotefromfile xquery/globalVariables/globals.html
176
179
    \skipto <body>
177
180
    \printuntil </body>
178
181
 
181
184
    returns true if the variable has a complex type. The variable can
182
185
    be mutable or const.
183
186
 
184
 
    \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
 
187
    \quotefromfile xquery/globalVariables/reportGlobals.xq
185
188
    \skipto declare function local:isComplexType
186
189
    \printuntil };
187
190
 
188
191
    \c{isPrimitive()} returns true if the variable has a primitive
189
192
    type. The variable must be mutable.
190
193
 
191
 
    \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
 
194
    \quotefromfile xquery/globalVariables/reportGlobals.xq
192
195
    \skipto declare function local:isPrimitive
193
196
    \printuntil };
194
197
 
195
198
    \c{location()} returns a text constructed from the variable's file
196
199
    and line number attributes.
197
200
 
198
 
    \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
 
201
    \quotefromfile xquery/globalVariables/reportGlobals.xq
199
202
    \skipto declare function local:location
200
203
    \printuntil };
201
204