Project

Profile

Help

How to connect?
Download (15.5 KB) Statistics
| Branch: | Tag: | Revision:

he / latest10 / hec / Saxon.C.API / python-saxon / saxoncClasses.pxd @ 6304fb8b

1
from libcpp cimport bool
2
from libcpp.string cimport string
3
from libcpp.map cimport map
4

    
5

    
6

    
7
cdef extern from "../SaxonProcessor.h":
8
    cdef cppclass SaxonProcessor:
9
        SaxonProcessor(bool) except +
10
        SaxonProcessor(const char * configFile) except +
11
        bool license
12
        char * version()
13
        void release()
14

    
15
        # set the current working directory
16
        void setcwd(char* cwd)
17
        const char* getcwd()
18

    
19
        #SaxonProcessor * getProcessor()
20

    
21
        #set saxon resources directory
22
        void setResourcesDirectory(const char* dir)
23

    
24
        #get saxon resources directory
25
        const char * getResourcesDirectory()
26

    
27
        #Set a configuration property specific to the processor in use. 
28
        #Properties specified here are common across all the processors.
29
        void setConfigurationProperty(char * name, char * value)
30

    
31
        #Clear configuration properties specific to the processor in use. 
32
        void clearConfigurationProperties()
33

    
34
        bool isSchemaAware()
35

    
36
        XsltProcessor * newXsltProcessor()
37

    
38
        Xslt30Processor * newXslt30Processor()
39

    
40
        XQueryProcessor * newXQueryProcessor()
41

    
42
        XPathProcessor * newXPathProcessor()
43

    
44
        SchemaValidator * newSchemaValidator()
45

    
46
        XdmAtomicValue * makeStringValue(const char* str1)
47

    
48
        XdmAtomicValue * makeIntegerValue(int i)
49

    
50
        XdmAtomicValue * makeDoubleValue(double d)
51

    
52
        XdmAtomicValue * makeFloatValue(float)
53

    
54
        XdmAtomicValue * makeLongValue(long l)
55

    
56
        XdmAtomicValue * make_boolean_value(bool b)
57

    
58
        XdmAtomicValue * makeBooleanValue(bool b)
59

    
60
        XdmAtomicValue * makeQNameValue(const char* str)
61

    
62
        XdmAtomicValue * makeAtomicValue(const char* type, const char* value)
63

    
64
        const char * getStringValue(XdmItem * item)
65

    
66
        XdmNode * parseXmlFromString(const char* source)
67

    
68
        XdmNode * parseXmlFromFile(const char* source)
69

    
70
        XdmNode * parseXmlFromUri(const char* source)
71

    
72
        bool isSchemaAwareProcessor()
73

    
74
        bool exceptionOccurred()
75

    
76
        void exceptionClear()
77

    
78

    
79
    cdef cppclass XsltProcessor:
80
        XsltProcessor() except +
81
        # set the current working directory
82
        void setcwd(const char* cwd)
83

    
84
        # Set the base output URI.
85
        void setBaseOutputURI(const char * baseURI)
86

    
87
        #Set the source document from an XdmNode for the transformation.
88
        void setSourceFromXdmNode(XdmNode * value)
89

    
90
        #Set the source from file for the transformation.
91
        void setSourceFromFile(const char * filename)
92

    
93
        #Set the output file of where the transformation result is sent
94
        void setOutputFile(const char* outfile)
95

    
96
        void setJustInTimeCompilation(bool jit)
97

    
98
        void setParameter(const char* name, XdmValue*value)
99

    
100
        XdmValue* getParameter(const char* name)
101

    
102
        bool removeParameter(const char* name)
103

    
104
        void setProperty(const char* name, const char* value)
105

    
106
        void clearParameters()
107

    
108
        void clearProperties()
109

    
110
        void setupXslMessage(bool show, const char* filename=nullptr)
111

    
112
        void transformFileToFile(const char* sourcefile, const char* stylesheetfile, const char* outputfile)
113
        
114
        char * transformFileToString(const char* sourcefile, const char* stylesheetfile)
115

    
116
        XdmValue * transformFileToValue(const char* sourcefile, const char* stylesheetfile)
117

    
118
        void compileFromFile(const char* stylesheet)
119

    
120
        void compileFromString(const char* stylesheet)
121

    
122
        void compileFromStringAndSave(const char* stylesheet, const char* filename)
123

    
124
        void compileFromFileAndSave(const char* xslFilename, const char* filename)
125

    
126
        void compileFromXdmNodeAndSave(XdmNode * node, const char* outputfile)
127

    
128
        void compileFromXdmNode(XdmNode * node)
129

    
130
        void releaseStylesheet()
131

    
132
        char * transformToString()
133

    
134
        XdmValue * transformToValue()
135

    
136
        void transformToFile()
137

    
138
        bool exceptionOccurred()
139

    
140
        const char* checkException()
141

    
142
        void exceptionClear()
143
    
144
        int exceptionCount()
145

    
146
        const char * getErrorMessage(int)
147

    
148
        const char * getErrorCode(int)
149

    
150

    
151
    cdef cppclass Xslt30Processor:
152
        Xslt30Processor() except +
153
        # set the current working directory
154
        void setcwd(const char* cwd)
155

    
156
        # Set the base output URI.
157
        void setBaseOutputURI(const char * baseURI)
158

    
159
        void setGlobalContextItem(XdmItem * value)
160

    
161
        # Set the source from file for the transformation.
162
        void setGlobalContextFromFile(const char * filename)
163

    
164
        # The initial value to which templates are to be applied (equivalent to the <code>select</code> attribute of <code>xsl:apply-templates</code>)
165
        void setInitialMatchSelection(XdmValue * selection)
166

    
167
        # The initial filename to which templates are to be applied (equivalent to the <code>select</code> attribute of <code>xsl:apply-templates</code>).
168
        void setInitialMatchSelectionAsFile(const char * filename)
169

    
170
        # Set the output file of where the transformation result is sent
171
        void setOutputFile(const char* outfile)
172

    
173
        # Say whether just-in-time compilation of template rules should be used.
174
        void setJustInTimeCompilation(bool jit)
175

    
176
        void setResultAsRawValue(bool option)
177

    
178
        # Set the value of a stylesheet parameter
179
        void setParameter(const char* name, XdmValue*value, bool _static)
180

    
181
        # Get a parameter value by name
182
        XdmValue* getParameter(const char* name)
183

    
184
        # Remove a parameter (name, value) pair from a stylesheet
185
        bool removeParameter(const char* name)
186

    
187
        # Set a property specific to the processor in use.
188
        void setProperty(const char* name, const char* value)
189

    
190
        void setInitialTemplateParameters(map[string,XdmValue*] parameters, bool tunnel)
191

    
192
        XdmValue ** createXdmValueArray(int len)
193

    
194
        void deleteXdmValueArray(XdmValue** arr, int len)
195

    
196
        # Get a property value by name
197
        const char* getProperty(const char* name)
198

    
199
        # Get all parameters as a std::map
200
        map[string,XdmValue*]& getParameters()
201

    
202
        # Get all properties as a std::map
203
        map[string,string]& getProperties()
204

    
205
        # Clear parameter values set
206
        void clearParameters(bool deleteValues=false)
207

    
208
        # Clear property values set
209
        void clearProperties()
210

    
211
        # Get the messages written using the <code>xsl:message</code> instruction
212
        void setupXslMessage(bool show, const char* filename=nullptr)
213

    
214
        # Perform a one shot transformation. The result is stored in the supplied outputfile.
215
        void transformFileToFile(const char* sourcefile, const char* stylesheetfile, const char* outputfile)
216

    
217
        # Perform a one shot transformation. The result is returned as a string
218
        const char * transformFileToString(const char* sourcefile, const char* stylesheetfile)
219

    
220
        # Perform a one shot transformation. The result is returned as an XdmValue
221
        XdmValue * transformFileToValue(const char* sourcefile, const char* stylesheetfile)
222

    
223
        # compile a stylesheet file.
224
        void compileFromFile(const char* stylesheet)
225

    
226
        # compile a stylesheet received as a string.
227
        void compileFromString(const char* stylesheet)
228

    
229
        # Get the stylesheet associated via the xml-stylesheet processing instruction
230
        void compileFromAssociatedFile(const char* sourceFile)
231

    
232
        # Compile a stylesheet received as a string and save to an exported file (SEF).
233
        void compileFromStringAndSave(const char* stylesheet, const char* filename)
234

    
235
        # Compile a stylesheet received as a file and save to an exported file (SEF).
236
        void compileFromFileAndSave(const char* xslFilename, const char* filename)
237

    
238
        # Compile a stylesheet received as an XdmNode. The compiled stylesheet is cached
239
        # and available for execution later.
240
        void compileFromXdmNodeAndSave(XdmNode * node, const char* filename)
241

    
242
        # compile a stylesheet received as an XdmNode.
243
        void compileFromXdmNode(XdmNode * node)
244

    
245
        # Invoke the stylesheet by applying templates to a supplied input sequence, Saving the results to file.
246
        void applyTemplatesReturningFile(const char * stylesheetFilename, const char* outfile)
247

    
248
        # Invoke the stylesheet by applying templates to a supplied input sequence, Saving the results as serialized string.
249
        const char* applyTemplatesReturningString(const char * stylesheetFilename)
250

    
251
        # Invoke the stylesheet by applying templates to a supplied input sequence, Saving the results as an XdmValue.
252
        XdmValue * applyTemplatesReturningValue(const char * stylesheetFilename)
253

    
254
        # Invoke a transformation by calling a named template and save result to file.
255
        void callTemplateReturningFile(const char * stylesheetFilename, const char* templateName, const char* outfile)
256

    
257
        # Invoke a transformation by calling a named template and return result as a string.
258
        const char* callTemplateReturningString(const char * stylesheetFilename, const char* templateName)
259

    
260
        # Invoke a transformation by calling a named template and return result as an XdmValue.
261
        XdmValue* callTemplateReturningValue(const char * stylesheetFilename, const char* templateName)
262

    
263
        # Call a public user-defined function in the stylesheet
264
        # Here we wrap the result in an XML document, and sending this document to a specified file
265
        void callFunctionReturningFile(const char * stylesheetFilename, const char* functionName, XdmValue ** arguments, int argument_length, const char* outfile)
266

    
267
        # Call a public user-defined function in the stylesheet
268
        # Here we wrap the result in an XML document, and serialized this document to string value
269
        const char * callFunctionReturningString(const char * stylesheetFilename, const char* functionName, XdmValue ** arguments, int argument_length)
270

    
271
        # Call a public user-defined function in the stylesheet
272
        # Here we wrap the result in an XML document, and return the document as an XdmVale
273
        XdmValue * callFunctionReturningValue(const char * stylesheetFilename, const char* functionName, XdmValue ** arguments, int argument_length)
274

    
275
        # Internal method to release cached stylesheet
276
        void releaseStylesheet()
277

    
278
        # Execute transformation to string. Properties supplied in advance.
279
        const char * transformToString(XdmNode * source)
280

    
281
        # Execute transformation to Xdm Value. Properties supplied in advance.
282
        XdmValue * transformToValue(XdmNode * source)
283

    
284
        # Execute transformation to file. Properties supplied in advance.
285
        void transformToFile(XdmNode * source)
286

    
287
        # Checks for pending exceptions without creating a local reference to the exception object
288
        bool exceptionOccurred()
289

    
290
        # Check for exception thrown.
291
        const char* checkException()
292

    
293
        # Clear any exception thrown
294
        void exceptionClear()
295

    
296
        # Get number of errors reported during execution or evaluate of stylesheet
297
        int exceptionCount()
298

    
299
        # Get the ith error message if there are any error
300
        const char * getErrorMessage(int i)
301

    
302
        # Get the ith error code if there are any error
303
        const char * getErrorCode(int i)
304

    
305

    
306
    cdef cppclass SchemaValidator:
307
        SchemaValidator() except +
308

    
309
        void setcwd(const char* cwd)
310

    
311
        void registerSchemaFromFile(const char * xsd)
312

    
313
        void registerSchemaFromString(const char * schemaStr)
314

    
315
        void exportSchema(const char * fileName)
316

    
317
        void setOutputFile(const char * outputFile)
318

    
319
        void validate(const char * sourceFile) except +
320
   
321
        XdmNode * validateToNode(const char * sourceFile) except +
322

    
323
        void setSourceNode(XdmNode * source)
324

    
325
        XdmNode* getValidationReport()
326

    
327
        void setParameter(const char * name, XdmValue*value)
328

    
329
        bool removeParameter(const char * name)
330

    
331
        void setProperty(const char * name, const char * value)
332

    
333
        void clearParameters()
334

    
335
        void clearProperties()
336

    
337
        bool exceptionOccurred()
338

    
339
        const char* checkException()
340

    
341
        void exceptionClear()
342

    
343
        int exceptionCount()
344

    
345
    
346
        const char * getErrorMessage(int i)
347
     
348
        const char * getErrorCode(int i)
349

    
350
        void setLax(bool l)
351

    
352
    cdef cppclass XPathProcessor:
353
        XPathProcessor() except +
354

    
355
        void setBaseURI(const char * uriStr)
356

    
357
        XdmValue * evaluate(const char * xpathStr)
358
   
359
        XdmItem * evaluateSingle(const char * xpathStr)
360

    
361
        void setContextItem(XdmItem * item)
362
        
363
        void setcwd(const char* cwd)
364

    
365
        void setContextFile(const char * filename) 
366

    
367
        bool effectiveBooleanValue(const char * xpathStr)
368

    
369
        void setParameter(const char * name, XdmValue*value)
370

    
371
        bool removeParameter(const char * name)
372

    
373
        void setProperty(const char * name, const char * value)
374

    
375
        void declareNamespace(const char *prefix, const char * uri)
376

    
377
        void setBackwardsCompatible(bool option)
378

    
379
        void setCaching(bool caching)
380

    
381
        void importSchemaNamespace(const char * uri)
382

    
383
        void clearParameters()
384

    
385
        void clearProperties()
386

    
387
        bool exceptionOccurred()
388

    
389
        void exceptionClear()
390

    
391
        int exceptionCount()
392

    
393
        const char * getErrorMessage(int i)
394

    
395
        const char * getErrorCode(int i)
396

    
397
        const char* checkException()
398

    
399
    cdef cppclass XQueryProcessor:
400
        XQueryProcessor() except +
401

    
402
        void setContextItem(XdmItem * value) except +
403

    
404
        void setOutputFile(const char* outfile)
405

    
406
        void setContextItemFromFile(const char * filename) 
407

    
408
        void setParameter(const char * name, XdmValue*value)
409

    
410
        bool removeParameter(const char * name)
411

    
412
        void setProperty(const char * name, const char * value)
413

    
414
        void clearParameters()
415

    
416
        void clearProperties()
417

    
418
        void setUpdating(bool updating)
419

    
420
        XdmValue * runQueryToValue() except +
421
        const char * runQueryToString() except +
422

    
423
        void runQueryToFile() except +
424

    
425
        void declareNamespace(const char *prefix, const char * uri) except +
426

    
427
        void setQueryFile(const char* filename)
428

    
429
        void setQueryContent(const char* content)
430

    
431
        void setQueryBaseURI(const char * baseURI)
432

    
433
        void setcwd(const char* cwd)
434

    
435
        const char* checkException()
436

    
437
        bool exceptionOccurred()
438

    
439
        void exceptionClear()
440

    
441
        int exceptionCount()
442

    
443
        const char * getErrorMessage(int i)
444

    
445
        const char * getErrorCode(int i)
446

    
447

    
448
cdef extern from "../XdmValue.h":
449
    cdef cppclass XdmValue:
450
        XdmValue() except +
451

    
452
        void addXdmItem(XdmItem *val)
453
        #void releaseXdmValue()
454

    
455
        XdmItem * getHead()
456

    
457
        XdmItem * itemAt(int)
458

    
459
        int size()
460

    
461
        const char * toString()
462

    
463
        void incrementRefCount()
464

    
465
        void decrementRefCount()
466

    
467
        int getRefCount()
468

    
469
        int getType()
470

    
471
cdef extern from "../XdmItem.h":
472
    cdef cppclass XdmItem(XdmValue):
473
        XdmItem() except +
474
        const char * getStringValue()
475
        bool isAtomic()
476

    
477
cdef extern from "../XdmNode.h":
478
    cdef cppclass XdmNode(XdmItem):
479
        bool isAtomic()
480

    
481
        int getNodeKind()
482

    
483
        const char * getNodeName()
484

    
485
        XdmValue * getTypedValue()
486

    
487
        const char* getBaseUri()
488

    
489

    
490
        XdmNode* getParent()
491

    
492
        const char* getAttributeValue(const char *str)
493

    
494
        int getAttributeCount()
495

    
496
        XdmNode** getAttributeNodes()
497

    
498
        XdmNode** getChildren()
499

    
500
        int getChildCount()
501

    
502

    
503
cdef extern from "../XdmAtomicValue.h":
504
    cdef cppclass XdmAtomicValue(XdmItem):
505
        XdmAtomicValue() except +
506

    
507
        const char * getPrimitiveTypeName()
508

    
509
        bool getBooleanValue()
510

    
511
        double getDoubleValue()
512

    
513
        long getLongValue()
514

    
(9-9/11)