Zorba
The XQuery Processor
Documentation
Live Demo
Modules
Download
Tools
Blog
Code
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
include
zorba
sax2.h
Go to the documentation of this file.
1
/*
2
* Copyright 2006-2008 The FLWOR Foundation.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
#ifndef ZORBA_SAX2_API_H
17
#define ZORBA_SAX2_API_H
18
19
#include <zorba/config.h>
20
#include <
zorba/api_shared_types.h
>
21
22
namespace
zorba{
23
24
class
SAX2_Attributes;
25
26
/** \brief Receive notification of events that result from serializing
27
* a query result as XML.
28
*
29
* This is an interface that is used to receive notifications resulting
30
* from parsing a query result that was serialized as XML.
31
*
32
* Instances of classes that implement this interface can be registered for
33
* a query by calling the XQuery::registerSAXHandler or XQuery::executeSAX
34
* function.
35
*/
36
class
ZORBA_DLL_PUBLIC
SAX2_ContentHandler
37
{
38
public
:
39
40
/** \brief Destructor
41
*/
42
virtual
43
~SAX2_ContentHandler
() {}
44
45
/** \brief Receive notification of the beginning of a document.
46
*/
47
virtual
void
48
startDocument() = 0;
49
50
/** \brief Receive notification of the end of a document.
51
*/
52
virtual
void
53
endDocument() = 0;
54
55
/** \brief Receive notification of the beginning of an element.
56
*
57
* Zorba's serializer will invoke this method at the beginning of every element
58
* of the serialized query result; there will be a corresponding endElement()
59
* event for every startElement() event (even when the element is empty).
60
* All of the element's content will be reported, in order, before the
61
* corresponding endElement() event.
62
*
63
* @param aURI the URI of the associated namespace for this element.
64
* @param aLocalname thee local part of the element name.
65
* @param aQName the QName of this element.
66
* @param aAttrs the attributes attached to the element, if any.
67
*/
68
virtual
void
69
startElement(
const
String
& aURI,
const
String
& aLocalname,
70
const
String
& aQName,
const
SAX2_Attributes
& aAttrs ) = 0;
71
72
/** \brief Receive notification of the end of an element.
73
*
74
* Zorba's serializerwill invoke this method at the end of every element in the serialized
75
* query result document; there will be a corresponding startElement() event for
76
* every endElement() event (even when the element is empty).
77
*
78
* @param aURI the URI of the asscioated namespace for this element
79
* @param aLocalname the local part of the element name
80
* @param aQName the QName of this element
81
*/
82
virtual
void
83
endElement(
const
String
& aURI,
const
String
& aLocalname,
const
String
& aQName ) = 0;
84
85
/** \brief Receive notification of character data.
86
*
87
* The serializer will call this method to report each chunk of character data.
88
*
89
* @param aText the characters from the serialized result.
90
*/
91
virtual
void
92
characters(
const
String
& aText ) = 0;
93
94
/** \brief Receive notification of a processing instruction.
95
*
96
* The serializer will invoke this method once for each processing instruction found.
97
*
98
* @param aTarget the processing instruction target.
99
* @param aData the processing instruction data, or null if none was supplied.
100
*/
101
virtual
void
102
processingInstruction(
const
String
& aTarget,
const
String
& aData ) = 0;
103
104
/** \brief Receive notification of ignorable whitespace in element content.
105
*
106
* @param aText the characters from the serialized query result.
107
*/
108
virtual
void
109
ignorableWhitespace(
const
String
& aText ) = 0;
110
111
/** \brief Receive notification of the start of an namespace prefix mapping.
112
*
113
* @param aPrefix the namespace prefix used
114
* @param aURI the namespace URI used.
115
*/
116
virtual
void
117
startPrefixMapping(
const
String
& aPrefix,
const
String
& aURI ) = 0;
118
119
/** \brief Receive notification of the end of an namespace prefix mapping.
120
*
121
* @param aPrefix the namespace prefix used.
122
*/
123
virtual
void
124
endPrefixMapping(
const
String
& aPrefix ) = 0;
125
126
/** \brief Receive notification of a skipped entity.
127
*
128
* @param aName the name of the skipped entity.
129
*/
130
virtual
void
131
skippedEntity(
const
String
& aName ) = 0;
132
};
133
134
class
ZORBA_DLL_PUBLIC
SAX2_Attributes
135
{
136
public
:
137
virtual
138
~SAX2_Attributes
() {}
139
140
virtual
unsigned
int
141
getLength()
const
= 0;
142
143
virtual
const
String
144
getURI(
const
unsigned
int
index)
const
= 0;
145
146
virtual
const
String
147
getLocalName(
const
unsigned
int
index)
const
= 0;
148
149
virtual
const
String
150
getQName(
const
unsigned
int
index)
const
= 0;
151
152
virtual
const
String
153
getType(
const
unsigned
int
index)
const
= 0;
154
155
virtual
const
String
156
getValue(
const
unsigned
int
index)
const
= 0;
157
158
virtual
int
159
getIndex(
const
String
& uri,
const
String
& localPart )
const
= 0 ;
160
161
virtual
int
162
getIndex(
const
String
& qName )
const
= 0 ;
163
164
virtual
const
165
String
getType(
const
String
& uri,
const
String
& localPart )
const
= 0 ;
166
167
virtual
const
168
String
getType(
const
String
& qName )
const
= 0;
169
170
virtual
const
171
String
getValue(
const
String
& uri,
const
String
& localPart )
const
= 0 ;
172
173
virtual
const
174
String
getValue(
const
String
& qName )
const
= 0;
175
};
176
177
class
ZORBA_DLL_PUBLIC
SAX2_LexicalHandler
178
{
179
public
:
180
virtual
181
~SAX2_LexicalHandler
() {}
182
183
virtual
void
184
comment (
const
String
& chars ) = 0;
185
186
virtual
void
187
endCDATA () = 0;
188
189
virtual
void
190
endDTD () = 0;
191
192
virtual
void
193
endEntity (
const
String
& name ) = 0;
194
195
virtual
void
196
startCDATA () = 0;
197
198
virtual
void
199
startDTD (
const
String
& name,
const
String
& publicId,
200
const
String
& systemId ) = 0;
201
202
virtual
void
203
startEntity (
const
String
& name ) = 0;
204
};
205
}
206
//end namespace zorba
207
#endif
208
/* vim:set et sw=2 ts=2: */
api_shared_types.h
zorba::SAX2_LexicalHandler
Definition:
sax2.h:177
zorba::SAX2_ContentHandler::~SAX2_ContentHandler
virtual ~SAX2_ContentHandler()
Destructor.
Definition:
sax2.h:43
zorba::String
The Zorba string class.
Definition:
zorba_string.h:33
zorba::SAX2_LexicalHandler::~SAX2_LexicalHandler
virtual ~SAX2_LexicalHandler()
Definition:
sax2.h:181
zorba::SAX2_Attributes
Definition:
sax2.h:134
zorba::SAX2_ContentHandler
Receive notification of events that result from serializing a query result as XML.
Definition:
sax2.h:36
zorba::SAX2_Attributes::~SAX2_Attributes
virtual ~SAX2_Attributes()
Definition:
sax2.h:138