Saxon/C  1.1.2
Saxon Processor library for C/C++/PHP
 All Classes Functions Variables
XPathProcessor.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_XPATH_H
9 #define SAXON_XPATH_H
10 
11 
12 
13 #include "SaxonProcessor.h"
14 //#include "XdmValue.h"
15 //#include "XdmItem.h"
16 
17 #include <string>
18 
19 class SaxonProcessor;
20 class XdmValue;
21 class XdmItem;
22 
27 public:
28 
30 
34 
35  ~XPathProcessor(){
37  clearParameters(false);
38  //delete contextItem;
39  }
40 
42 
46  XPathProcessor(SaxonProcessor* proc, std::string cwd="");
47 
49 
55  void setBaseURI(const char * uriStr);
56 
58 
62  XdmValue * evaluate(const char * xpathStr);
63 
64 
66 
70  XdmItem * evaluateSingle(const char * xpathStr);
71 
72  void setContextItem(XdmItem * item);
73 
77  void setcwd(const char* cwd);
78 
80  void setContextFile(const char * filename); //TODO: setContextItemFromFile
81 
83 
86  bool effectiveBooleanValue(const char * xpathStr);
87 
94  void setParameter(const char * name, XdmValue*value);
95 
96 
103  bool removeParameter(const char * name);
104 
105 
113  void setProperty(const char * name, const char * value);
114 
127  void declareNamespace(const char *prefix, const char * uri);
128 
132  std::map<std::string,XdmValue*>& getParameters();
133 
137  std::map<std::string,std::string>& getProperties();
138 
145  void clearParameters(bool deleteValues=false);
146 
150  void clearProperties();
151 
157  // const char* checkException();
158 
163  bool exceptionOccurred();
164 
166  void exceptionClear();
167 
169 
173  int exceptionCount();
174 
176 
180  const char * getErrorMessage(int i);
181 
182 
184 
188  const char * getErrorCode(int i);
189 
191 
194  const char* checkException();
195 
196 
197 private:
198  SaxonProcessor * proc;
199  XdmItem * contextItem;
200  std::string cwdXP;
201  jclass cppClass;
202  jobject cppXP;
203  std::map<std::string,XdmValue*> parameters;
204  std::map<std::string,std::string> properties;
206 };
207 
208 
209 
210 
211 #endif /* SAXON_XPATH_H */
XPathProcessor()
Default constructor.
Definition: XPathProcessor.cpp:7
void declareNamespace(const char *prefix, const char *uri)
Definition: XPathProcessor.cpp:242
std::map< std::string, std::string > & getProperties()
Definition: XPathProcessor.cpp:387
const char * getErrorMessage(int i)
Get the ith error message if there are any error.
Definition: XPathProcessor.cpp:414
void setcwd(const char *cwd)
Definition: XPathProcessor.cpp:378
bool effectiveBooleanValue(const char *xpathStr)
Evaluate the XPath expression, returning the effective boolean value of the result.
Definition: XPathProcessor.cpp:283
void clearParameters(bool deleteValues=false)
Definition: XPathProcessor.cpp:357
XdmItem * evaluateSingle(const char *xpathStr)
Compile and evaluate an XPath expression. The result is expected to be a single XdmItem.
Definition: XPathProcessor.cpp:132
void setParameter(const char *name, XdmValue *value)
Definition: XPathProcessor.cpp:337
bool exceptionOccurred()
Definition: XPathProcessor.cpp:419
Definition: XdmValue.h:44
int exceptionCount()
Get number of errors reported during evaluation of the XPath.
Definition: XPathProcessor.cpp:402
std::map< std::string, XdmValue * > & getParameters()
Definition: XPathProcessor.cpp:382
void exceptionClear()
Clear any exception thrown.
Definition: XPathProcessor.cpp:392
Definition: SaxonProcessor.h:290
Definition: XdmItem.h:15
XdmValue * evaluate(const char *xpathStr)
Compile and evaluate an XPath expression.
Definition: XPathProcessor.cpp:43
const char * getErrorCode(int i)
Get the ith error code if there are any error.
Definition: XPathProcessor.cpp:409
void setBaseURI(const char *uriStr)
Set the static base URI for XPath expressions compiled using this XPathCompiler.
Definition: XPathProcessor.cpp:262
Definition: XPathProcessor.h:26
void setProperty(const char *name, const char *value)
Definition: XPathProcessor.cpp:348
const char * checkException()
Check for exception thrown.
Definition: XPathProcessor.cpp:425
bool removeParameter(const char *name)
Definition: XPathProcessor.cpp:344
void setContextFile(const char *filename)
Set the context item from file.
Definition: XPathProcessor.cpp:234
void clearProperties()
Definition: XPathProcessor.cpp:373