Saxon/C  1.1.2
Saxon Processor library for C/C++/PHP
 All Classes Functions Variables
SchemaValidator.h
1 // Copyright (c) 2015 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.
7 
8 #ifndef SAXON_SCHEMA_H
9 #define SAXON_SCHEMA_H
10 
11 
12 #include "SaxonProcessor.h"
13 //#include "XdmValue.h"
14 //#include "XdmItem.h"
15 
16 #include <string>
17 
18 class SaxonProcessor;
19 class XdmValue;
20 class XdmNode;
21 class XdmItem;
22 
27 public:
28 
30 
34 
36 
41  SchemaValidator(SaxonProcessor* proc, std::string cwd="");
42 
44 
48  void setcwd(const char* cwd);
49 
51 
55  void registerSchemaFromFile(const char * xsd);
56 
57  void registerSchemaFromString(const char * schemaStr);
58 
63  void setOutputFile(const char * outputFile);
64 
65 
71  void validate(const char * sourceFile = NULL);
72 
74 
78  XdmNode * validateToNode(const char * sourceFile = NULL);
79 
80 
82 
85  void setSourceNode(XdmNode * source);
86 
88 
93 
94 
101  void setParameter(const char * name, XdmValue*value);
102 
103 
110  bool removeParameter(const char * name);
117  void setProperty(const char * name, const char * value);
118 
125  void clearParameters(bool deleteValues=false);
126 
130  void clearProperties();
131 
132 
136  std::map<std::string,XdmValue*>& getParameters();
137 
141  std::map<std::string,std::string>& getProperties();
142 
147  bool exceptionOccurred();
148 
149 
151 
154  const char* checkException();
155 
157  void exceptionClear();
158 
160 
163  int exceptionCount();
164 
166 
170  const char * getErrorMessage(int i);
171 
173 
177  const char * getErrorCode(int i);
178 
179 
180 private:
181  SaxonProcessor * proc;
182  XdmItem * sourceNode;
183  jclass cppClass;
184  jobject cppV;
185  std::string cwdV;
186  std::string outputFile;
187  std::map<std::string,XdmValue*> parameters;
188  std::map<std::string,std::string> properties;
190 };
191 
192 
193 
194 
195 #endif /* SAXON_XPATH_H */
std::map< std::string, std::string > & getProperties()
Definition: SchemaValidator.cpp:468
bool exceptionOccurred()
Definition: SchemaValidator.cpp:399
void setParameter(const char *name, XdmValue *value)
Definition: SchemaValidator.cpp:423
SchemaValidator()
Default constructor.
Definition: SchemaValidator.cpp:8
Definition: XdmNode.h:21
std::map< std::string, XdmValue * > & getParameters()
Definition: SchemaValidator.cpp:463
void registerSchemaFromFile(const char *xsd)
Register the schema from file name.
Definition: SchemaValidator.cpp:72
Definition: SchemaValidator.h:26
Definition: XdmValue.h:44
bool removeParameter(const char *name)
Definition: SchemaValidator.cpp:430
void setProperty(const char *name, const char *value)
Definition: SchemaValidator.cpp:434
XdmNode * validateToNode(const char *sourceFile=NULL)
Validate an instance document supplied as a Source object.
Definition: SchemaValidator.cpp:301
const char * getErrorCode(int i)
Get the i'th error code if there are any error.
Definition: SchemaValidator.cpp:389
const char * checkException()
Check for exception thrown.
Definition: SchemaValidator.cpp:403
void validate(const char *sourceFile=NULL)
Definition: SchemaValidator.cpp:225
void clearProperties()
Definition: SchemaValidator.cpp:459
Definition: SaxonProcessor.h:290
Definition: XdmItem.h:15
void clearParameters(bool deleteValues=false)
Definition: SchemaValidator.cpp:443
XdmNode * getValidationReport()
Get the Validation report.
Definition: SchemaValidator.cpp:52
void exceptionClear()
Clear any exception thrown.
Definition: SchemaValidator.cpp:381
void setOutputFile(const char *outputFile)
Definition: SchemaValidator.cpp:48
void setSourceNode(XdmNode *source)
Set the source node for validation.
Definition: SchemaValidator.cpp:414
const char * getErrorMessage(int i)
Get the ith error message if there are any validation errors.
Definition: SchemaValidator.cpp:394
void setcwd(const char *cwd)
Set the Current working Directory.
Definition: SchemaValidator.cpp:42
int exceptionCount()
Get number of errors during validation of the source against the schema.
Definition: SchemaValidator.cpp:407