SaxonC 12.7.0
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
SchemaValidator.h
1
2// Copyright (c) 2022 - 2025 Saxonica Limited.
3// This Source Code Form is subject to the terms of the Mozilla Public License,
4// v. 2.0. If a copy of the MPL was not distributed with this file, You can
5// obtain one at http://mozilla.org/MPL/2.0/. This Source Code Form is
6// "Incompatible With Secondary Licenses", as defined by the Mozilla Public
7// License, v. 2.0.
9
10#ifndef SAXON_SCHEMA_H
11#define SAXON_SCHEMA_H
12
13#include "saxonc_export.h"
14#include "saxonc/SaxonProcessor.h"
15
16#include <string>
17
18class SaxonProcessor;
19class XdmValue;
20class XdmNode;
21class XdmItem;
22
26class SAXONC_EXPORT SchemaValidator {
27public:
34
43 SchemaValidator(SaxonProcessor *proc, std::string cwd = "");
44
49 SchemaValidator(const SchemaValidator &other);
50
55
62
68 void setcwd(const char *cwd);
69
75 const char * getcwd();
76
88 void registerSchemaFromFile(const char *xsd);
89
96 void registerSchemaFromString(const char *schemaStr,
97 const char *systemID = nullptr);
98
104 void registerSchemaFromNode(XdmNode *node);
105
113 void exportSchema(const char *fileName);
114
119 void setOutputFile(const char *outputFile);
120
125 const char *getOutputFile();
126
133 void validate(const char *sourceFile = nullptr);
134
142 XdmNode *validateToNode(const char *sourceFile = nullptr);
143
150 void setSourceNode(XdmNode *source);
151
160 XdmNode *getValidationReport();
161
169 void setParameter(const char *name, XdmValue *value, bool withParam=true);
170
176 bool removeParameter(const char *name);
177
184 void setProperty(const char *name, const char *value);
185
194 void clearParameters(bool deleteValues = false);
195
199 void clearProperties();
200
207 XdmValue *getParameter(const char *name, bool withParam=true);
208
212 std::map<std::string, XdmValue *> &getParameters();
213
217 std::map<std::string, std::string> &getProperties();
218
223 bool exceptionOccurred();
224
231 const char *checkException();
232
237 void exceptionClear();
238
239
246 const char *getErrorMessage();
247
254 const char *getErrorCode();
255
265 void setLax(bool l);
266
270 int64_t getUnderlyingValidator() { return cppV; }
271
276
277private:
278 bool lax;
280 *proc;
281 // jclass cppClass; /*!< JNI object where the SchemaValidator method will be
282 // invoked */
283 int64_t cppV;
284 std::string cwdV;
285 std::string
286 outputFile;
287 std::map<std::string, XdmValue *>
288 parameters;
290 std::map<std::string, std::string>
291 properties;
293 SaxonApiException *exception;
295};
296
297#endif /* SAXON_SCHEMA_H */
SAXONC_EXPORT void setParameter(sxnc_parameter **parameters, int *parLen, int *parCap, const char *name, sxnc_value *value)
Set a parameter.
Definition SaxonCGlue.c:160
SAXONC_EXPORT int64_t getParameter(sxnc_parameter *parameters, int parLen, const char *name)
Get a parameter from the list.
Definition SaxonCGlue.c:136
SAXONC_EXPORT void setProperty(sxnc_property **properties, int *propLen, int *propCap, const char *name, const char *value)
Set a property.
Definition SaxonCGlue.c:186
SaxonApiException.
Definition SaxonApiException.h:24
The SaxonProcessor class acts as a factory for generating XQuery, XPath, Schema and XSLT compilers.
Definition SaxonProcessor.h:117
Definition SchemaValidator.h:26
SaxonProcessor * getSaxonProcessor()
Get the SaxonProcessor which created this SchemaValidator.
Definition SchemaValidator.h:275
int64_t getUnderlyingValidator()
Get the underlying Java object of the C++ schema validator.
Definition SchemaValidator.h:270
SchemaValidator & operator=(const SchemaValidator &other)
The copy assignment= operator.
The class XdmItem represents an item in a sequence, as defined by the XDM data model.
Definition XdmItem.h:31
This class represents a node in the XDM data model.
Definition XdmNode.h:57
An XdmValue represents a value in the XDM data model.
Definition XdmValue.h:43