SaxonC  11.6
Saxon Processor library for C/C++, PHP and Python
DocumentBuilder.h
1 // Copyright (c) 2022 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 DOCUMENT_BUILDER_H
9 #define DOCUMENT_BUILDER_H
10 
11 
12 #include "SaxonProcessor.h"
13 //#include "XdmValue.h"
14 #include <string>
15 
16 class SaxonProcessor;
17 class SaxonApiException;
18 class XdmNode;
19 class SchemaValidator;
20 
34 
35  friend class SaxonProcessor;
36 
37 
38  public:
39 
44 
59  void setLineNumbering(bool option);
60 
70  bool isLineNumbering();
71 
83  void setSchemaValidator(SchemaValidator * validator);
84 
92 
101  void setDTDValidation(bool option);
102 
103 
110  bool isDTDValidation();
111 
112 
125  void setBaseUri(const char* uri);
126 
133  const char * getBaseUri();
134 
135 
146  XdmNode* parseXmlFromString(const char * content);
147 
156  XdmNode* parseXmlFromFile(const char * filename);
157 
167  XdmNode * parseXmlFromUri(const char* source);
168 
173  bool exceptionOccurred();
174 
176  void exceptionClear();
177 
179 
183  const char * getErrorMessage();
184 
185 
187 
191  const char * getErrorCode();
192 
193 
195 
201 
202 
203  private:
204 
205 
213  DocumentBuilder() ;
214 
215 
216 
217 
218 
220 
224  DocumentBuilder(SaxonProcessor* p, jobject docBuilderObject, std::string cwd);
225 
230  DocumentBuilder(const DocumentBuilder &other);
231 
232 
233  void createException(const char * message=nullptr);
234 
235  SchemaValidator * schemaValidator;
238  std::string cwdXP;
239  jobject docBuilderObject;
240  jclass docBuilderClass, procClass;
241  jclass saxonCAPIClass;
242  std::string cwdDB, baseURI;
243  bool lineNumbering, dtdVal;
244 } ;
245 
246 #endif /* DOCUMENT_BUILDER_H */
Definition: DocumentBuilder.h:33
void setLineNumbering(bool option)
Definition: DocumentBuilder.cpp:75
SaxonApiException * getException()
Get the SaxonApiException object created when we have an error.
Definition: DocumentBuilder.cpp:276
XdmNode * parseXmlFromFile(const char *filename)
Definition: DocumentBuilder.cpp:201
SchemaValidator * getSchemaValidator()
Definition: DocumentBuilder.cpp:114
~DocumentBuilder()
Definition: DocumentBuilder.cpp:65
const char * getErrorMessage()
Get the error message if an error has been reported by JNI.
Definition: DocumentBuilder.cpp:271
void setSchemaValidator(SchemaValidator *validator)
Definition: DocumentBuilder.cpp:97
bool isLineNumbering()
Definition: DocumentBuilder.cpp:89
void setBaseUri(const char *uri)
Definition: DocumentBuilder.cpp:145
const char * getBaseUri()
Definition: DocumentBuilder.cpp:162
bool isDTDValidation()
Definition: DocumentBuilder.cpp:138
XdmNode * parseXmlFromUri(const char *source)
Definition: DocumentBuilder.cpp:226
const char * getErrorCode()
Get the error code if an error has been reported by JNI.
Definition: DocumentBuilder.cpp:266
void exceptionClear()
Clear any exception thrown.
Definition: DocumentBuilder.cpp:255
void setDTDValidation(bool option)
Definition: DocumentBuilder.cpp:120
XdmNode * parseXmlFromString(const char *content)
Definition: DocumentBuilder.cpp:167
bool exceptionOccurred()
Definition: DocumentBuilder.cpp:281
Definition: SaxonApiException.h:19
The SaxonProcessor class acts as a factory for generating XQuery, XPath, Schema and XSLT compilers.
Definition: SaxonProcessor.h:119
jclass procClass
Definition: SaxonProcessor.h:653
std::string cwd
Definition: SaxonProcessor.h:637
jclass saxonCAPIClass
Definition: SaxonProcessor.h:654
jobject proc
Definition: SaxonProcessor.h:638
SaxonApiException * exception
Definition: SaxonProcessor.h:665
Definition: SchemaValidator.h:24
Definition: XdmNode.h:31