Project

Profile

Help

Revision 61000456

Added by O'Neil Delpratt 5 months ago

Saxon/C development - added XdmMap and XdmArray classes

View differences:

latest10/hec/Saxon.C.API/CMakeLists.txt
1
cmake_minimum_required(VERSION 3.17)
2
project(Saxon_C_API)
3

  
4
set(CMAKE_CXX_STANDARD 11)
5

  
6
include_directories(.)
7
include_directories(jni)
8
include_directories(jni/unix)
9
include_directories(jni/win32)
10

  
11
add_executable(Saxon_C_API
12
        jni/unix/jni_md.h
13
        jni/win32/jni_md.h
14
        jni/jni.h
15
        SaxonApiException.cpp
16
        SaxonApiException.h
17
        SaxonCGlue.c
18
        SaxonCGlue.h
19
        SaxonCProcessor.c
20
        SaxonCProcessor.h
21
        SaxonCXPath.c
22
        SaxonCXPath.h
23
        SaxonProcessor.cpp
24
        SaxonProcessor.h
25
        SchemaValidator.cpp
26
        SchemaValidator.h
27
        XdmArray.h
28
        XdmAtomicValue.cpp
29
        XdmAtomicValue.h
30
        XdmFunctionItem.cpp
31
        XdmFunctionItem.h
32
        XdmArray.cpp
33
        XdmArray.h
34
        XdmItem.cpp
35
        XdmItem.h
36
        XdmMap.cpp
37
        XdmMap.h
38
        XdmNode.cpp
39
        XdmNode.h
40
        XdmValue.cpp
41
        XdmValue.h
42
        XPathProcessor.cpp
43
        XPathProcessor.h
44
        XQueryProcessor.cpp
45
        XQueryProcessor.h
46
        Xslt30Processor.cpp
47
        Xslt30Processor.h
48
        XsltExecutable.cpp
49
        XsltExecutable.h
50
        XsltProcessor.cpp
51
        XsltProcessor.h)
latest10/hec/Saxon.C.API/XdmArray.cpp
1
#include "XdmArray.h"
2

  
3

  
4

  
5
XdmArray::XdmArray(): XdmFunctionItem(){
6

  
7

  
8
}
9

  
10
XdmArray::XdmArray(const XdmArray &d): XdmFunctionItem(d) {
11
}
12

  
13

  
14

  
15
XdmArray::XdmArray(jobject obj) : XdmFunctionItem(obj){}
16

  
17
int XdmArray::arrayLength() const {
18
    jclass xdmArrayClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmArray");
19
    static jmethodID arLenmID = nullptr;
20

  
21
    if(arLenmID == nullptr) {
22

  
23
        arLenmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmArrayClass, "arrayLength",
24
                                                                          "()I");
25
    }
26

  
27
    if (!arLenmID) {
28
        std::cerr << "Error: Saxonc.XdmArray." << "arrayLength"
29
                  << " not found\n" << std::endl;
30
        return 0;
31
    } else {
32
        jint valuei = (SaxonProcessor::sxn_environ->env->CallIntMethod(value, arLenmID));
33
        return valuei;
34
    }
35
}
36

  
37
XdmValue* XdmArray::get(int n){
38
    jclass xdmArrayClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmArray");
39
    static jmethodID tbmID = nullptr;
40

  
41
    if(tbmID == nullptr) {
42

  
43
        tbmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmArrayClass, "get",
44
    					"(I)Lnet/sf/saxon/s9api/XdmValue;");
45
    }
46

  
47
    if (!tbmID) {
48
    			std::cerr << "Error: Saxonc.XdmArray." << "get"
49
    				<< " not found\n" << std::endl;
50
    			return nullptr;
51
    } else {
52
    			jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value, tbmID, n));
53
    			if(valueObj) {
54
    				auto * newValue = new XdmValue((proc == nullptr ? nullptr : proc));
55
    				newValue->addUnderlyingValue(valueObj);
56
    				return newValue;
57
    			}
58
    			return nullptr;
59
    }
60
}
61

  
62
XdmArray* XdmArray::put(int n, XdmValue * valuei) {
63
    jclass xdmArrayClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmArray");
64
    static jmethodID tbpmID = nullptr;
65

  
66
    if(tbpmID == nullptr) {
67
        tbpmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmArrayClass, "put",
68
    					"(I;Lnet/sf/saxon/s9api/XdmValue;)Lnet/sf/saxon/s9api/XdmArray;");
69
    }
70
    if (!tbpmID) {
71
    			std::cerr << "Error: Saxonc.XdmArray." << "put"
72
    				<< " not found\n" << std::endl;
73
    			return nullptr;
74
    } else {
75
    			jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value, tbpmID, n, valuei->getUnderlyingValue()));
76
    			if(valueObj) {
77
    				auto * newValue = new XdmArray(valueObj);
78
    				return newValue;
79
    			}
80
    			return nullptr;
81
    }
82

  
83

  
84
}
85

  
86
XdmArray* XdmArray::addMember(XdmValue* valuei) {
87
    jclass xdmArrayClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmArray");
88
    static jmethodID tbamID = nullptr;
89

  
90
    if(tbamID) {
91
        tbamID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmArrayClass, "concat",
92
    					"(Lnet/sf/saxon/s9api/XdmValue;)Lnet/sf/saxon/s9api/XdmArray;");
93

  
94
    }
95

  
96
    if (!tbamID) {
97
    			std::cerr << "Error: Saxonc.XdmArray." << "concat"
98
    				<< " not found\n" << std::endl;
99
    			return nullptr;
100
    } else {
101
    			jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value, tbamID, valuei->getUnderlyingValue()));
102
    			if(valueObj) {
103
    				auto * newValue = new XdmArray(valueObj);
104
    				return newValue;
105
    			}
106
    			return nullptr;
107
    }
108
}
109

  
110
XdmArray* XdmArray::concat(XdmArray* valuei) {
111
    jclass xdmArrayClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmArray");
112
    static jmethodID tbcaID = nullptr;
113

  
114

  
115
    if(tbcaID == nullptr) {
116
        tbcaID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmArrayClass, "concat",
117
    					"(Lnet/sf/saxon/s9api/XdmArray;)Lnet/sf/saxon/s9api/XdmArray;");
118
    }
119

  
120
    if (!tbcaID) {
121
    			std::cerr << "Error: Saxonc.XdmArray." << "concat"
122
    				<< " not found\n" << std::endl;
123
    			return nullptr;
124
    } else {
125
    			jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value, tbcaID, valuei->getUnderlyingValue()));
126
    			if(valueObj) {
127
    				auto * newValue = new XdmArray(valueObj);
128
    				return newValue;
129
    			}
130
    			std::cerr << "Error: Saxonc.XdmArray." << "concat" << " failed\n" << std::endl;
131
    			return nullptr;
132
    }
133

  
134
}
135

  
136
std::list<XdmValue *> XdmArray::asList() {
137
  std::list<XdmValue *> arr;
138

  
139
	jclass xdmUtilsClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/option/cpp/XdmUtils");
140
	static jmethodID xmID = nullptr;
141

  
142

  
143
	if(xmID == nullptr) {
144
	    xmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(xdmUtilsClass,"convertXdmArrayToArrayObject",
145
					"(Lnet/sf/saxon/s9api/XdmArray;)[Lnet/sf/saxon/s9api/XdmValue;");
146
	}
147

  
148
	if (!xmID) {
149
			std::cerr << "Error: SaxonDll." << "convertXdmArrayToArrayObject"
150
				<< " not found\n" << std::endl;
151
			return arr;
152
		}
153

  
154

  
155
	auto results = (jobjectArray)(SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(xdmUtilsClass, xmID,value));
156
	if(results) {
157
	   int sizex = SaxonProcessor::sxn_environ->env->GetArrayLength(results);
158

  
159

  
160
       		XdmValue * tempValue;
161
       		for (int p=0; p < sizex; ++p){
162
       			jobject resulti = SaxonProcessor::sxn_environ->env->GetObjectArrayElement(results, p);
163
       			tempValue = new XdmValue();
164
       			tempValue->addUnderlyingValue(resulti);
165
       			arr.push_back(tempValue);
166

  
167
       		}
168
       	return arr;
169

  
170
	} else {
171
	    return arr;
172
	}
173

  
174

  
175
}
latest10/hec/Saxon.C.API/XdmMap.cpp
1
#include "XdmMap.h"
2
#include <map>
3

  
4

  
5
XdmMap::XdmMap(): XdmFunctionItem() {
6

  
7
}
8

  
9
XdmMap::XdmMap(const XdmMap &d) {
10
      arity = d.arity;
11
      data = d.data; //TODO check if copy works
12
    }
13

  
14
XdmMap::XdmMap(jobject obj): XdmFunctionItem(obj) {}
15

  
16

  
17

  
18

  
19
    int XdmMap::mapSize(){
20
        return  data.size();
21
    }
22

  
23
    XdmValue * XdmMap::get(XdmAtomicValue* key) {
24
    jclass xdmMapClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmMap");
25
    static jmethodID tbmapID = nullptr;
26

  
27
    if(tbmapID == nullptr) {
28
    tbmapID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmMapClass, "get",
29
    					"(Lnet/sf/saxon/s9api/XdmAtomicValue;)Lnet/sf/saxon/s9api/XdmValue;");
30

  
31
    }
32
    if (!tbmapID) {
33
    			std::cerr << "Error: Saxonc.XdmMap." << "get"
34
    				<< " not found\n" << std::endl;
35
    			return nullptr;
36
    } else {
37
    			jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value->xdmvalue, tbmapID, ((XdmItem *)key)->getUnderlyingValue()));
38
    			if(valueObj) {
39
    				XdmValue * newValue = new XdmValue((proc == nullptr ? nullptr : proc));
40
    				newValue->addUnderlyingValue(valueObj);
41
    				return newValue;
42
    			}
43
    			return nullptr;
44
    }
45

  
46
    }
47

  
48
    XdmValue * XdmMap::get(const char * key) {
49
        jclass xdmMapClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmMap");
50
        static jmethodID tbsmapID = nullptr;
51

  
52
        if(tbsmapID == nullptr) {
53
        tbsmapID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmMapClass, "get",
54
        					"(Ljava/lang/String;)Lnet/sf/saxon/s9api/XdmValue;");
55

  
56
        }
57
        if (!tbsmapID) {
58
        			std::cerr << "Error: Saxonc.XdmMap." << "get"
59
        				<< " not found\n" << std::endl;
60
        			return nullptr;
61
        } else {
62
                jobject strObj = getJavaStringValue(SaxonProcessor::sxn_environ, key);
63
        		jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value->xdmvalue, tbsmapID, strObj));
64
        		if(valueObj) {
65
        			XdmValue * newValue = new XdmValue((proc == nullptr ? nullptr : proc));
66
       				newValue->addUnderlyingValue(valueObj);
67
       				return newValue;
68
       			}
69
       			return nullptr;
70
        }
71

  
72

  
73
    }
74

  
75
    XdmValue * XdmMap::get(int key) {
76
        jclass xdmMapClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmMap");
77
        static jmethodID tbimapID = nullptr;
78

  
79
        if(tbimapID == nullptr) {
80
        tbimapID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmMapClass, "get",
81
        					"(I)Lnet/sf/saxon/s9api/XdmValue;");
82

  
83
        }
84
        if (!tbimapID) {
85
        			std::cerr << "Error: Saxonc.XdmMap." << "get"
86
        				<< " not found\n" << std::endl;
87
        			return nullptr;
88
        } else {
89
        		jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value->xdmvalue, tbimapID, key));
90
        		if(valueObj) {
91
        			XdmValue * newValue = new XdmValue((proc == nullptr ? nullptr : proc));
92
       				newValue->addUnderlyingValue(valueObj);
93
       				return newValue;
94
       			}
95
       			return nullptr;
96
        }
97

  
98

  
99
    }
100

  
101
    XdmValue *  XdmMap::get(double key) {
102
        jclass xdmMapClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmMap");
103
        static jmethodID tbdmapID = nullptr;
104

  
105
        if(tbdmapID == nullptr) {
106
            tbdmapID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmMapClass, "get",
107
        					"(D)Lnet/sf/saxon/s9api/XdmValue;");
108

  
109
        }
110
        if (!tbdmapID) {
111
        			std::cerr << "Error: Saxonc.XdmMap." << "get"
112
        				<< " not found\n" << std::endl;
113
        			return nullptr;
114
        } else {
115
        		jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value->xdmvalue, tbdmapID, key));
116
        		if(valueObj) {
117
        			XdmValue * newValue = new XdmValue((proc == nullptr ? nullptr : proc));
118
       				newValue->addUnderlyingValue(valueObj);
119
       				return newValue;
120
       			}
121
       			return nullptr;
122
        }
123

  
124

  
125
    }
126

  
127
    XdmValue * XdmMap::get(long key) {
128
        jclass xdmMapClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmMap");
129
        static jmethodID tbdmapID = nullptr;
130

  
131
        if(tbdmapID == nullptr) {
132
            tbdmapID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmMapClass, "get",
133
        					"(J)Lnet/sf/saxon/s9api/XdmValue;");
134

  
135
        }
136
        if (!tbdmapID) {
137
        			std::cerr << "Error: Saxonc.XdmMap." << "get"
138
        				<< " not found\n" << std::endl;
139
        			return nullptr;
140
        } else {
141
        		jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value->xdmvalue, tbdmapID, key));
142
        		if(valueObj) {
143
        			XdmValue * newValue = new XdmValue((proc == nullptr ? nullptr : proc));
144
       				newValue->addUnderlyingValue(valueObj);
145
       				return newValue;
146
       			}
147
       			return nullptr;
148
        }
149

  
150
    }
151

  
152
//TODO test this method
153
    XdmMap * XdmMap::put(XdmAtomicValue* key, XdmValue * valuei) {
154
        if(key == nullptr || valuei == nullptr) {
155
            std::cerr << "Error: Saxonc.XdmMap." << "key or value is nullptr" << std::endl;
156
            return nullptr;
157
        }
158
        jclass xdmMapClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmMap");
159
        static jmethodID putmapID = nullptr;
160

  
161
        if(putmapID == nullptr) {
162
                    putmapID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmMapClass, "put",
163
                					"(Lnet/sf/saxon/s9api/XdmAtomicValue;Lnet/sf/saxon/s9api/XdmValue;)Lnet/sf/saxon/s9api/XdmMap;");
164

  
165
        }
166
        if (!putmapID) {
167
            std::cerr << "Error: Saxonc.XdmMap." << "put"
168
                	  << " not found\n" << std::endl;
169
            return nullptr;
170
        } else {
171
                		jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value->xdmvalue, putmapID, ((XdmItem *)key)->getUnderlyingValue(), valuei->getUnderlyingValue()));
172
                		if(valueObj) {
173
                			XdmMap * newValue = new XdmMap(valueObj);
174
               				return newValue;
175
               			}
176
               			return nullptr;
177
                }
178

  
179
    }
180

  
181
    XdmMap * XdmMap::remove(XdmAtomicValue* key){
182
                jclass xdmMapClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmMap");
183
                static jmethodID removemapID = nullptr;
184

  
185
                if(removemapID == nullptr) {
186
                    removemapID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmMapClass, "remove",
187
                					"(Lnet/sf/saxon/s9api/XdmAtomicValue;)Lnet/sf/saxon/s9api/XdmMap;");
188

  
189
                }
190
                if (!removemapID) {
191
                			std::cerr << "Error: Saxonc.XdmMap." << "remove"
192
                				<< " not found\n" << std::endl;
193
                			return nullptr;
194
                } else {
195
                		jobject valueObj = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value->xdmvalue, removemapID, ((XdmItem *)key)->getUnderlyingValue()));
196
                		if(valueObj) {
197
                			XdmMap * newValue = new XdmMap(valueObj);
198
               				return newValue;
199
               			}
200
               			return nullptr;
201
                }
202

  
203

  
204

  
205
    }
206

  
207
    std::set<XdmAtomicValue*> XdmMap::keySet(){
208
        std::set<XdmAtomicValue *> myset;
209

  
210
        jclass xdmUtilsClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/option/cpp/XdmUtils");
211
        static jmethodID keySetmID = nullptr;
212

  
213
        if(keySetmID == nullptr) {
214
            keySetmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(xdmUtilsClass,"getXdmMapKeys",
215
                        					"(Lnet/sf/saxon/s9api/XdmMap)[Lnet/sf/saxon/s9api/XdmAtomicValue;");
216
            }
217
            if (!keySetmID) {
218
                std::cerr << "Error: SaxonDll." << "makeXdmMap"<< " not found\n" << std::endl;
219
                return myset;
220
            }
221

  
222

  
223
            jobjectArray results = (jobjectArray)(SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(xdmUtilsClass, keySetmID,value->xdmvalue));
224
            if(results) {
225
            	   int sizex = SaxonProcessor::sxn_environ->env->GetArrayLength(results);
226

  
227

  
228
                   	XdmAtomicValue * tempValue = nullptr;
229
                   		for (int p=0; p < sizex; ++p){
230
                   			jobject resulti = SaxonProcessor::sxn_environ->env->GetObjectArrayElement(results, p);
231
                   			tempValue = new XdmAtomicValue();
232
                   			tempValue->addUnderlyingValue(resulti);
233
                   			myset.push_back(tempValue);
234
                   		}
235
        }
236

  
237

  
238

  
239
         return myset;
240
    }
241

  
242
    //std::map<XdmAtomicValue*, XdmValue*> XdmMap::asMap();
243

  
244
    bool XdmMap::isEmpty() {
245
                jclass xdmMapClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmMap");
246
                static jmethodID isEmptyMapID = nullptr;
247

  
248
                if(isEmptyMapID == nullptr) {
249
                    isEmptyMapID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmMapClass, "isEmpty",
250
                					"()Z");
251

  
252
                }
253
                if (!isEmptyMapID) {
254
                			std::cerr << "Error: Saxonc.XdmMap." << "isEmpty"
255
                				<< " not found\n" << std::endl;
256
                			return false;
257
                } else {
258
                		jboolean result = (SaxonProcessor::sxn_environ->env->CallBooleanMethod(value->xdmvalue, isEmptyMapID));
259
                		return result;
260
                }
261
    }
262

  
263
    bool XdmMap::containsKey(XdmAtomicValue * key) {
264
                jclass xdmMapClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmMap");
265
                static jmethodID containsMapID = nullptr;
266

  
267
                if(containsMapID == nullptr) {
268
                    containsMapID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmMapClass, "containsKey",
269
                					"(Lnet/sf/saxon/s9api/XdmAtomicValue;)Z");
270

  
271
                }
272
                if (!containsMapID) {
273
                			std::cerr << "Error: Saxonc.XdmMap." << "containsKey"
274
                				<< " not found\n" << std::endl;
275
                			return false;
276
                } else {
277
                		jboolean result = (SaxonProcessor::sxn_environ->env->CallObjectMethod(value->xdmvalue, containsMapID, ((XdmItem *)key)->getUnderlyingValue()));
278
                		return result;
279
                }
280

  
281

  
282

  
283
    }
284

  
285
    std::list<XdmValue *> XdmMap::values() {
286
         std::list<XdmValue *> mylist;
287

  
288
            jclass xdmUtilsClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/option/cpp/XdmUtils");
289
            jmethodID xmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(xdmUtilsClass,"getXdmMapValues",
290
                        					"(Lnet/sf/saxon/s9api/XdmMap)[Lnet/sf/saxon/s9api/XdmValue;");
291
            if (!xmID) {
292
                std::cerr << "Error: SaxonDll." << "makeXdmMap"<< " not found\n" << std::endl;
293
                return mylist;
294
            }
295

  
296

  
297
            jobjectArray results = (jobjectArray)(SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(xdmUtilsClass, xmID,value->xdmvalue));
298
            if(results) {
299
            	   int sizex = SaxonProcessor::sxn_environ->env->GetArrayLength(results);
300

  
301

  
302
                   	XdmValue * tempValue = nullptr;
303
                   	for (int p=0; p < sizex; ++p){
304
                   			jobject resulti = SaxonProcessor::sxn_environ->env->GetObjectArrayElement(results, p);
305
                   			tempValue = new XdmValue();
306
                   			tempValue->addUnderlyingValue(resulti);
307
                   			mylist.push_back(tempValue);
308

  
309
                   		}
310

  
311
            }
312

  
313

  
314
         return mylist;
315
    }
latest10/hec/Saxon.C.API/XdmMap.h
1
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 2020 Saxonica Limited.
3
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7

  
8
#ifndef SAXON_XDM_MAP_h
9
#define SAXON_XDM_MAP_h
10

  
11

  
12
#include "XdmFunctionItem.h"
13
#include <string>
14

  
15
#include <stdlib.h>
16
#include <string.h>
17
#include <map>
18
#include <set>
19

  
20
class XdmMap : public XdmFunctionItem {
21

  
22
public:
23

  
24
    XdmMap();
25

  
26
    XdmMap(const XdmMap &d);
27

  
28

  
29
    virtual ~XdmMap(){
30
	//std::cerr<<"destructor called for XdmMap"<<std::endl;
31

  
32
    }
33

  
34
    XdmMap(jobject);
35

  
36
    XdmMap(std::map<XdmAtomicValue *, XdmValue*> value);
37

  
38
    int mapSize();
39

  
40
    XdmValue * get(XdmAtomicValue* key);
41

  
42
    XdmValue * get(const char * key);
43

  
44
    XdmValue * get(int key);
45

  
46
    XdmValue * get(double key);
47

  
48
    XdmValue *  get(long key);
49

  
50
    XdmMap * put(XdmAtomicValue * key, XdmValue * value);
51

  
52
    XdmMap * remove(XdmAtomicValue* key);
53

  
54
    std::set<XdmAtomicValue*> keySet();
55

  
56
    //std::map<XdmAtomicValue*, XdmValue*> asMap();
57

  
58
    bool isEmpty();
59

  
60
    bool containsKey(XdmAtomicValue* key);
61

  
62
    std::list<XdmValue*> values();
63

  
64

  
65

  
66
	/**
67
	* Get the type of the object
68
	*/
69
	XDM_TYPE getType() {
70
		return XDM_FUNCTION_ITEM;
71
	}
72

  
73

  
74
private:
75

  
76

  
77
    std::string fname;
78
    std::map<XdmAtomicValue *, XdmValue*> data;
79
    int arity;
80

  
81
};
82

  
83

  
84

  
85

  
86
#endif
latest10/hec/saxonc-doc/doc/phpapi.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<section id="saxon_c_php_api" title="Saxon/C PHP API">
3

  
4
   <h1>Saxon/C PHP API</h1>
5

  
6
   <nav>
7
      <ul/>
8
   </nav>
9

  
10
   <section id="saxon_c_php_saxonprocessor" title="Saxon\SaxonProcessor">
11
      <h1>Saxon\SaxonProcessor Class</h1>
12

  
13
      <table>
14
         <thead>
15
            <tr>
16
               <td>Return</td>
17
               <td>Function name and Description</td>
18
            </tr>
19
         </thead>
20

  
21
         <tr>
22
            <td/>
23
            <td>
24
               <em>
25
                  <a class="bodylink code" href="../saxon_c_php_saxonprocessor">SaxonProcessor()</a>
26
               </em>
27
               <br/>
28
               <em>Default Constructor. Create an unlicensed Saxon Processor</em>
29
            </td>
30
         </tr>
31
         <tr>
32
            <td/>
33
            <td><a class="bodylink code" href="../saxon_c_php_saxonprocessor"
34
               >SaxonProcessor</a>(boolean $license)<br/>
35
               <em>Constructor. Indicates whether the Processor requires features of Saxon that need
36
                  a license file. If false, the method will creates a Configuration appropriate for
37
                  Saxon HE (Home edition). If true, the method will create a Configuration
38
                  appropriate to the version of the software that is running Saxon-PE or
39
                  Saxon-EE</em>
40
            </td>
41
         </tr>
42
         <tr>
43
            <td/>
44
            <td><a class="bodylink code" href="../saxon_c_php_saxonprocessor"
45
               >SaxonProcessor</a>(boolean $license, string $cwd) <br/>
46
               <em>Constructor. Indicates whether the Processor requires features of Saxon that need
47
                  a license file. The cwd arugment is used to manually set the current working
48
                  directory used for executions of source files</em>
49
            </td>
50
         </tr>
51
         <tr>
52
            <td>
53
               <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>
54
            </td>
55
            <td>createAtomicValue($primitive_type val)<br/>
56
               <em>Create an Xdm Atomic value from any of the main primitive types (i.e. bool, int,
57
                  float, double, string)</em>
58
            </td>
59
         </tr>
60
         <tr>
61
            <td>Saxon\<a class="bodylink code" href="../saxon_c_php_xdmnode">XdmNode</a>
62
            </td>
63
            <td>parseXmlFromString(string $value) <br/>
64
               <em>Create an <a class="bodylink code" href="../saxon_c_php_xdmnode">XdmNode</a>
65
                  object. The $value is a lexical representation of the XML document</em>
66
            </td>
67
         </tr>
68
         <tr>
69
            <td>Saxon\<a class="bodylink code" href="../saxon_c_php_xdmnode">XdmNode</a>
70
            </td>
71
            <td>parseXmlFromFile(string $fileName) <br/>
72
               <em>Create an <a class="bodylink code" href="../saxon_c_php_xdmnode">XdmNode</a>
73
                  object. Value is a string type and the file name to the XML document. File name
74
                  can be relative or absolute. IF relative the cwd is used to resolve the file.</em>
75
            </td>
76
         </tr>
77
         <tr>
78
            <td>void </td>
79
            <td>setcwd(string $cwd) <br/>
80
               <em>Set the current working directory used to resolve against files</em>
81
            </td>
82
         </tr>
83
         <tr>
84
            <td>Saxon\<a class="bodylink code" href="../saxon_c_php_xdmnode">XdmNode</a>
85
            </td>
86
            <td>parseXmlFromFile(string $fileName) <br/>
87
               <em>Create an <a class="bodylink code" href="../saxon_c_php_xdmnode">XdmNode</a>
88
                  object. Value is a string type and the file name to the XML document. File name
89
                  can be relative or absolute. IF relative the cwd is used to resolve the file.</em>
90
            </td>
91
         </tr>
92
         <tr>
93
            <td>void </td>
94
            <td>setResourceDirectory(string $dir) <br/>
95
               <em>Set the resources directory of where Saxon can locate data folder</em>
96
            </td>
97
         </tr>
98
         <tr>
99
            <td>void </td>
100
            <td>setConfigurationProperty(string $name, string $value) <br/>
101
               <em>Set a configuration property specific to the processor in use. Properties
102
                  specified here are common across all the processors. See <a class="bodylink code"
103
                     href="http://www.saxonica.com/documentation/index.html#!configuration/config-features"
104
                     >Configuration Features</a></em>
105
            </td>
106
         </tr>
107
         <tr>
108
            <td>Saxon\<a class="bodylink code" href="../saxon_c_php_xsltprocessor">XsltProcessor</a>
109
            </td>
110
            <td>newXsltProcessor() <br/>
111
               <em>Create an <a class="bodylink code" href="../saxon_c_php_xsltprocessor"
112
                     >XsltProcessor</a> in the PHP environment. An <a class="bodylink code"
113
                     href="../saxon_c_php_xsltprocessor">XsltProcessor</a> is used to compile and
114
                  execute XSLT sytlesheets</em>
115
            </td>
116
         </tr>
117
         <tr>
118
            <td>Saxon\<a class="bodylink code" href="../saxon_c_php_xslt30processor"
119
                  >Xslt30Processor</a>
120
            </td>
121
            <td>newXslt30Processor() <br/>
122
               <em>Create an <a class="bodylink code" href="../saxon_c_php_xslt30processor"
123
                     >Xslt30Processor</a> in the PHP environment specifically designed for XSLT 3.0
124
                  processing. An <a class="bodylink code" href="../saxon_c_php_xslt30processor"
125
                     >Xslt30Processor</a> is used to compile and execute XSLT 3.0 sytlesheets. Use
126
                  this class object (<a class="bodylink code" href="../saxon_c_php_xslt30processor"
127
                     >Xslt30Processor</a>) instead of the <a class="bodylink code"
128
                     href="../saxon_c_php_xsltprocessor">XsltProcessor</a> for XSLT 3.0
129
                  processing.</em>
130
            </td>
131
         </tr>
132
         <tr>
133
            <td>Saxon\<a class="bodylink code" href="../saxon_c_php_xqueryprocessor"
134
                  >XQueryProcessor</a>
135
            </td>
136
            <td>newXQueryProcessor() <br/>
137
               <em>Create an <a class="bodylink code" href="../saxon_c_php_xqueryprocessor"
138
                     >XQueryProcessor</a> in the PHP environment. An <a class="bodylink code"
139
                     href="../saxon_c_php_xqueryprocessor">XQueryProcessor</a> is used to compile
140
                  and execute XQuery queries</em>
141
            </td>
142
         </tr>
143
         <tr>
144
            <td>Saxon\XPathProcesssor </td>
145
            <td>newXPathProcessor() <br/>
146
               <em>Create an <a class="bodylink code" href="../saxon_c_php_xpathprocessor"
147
                     >XPathProcessor</a> in the PHP environment. An <a class="bodylink code"
148
                     href="../saxon_c_php_xpathprocessor">XPathProcessor</a> is used to compile and
149
                  execute XPath expressions</em>
150
            </td>
151
         </tr>
152
         <tr>
153
            <td>Saxon\<a class="bodylink code" href="../saxon_c_php_schemavalidator"
154
                  >SchemaValidator</a>
155
            </td>
156
            <td>newSchemaValidator() <br/>
157
               <em>Create a <a class="bodylink code" href="../saxon_c_php_schemavalidator"
158
                     >SchemaValidator</a> in the PHP environment. A <a class="bodylink code"
159
                     href="../saxon_c_php_schemavalidator">SchemaValidator</a> provides capabilities
160
                  to load and cache XML schema definitions. You can also valdiate source documents
161
                  with egistered XML schema definitions</em>
162
            </td>
163
         </tr>
164
         <tr>
165
            <td>string </td>
166
            <td>version() <br/>
167
               <em>Report the Java Saxon version</em>
168
            </td>
169
         </tr>
170
         <tr>
171
            <td>void </td>
172
            <td>registerPHPFunctions(string $library) <br/>
173
               <em>Enables the ability to use PHP functions as XSLT functions. Accepts as parameter
174
                  the full path of the Saxon/C PHP Extension library. This is needed to do the
175
                  callbacks</em>
176
            </td>
177
         </tr>
178
      </table>
179

  
180
   </section>
181

  
182
   <section id="saxon_c_php_xsltprocessor" title="Saxon\XsltProcessor">
183
      <h1>Saxon\XsltProcessor Class</h1>
184

  
185
      <table>
186
         <thead>
187
            <tr>
188
               <td>Return</td>
189
               <td>Function name and Description</td>
190
            </tr>
191
         </thead>
192

  
193
         <tr>
194
            <td>
195
               <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>
196
            </td>
197
            <td>runQueryToValue() <br/>
198
               <em>compile and evaluate the query. Result returned as an <a class="bodylink code"
199
                     href="../saxon_c_php_xdmvalue">XdmValue</a> object. If there are failures then
200
                  a null is returned</em>
201
            </td>
202
         </tr>
203
         <tr>
204
            <td>string </td>
205
            <td>runQueryToString() <br/>
206
               <em>compile and evaluate the query. Result returned as string. If there are failures
207
                  then a null is returned</em>
208
            </td>
209
         </tr>
210
         <tr>
211
            <td>void </td>
212
            <td>runQueryToFile(string $outfilename) <br/>
213
               <em>compile and evaluate the query. Save the result to file</em>
214
            </td>
215
         </tr>
216
         <tr>
217
            <td>void </td>
218
            <td>setQueryContent(string $str) <br/>
219
               <em>query supplied as a string</em>
220
            </td>
221
         </tr>
222
         <tr>
223
            <td>void </td>
224
            <td>setQueryItem(<a class="bodylink code" href="../saxon_c_php_xdmitem">XdmItem</a>
225
               $item) <br/> ** </td>
226
         </tr>
227
         <tr>
228
            <td>void </td>
229
            <td>setQueryFile($string $filename) <br/>
230
               <em>query supplied as a file</em>
231
            </td>
232
         </tr>
233
         <tr>
234
            <td>void </td>
235
            <td>setContextItemFromFile(string $fileName) <br/>
236
               <em>Set the initial context item for the query. Supplied as filename</em>
237
            </td>
238
         </tr>
239
         <tr>
240
            <td>void </td>
241
            <td>setContextItem(Xdm $obj) <br/>
242
               <em>Set the initial context item for the query. Any one of the objects are accepted:
243
                     <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>, <a
244
                     class="bodylink code" href="../saxon_c_php_xdmitem">XdmItem</a>, <a
245
                     class="bodylink code" href="../saxon_c_php_xdmnode">XdmNode</a> and <a
246
                     class="bodylink code" href="../saxon_c_php_xdmatomicvalue"
247
                  >XdmAtomicValue</a>.</em>
248
            </td>
249
         </tr>
250
         <tr>
251
            <td>void </td>
252
            <td>setQueryBaseURI(string $uri) <br/>
253
               <em>Set the static base URI for a query expressions compiled using this XQuery
254
                  Processor. The base URI is part of the static context, and is used to resolve any
255
                  relative URIS appearing within a query</em>
256
            </td>
257
         </tr>
258
         <tr>
259
            <td>void </td>
260
            <td>declareNamespace(string $prefix, string $namespace) <br/>
261
               <em>Declare a namespace binding as part of the static context for XPath expressions
262
                  compiled using this XQuery processor</em>
263
            </td>
264
         </tr>
265
         <tr>
266
            <td>void </td>
267
            <td>setParameter(string $name, <a class="bodylink code" href="../saxon_c_php_xdmvalue"
268
                  >XdmValue</a> $value) <br/>
269
               <em>Set the parameters required for XQuery Processor</em>
270
            </td>
271
         </tr>
272
         <tr>
273
            <td>void </td>
274
            <td>setProperty(string $name, string $value) <br/>
275
               <em>Set properties for Query.</em>
276
            </td>
277
         </tr>
278
         <tr>
279
            <td>void </td>
280
            <td>clearParameters() <br/>
281
               <em>Clear parameter values set</em>
282
            </td>
283
         </tr>
284
         <tr>
285
            <td>void </td>
286
            <td>clearProperties() <br/>
287
               <em>Clear property values set</em>
288
            </td>
289
         </tr>
290
         <tr>
291
            <td>void </td>
292
            <td>exceptionClear() <br/>
293
               <em>Clear any exception thrown</em>
294
            </td>
295
         </tr>
296
         <tr>
297
            <td>string </td>
298
            <td>getErrorCode(int $i) <br/>
299
               <em>Get the ith error code if there are any errors</em>
300
            </td>
301
         </tr>
302
         <tr>
303
            <td>string </td>
304
            <td>getErrorMessage(int $i) <br/>
305
               <em>Get the ith error message if there are any error</em>
306
            </td>
307
         </tr>
308
         <tr>
309
            <td>int </td>
310
            <td>getExceptionCount() <br/>
311
               <em>Get number of error during execution or evaluate of query</em>
312
            </td>
313
         </tr>
314

  
315
      </table>
316
   </section>
317

  
318
   <section id="saxon_c_php_xslt30processor" title="Saxon\Xslt30Processor">
319
      <h1>Saxon\Xslt30Processor Class</h1>
320

  
321
      <table>
322
         <thead>
323
            <tr>
324
               <td>Return</td>
325
               <td>Function name and Description</td>
326
            </tr>
327
         </thead>
328

  
329
         <tr>
330
            <td>void </td>
331
            <td>addPackages(array packageFileNames) <br/>
332
               <em>File names to XsltPackages stored on filestore are added to a set of packages,
333
                  which will imported later for use when compiling.</em>
334
            </td>
335
         </tr>
336
         <tr>
337
            <td>void </td>
338
            <td>applyTemplatesReturningFile(string $stylesheetFileName) <br/>
339
               <em>Invoke the stylesheet by applying templates to a supplied input sequence, Saving
340
                  the results to file. The stylesheet file name argument can be supplied here. If
341
                  null then the most recently compiled stylsheet is used.</em>
342
            </td>
343
         </tr>
344
         <tr>
345
            <td>string </td>
346
            <td>applyTemplatesReturningString(string $stylesheetFileName) <br/>
347
               <em>Invoke the stylesheet by applying templates to a supplied input sequence. The
348
                  result is returned as a serialized string. The stylesheet file name argument can
349
                  be supplied here. If null then the most recently compiled stylsheet is used.</em>
350
            </td>
351
         </tr>
352
         <tr>
353
            <td>PyXdmValue </td>
354
            <td>applyTemplatesReturningValue(string $stylesheetFileName) <br/>
355
               <em>Invoke the stylesheet by applying templates to a supplied input sequence. the
356
                  result is returned as an <a class="bodylink code" href="../saxon_c_php_xdmvalue"
357
                     >XdmValue</a> object. The stylesheet file name argument can be supplied here.
358
                  If null then the most recently compiled stylsheet is used.</em>
359
            </td>
360
         </tr>
361
         <tr>
362
            <td>void </td>
363
            <td>compileFromAssociatedFile(string xmlFileName)<br/>
364
               <em>Get the stylesheet associated via the xml-stylesheet processing instruction (see
365
                     <a href="http://www.w3.org/TR/xml-stylesheet/"
366
                     >http://www.w3.org/TR/xml-stylesheet/</a>) with the document document specified
367
                  in the source parameter, and that match the given criteria. If there are several
368
                  suitable xml-stylesheet processing instructions, then the returned Source will
369
                  identify a synthesized stylesheet module that imports all the referenced
370
                  stylesheet module.</em>
371
            </td>
372
         </tr>
373
         <tr>
374
            <td>void </td>
375
            <td>compileFromFile(string $fileName) <br/>
376
               <em>Compile a stylesheet suplied as by file name</em>
377
            </td>
378
         </tr>
379
         <tr>
380
            <td>void </td>
381
            <td>compileFromString(string $str) <br/>
382
               <em>Compile a stylesheet received as a string.</em>
383
            </td>
384
         </tr>
385
         <tr>
386
            <td>void </td>
387
            <td>compileFromValue(<a class="bodylink code" href="../saxon_c_php_xdmnode">XdmNode</a> $node)<br/>
388
               <em>Compile a stylesheet received as an <a class="bodylink code"
389
                     href="../saxon_c_php_xdmnode">XdmNode</a>.</em>
390
            </td>
391
         </tr>
392
         <tr>
393
            <td>void </td>
394
            <td>compileFromFileAndSave(string $fileName, string outputFileName) <br/>
395
               <em>Compile a stylesheet suplied as by file name and save as an exported file
396
                  (SEF)</em>
397
            </td>
398
         </tr>
399
         <tr>
400
            <td>void </td>
401
            <td>compileFromStringAndSave(string $str, string outputFileName) <br/>
402
               <em>Compile a stylesheet received as a string and save as an exported file
403
                  (SEF).</em>
404
            </td>
405
         </tr>
406
         <tr>
407
            <td>void </td>
408
            <td>compileFromValueAndSave(<a class="bodylink code" href="../saxon_c_php_xdmnode"
409
                  >XdmNode</a> $node, string outputFileName)<br/>
410
               <em>Compile a stylesheet received as an <a class="bodylink code"
411
                     href="../saxon_c_php_xdmnode">XdmNode</a> and save as an exported file
412
                  (SEF).</em>
413
            </td>
414
         </tr>
415
         <tr>
416
            <td>void </td>
417
            <td>callFunctionReturningFile(string $FunctionName, array arguments, string
418
               outputfileName) <br/>
419
               <em>Call a public user-defined function in the stylesheet. Here we wrap the result in
420
                  an XML document, and sending this document to a specified file. Arguments:
421
                  function name and array of <a class="bodylink code" href="../saxon_c_php_xdmvalue"
422
                     >XdmValue</a> objects - he values of the arguments to be supplied to the
423
                  function. These will be converted if necessary to the type as defined in the
424
                  function signature, using the function conversion rules. * </em></td>
425
         </tr>
426
         <tr>
427
            <td>
428
               <em> string </em>
429
            </td>
430
            <td>
431
               <em> callFunctionReturningString(string $FunctionName, array arguments) <br/> *Call a
432
                  public user-defined function in the stylesheet. Here we wrap the result in an XML
433
                  document, and serialized this document to string value. Arguments: function name
434
                  and array of <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>
435
                  objects - he values of the arguments to be supplied to the function. These will be
436
                  converted if necessary to the type as defined in the function signature, using the
437
                  function conversion rules.</em>
438
            </td>
439
         </tr>
440
         <tr>
441
            <td>PyXdmValue </td>
442
            <td>callFunctionReturningValue(string $FunctionName, array arguments) <br/>
443
               <em>Call a public user-defined function in the stylesheet. Here we wrap the result in
444
                  an XML document, and return the document as an XdmVale. Arguments: function name
445
                  and array of <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>
446
                  objects - he values of the arguments to be supplied to the function. These will be
447
                  converted if necessary to the type as defined in the function signature, using the
448
                  function conversion rules.</em>
449
            </td>
450
         </tr>
451
         <tr>
452
            <td>void </td>
453
            <td>callTemplateReturningFile(string $stylesheetFileName, string $templateName, string
454
               outputfileName) <br/>
455
               <em>Invoke a transformation by calling a named template. The result is stored in the
456
                  supplied outputfile name. If the templateName argument is null then the
457
                  xsl:iitial-template is used. Parameters supplied using
458
                  setInitialTemplateParameters are made available to the called template.</em>
459
            </td>
460
         </tr>
461
         <tr>
462
            <td>string </td>
463
            <td>callTemplateReturningString(string $stylesheetFileName, string $templateName) <br/>
464
               <em>Invoke a transformation by calling a named template and return result as a
465
                  string. If the templateName argument is null then the xsl:iitial-template is used.
466
                  Parameters supplied using setInitialTemplateParameters are made available to the
467
                  called template.</em>
468
            </td>
469
         </tr>
470
         <tr>
471
            <td>PyXdmValue </td>
472
            <td>callTemplateReturningValue(string $stylesheetFileName, string $templateName) <br/>
473
               <em>Invoke a transformation by calling a named template and return result as an <a
474
                     class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>. If the
475
                  templateName argument is null then the xsl:iitial-template is used. Parameters
476
                  supplied using setInitialTemplateParameters are made available to the called
477
                  template.</em>
478
            </td>
479
         </tr>
480
         <tr>
481
            <td>void </td>
482
            <td>transformFileToFile(string $sourceFileName, string $stylesheetFileName, string
483
               outputfileName) <br/>
484
               <em>Perform a one shot transformation. The result is stored in the supplied
485
                  outputfile name.</em>
486
            </td>
487
         </tr>
488
         <tr>
489
            <td>
490
               <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>
491
            </td>
492
            <td>transformFileToValue(string $fileName) <br/>
493
               <em>Perform a one shot transformation. The result is returned as an <a
494
                     class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a></em>
495
            </td>
496
         </tr>
497
         <tr>
498
            <td>
499
               <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>
500
            </td>
501
            <td>transformFileToString(string $fileName) <br/>
502
               <em>Perform a one shot transformation. The result is returned as a stringe</em>
503
            </td>
504
         </tr>
505
         <tr>
506
            <td>void </td>
507
            <td>transformToFile() <br/>
508
               <em>Perform the transformation based upon cached stylesheet and source document.
509
                  Result is saved to the supplied file name</em>
510
            </td>
511
         </tr>
512
         <tr>
513
            <td>string </td>
514
            <td>transformToString() <br/>
515
               <em>Perform the transformation based upon cached stylesheet and source document.
516
                  Result is returned as a serialized string</em>
517
            </td>
518
         </tr>
519
         <tr>
520
            <td>PyXdmValue </td>
521
            <td>transformToValue() <br/>
522
               <em>Perform the transformation based upon cached stylesheet and any source document.
523
                  Result returned as an <a class="bodylink code" href="../saxon_c_php_xdmvalue"
524
                     >XdmValue</a> object. If there are failures then a null is returned</em>
525
            </td>
526
         </tr>
527
         <tr>
528
            <td>void </td>
529
            <td>setInitialTemplateParameters(array parameters, bool tunnel) <br/>
530
               <em>Set parameters to be passed to the initial template. These are used whether the
531
                  transformation is invoked by applying templates to an initial source item, or by
532
                  invoking a named template. The parameters in question are the xsl:param elements
533
                  appearing as children of the xsl:template element. The tunnel argument if set to
534
                  true these values are to be used for setting tunnel parameters.</em>
535
            </td>
536
         </tr>
537
         <tr>
538
            <td>void </td>
539
            <td>setInitialMatchSelection() <br/>
540
               <em>The initial value to which templates are to be applied (equivalent to the
541
                  'select' attribute of xsl:apply-templates)</em>
542
            </td>
543
         </tr>
544
         <tr>
545
            <td>void </td>
546
            <td>setInitialMatchSelectionAsFile <br/>
547
               <em>The initial filename to which templates are to be applied (equivalent to the
548
                  'select' attribute of xsl:apply-templates) * </em></td>
549
         </tr>
550
         <tr>
551
            <td>
552
               <em> void </em>
553
            </td>
554
            <td>
555
               <em> setGlobalContextItem <br/> *Set the source document from an <a
556
                     class="bodylink code" href="../saxon_c_php_xdmnode">XdmNode</a> for the
557
                  transformation.</em>
558
            </td>
559
         </tr>
560
         <tr>
561
            <td>void </td>
562
            <td>setGlobalContextFromFile <br/>
563
               <em>Set the source from file for the transformation.</em>
564
            </td>
565
         </tr>
566
         <tr>
567
            <td>void </td>
568
            <td>setOutputFile(string $fileName) <br/>
569
               <em>Set the output file name of where the transformation result is sent</em>
570
            </td>
571
         </tr>
572
         <tr>
573
            <td>void </td>
574
            <td>setParameter(string $name, <a class="bodylink code" href="../saxon_c_php_xdmvalue"
575
                  >XdmValue</a> $value) <br/>
576
               <em>Set the parameters required for XSLT stylesheet</em>
577
            </td>
578
         </tr>
579
         <tr>
580
            <td>void </td>
581
            <td>setProperty(string $name, string $value) <br/>
582
               <em>Set properties for the stylesheet.</em>
583
            </td>
584
         </tr>
585
         <tr>
586
            <td>void </td>
587
            <td>setJustInTimeCompilation(bool $value) <br/>
588
               <em>ay whether just-in-time compilation of template rules should be used.</em>
589
            </td>
590
         </tr>
591
         <tr>
592
            <td>void </td>
593
            <td>setResultAsRawValue(bool $value) <br/>
594
               <em>Set true if the return type of callTemplate, applyTemplates and transform methods
595
                  is to return <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>,
596
                  otherwise return <a class="bodylink code" href="../saxon_c_php_xdmnode"
597
                     >XdmNode</a> object with root Document node.</em>
598
            </td>
599
         </tr>
600
         <tr>
601
            <td>void </td>
602
            <td>clearParameters() <br/>
603
               <em>Clear parameter values set</em>
604
            </td>
605
         </tr>
606
         <tr>
607
            <td>void </td>
608
            <td>clearProperties() <br/>
609
               <em>Clear property values set</em>
610
            </td>
611
         </tr>
612
         <tr>
613
            <td>void </td>
614
            <td>exceptionClear() <br/>
615
               <em>Clear any exception thrown</em>
616
            </td>
617
         </tr>
618
         <tr>
619
            <td>string </td>
620
            <td>getErrorCode(int $i) <br/>
621
               <em>Get the ith error code if there are any errors</em>
622
            </td>
623
         </tr>
624
         <tr>
625
            <td>string </td>
626
            <td>getErrorMessage(int $i) <br/>
627
               <em>Get the ith error message if there are any error</em>
628
            </td>
629
         </tr>
630
         <tr>
631
            <td>int </td>
632
            <td>getExceptionCount() <br/>
633
               <em>Get number of error during execution or evaluate of stylesheet</em>
634
            </td>
635
         </tr>
636

  
637
      </table>
638
   </section>
639

  
640
   <section id="saxon_c_php_xqueryprocessor" title="Saxon\XQueryProcessor">
641
      <h1>Saxon\XQueryProcessor Class</h1>
642

  
643
      <table>
644
         <thead>
645
            <tr>
646
               <td>Return</td>
647
               <td>Function name and Description</td>
648
            </tr>
649
         </thead>
650

  
651
         <tr>
652
            <td>
653
               <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>
654
            </td>
655
            <td>runQueryToValue() <br/>
656
               <em>compile and evaluate the query. Result returned as an <a class="bodylink code"
657
                     href="../saxon_c_php_xdmvalue">XdmValue</a> object. If there are failures then
658
                  a null is returned</em>
659
            </td>
660
         </tr>
661
         <tr>
662
            <td>string </td>
663
            <td>runQueryToString() <br/>
664
               <em>compile and evaluate the query. Result returned as string. If there are failures
665
                  then a null is returned</em>
666
            </td>
667
         </tr>
668
         <tr>
669
            <td>void </td>
670
            <td>runQueryToFile(string $outfilename) <br/>
671
               <em>compile and evaluate the query. Save the result to file</em>
672
            </td>
673
         </tr>
674
         <tr>
675
            <td>void </td>
676
            <td>setQueryContent(string $str) <br/>
677
               <em>query supplied as a string</em>
678
            </td>
679
         </tr>
680
         <tr>
681
            <td>void </td>
682
            <td>setQueryItem(<a class="bodylink code" href="../saxon_c_php_xdmitem">XdmItem</a>
683
               $item) <br/> ** </td>
684
         </tr>
685
         <tr>
686
            <td>void </td>
687
            <td>setQueryFile($string $filename) <br/>
688
               <em>query supplied as a file</em>
689
            </td>
690
         </tr>
691
         <tr>
692
            <td>void </td>
693
            <td>setContextItemFromFile(string $fileName) <br/>
694
               <em>Set the initial context item for the query. Supplied as filename</em>
695
            </td>
696
         </tr>
697
         <tr>
698
            <td>void </td>
699
            <td>setContextItem(Xdm $obj) <br/>
700
               <em>Set the initial context item for the query. Any one of the objects are accepted:
701
                     <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>, <a
702
                     class="bodylink code" href="../saxon_c_php_xdmitem">XdmItem</a>, <a
703
                     class="bodylink code" href="../saxon_c_php_xdmnode">XdmNode</a> and <a
704
                     class="bodylink code" href="../saxon_c_php_xdmatomicvalue"
705
                  >XdmAtomicValue</a>.</em>
706
            </td>
707
         </tr>
708
         <tr>
709
            <td>void </td>
710
            <td>setQueryBaseURI(string $uri) <br/>
711
               <em>Set the static base URI for a query expressions compiled using this XQuery
712
                  Processor. The base URI is part of the static context, and is used to resolve any
713
                  relative URIS appearing within a query</em>
714
            </td>
715
         </tr>
716
         <tr>
717
            <td>void </td>
718
            <td>declareNamespace(string $prefix, string $namespace) <br/>
719
               <em>Declare a namespace binding as part of the static context for XPath expressions
720
                  compiled using this XQuery processor</em>
721
            </td>
722
         </tr>
723
         <tr>
724
            <td>void </td>
725
            <td>setParameter(string $name, <a class="bodylink code" href="../saxon_c_php_xdmvalue"
726
                  >XdmValue</a> $value) <br/>
727
               <em>Set the parameters required for XQuery Processor</em>
728
            </td>
729
         </tr>
730
         <tr>
731
            <td>void </td>
732
            <td>setProperty(string $name, string $value) <br/>
733
               <em>Set properties for Query.</em>
734
            </td>
735
         </tr>
736
         <tr>
737
            <td>void </td>
738
            <td>clearParameters() <br/>
739
               <em>Clear parameter values set</em>
740
            </td>
741
         </tr>
742
         <tr>
743
            <td>void </td>
744
            <td>clearProperties() <br/>
745
               <em>Clear property values set</em>
746
            </td>
747
         </tr>
748
         <tr>
749
            <td>void </td>
750
            <td>exceptionClear() <br/>
751
               <em>Clear any exception thrown</em>
752
            </td>
753
         </tr>
754
         <tr>
755
            <td>string </td>
756
            <td>getErrorCode(int $i) <br/>
757
               <em>Get the ith error code if there are any errors</em>
758
            </td>
759
         </tr>
760
         <tr>
761
            <td>string </td>
762
            <td>getErrorMessage(int $i) <br/>
763
               <em>Get the ith error message if there are any error</em>
764
            </td>
765
         </tr>
766
         <tr>
767
            <td>int </td>
768
            <td>getExceptionCount() <br/>
769
               <em>Get number of error during execution or evaluate of query</em>
770
            </td>
771
         </tr>
772

  
773
      </table>
774

  
775
   </section>
776

  
777

  
778
   <section id="saxon_c_php_xpathprocessor" title="Saxon\XPathProcessor">
779
      <h1>Saxon\XPathProcessor Class</h1>
780

  
781
      <table>
782
         <thead>
783
            <tr>
784
               <td>Return</td>
785
               <td>Function name and Description</td>
786
            </tr>
787
         </thead>
788

  
789
         <tr>
790
            <td>void </td>
791
            <td>setContextItem(string $fileName) <br/>
792
               <em>Set the context item from a <a class="bodylink code"
793
                     href="../saxon_c_php_xdmitem">XdmItem</a></em>
794
            </td>
795
         </tr>
796
         <tr>
797
            <td>void </td>
798
            <td>setContextFile(string $fileName) <br/>
799
               <em>Set the context item from file</em>
800
            </td>
801
         </tr>
802
         <tr>
803
            <td>boolean </td>
804
            <td>effectiveBooleanValue(string $xpathStr) <br/>
805
               <em>Evaluate the XPath expression, returning the effective boolean value of the
806
                  result.</em>
807
            </td>
808
         </tr>
809
         <tr>
810
            <td>
811
               <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a>
812
            </td>
813
            <td>evaluate(string $xpathStr) <br/>
814
               <em>Compile and evaluate an XPath expression, supplied as a character string. Result
815
                  is an <a class="bodylink code" href="../saxon_c_php_xdmvalue">XdmValue</a></em>
816
            </td>
817
         </tr>
818
         <tr>
819
            <td>
820
               <a class="bodylink code" href="../saxon_c_php_xdmitem">XdmItem</a>
821
            </td>
822
            <td>evaluateSingle(string $xpathStr) <br/>
823
               <em>Compile and evaluate an XPath expression whose result is
824
                  expected to be a single item, with a given context item. The expression is
825
                  supplied as a character string, and the result returned as an <a
826
                          class="bodylink code" href="../saxon_c_php_xdmitem">XdmItem</a>.
827
                  Return NULL if the expression returns an empty sequence. If the expression
828
                  returns a sequence of more than one item, any items after the first are ignored.</em>
829
            </td>
830
         </tr>
831
         <tr>
832
            <td>void </td>
833
            <td>declareNamespace(string $prefix, string $namespace) <br/>
834
               <em>Declare a namespace binding as part of the static context for XPath expressions
835
                  compiled using this <a class="bodylink code" href="../saxon_c_php_xpathprocessor"
836
                     >XPathProcessor</a></em>
837
            </td>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff