SaxonC  11.6
Saxon Processor library for C/C++, PHP and Python
XdmNode.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 SAXON_XDMNODE_h
9 #define SAXON_XDMNODE_h
10 
11 #include "XdmItem.h"
12 #include <string.h>
13 
14 typedef enum eXdmNodeKind { DOCUMENT = 9, ELEMENT = 1, ATTRIBUTE = 2, TEXT = 3, COMMENT = 8, PROCESSING_INSTRUCTION = 7, NAMESPACE = 13, UNKNOWN = 0 } XDM_NODE_KIND;
15 
16 
17 
18 class XdmValue;
19 
30 class XdmNode : public XdmItem
31 {
32 
33 public:
34 
36 
40  XdmNode(jobject);
41 
43 
49  XdmNode(XdmNode *parent, jobject, XDM_NODE_KIND kind);
50 
52 
55  virtual ~XdmNode();
56 
58 
63  virtual bool isAtomic();
64 
66 
70  XdmItem * getHead();
71 
72 
74 
79  XDM_NODE_KIND getNodeKind();
80 
82 
88  const char * getNodeName();
89 
90 
91 
93 
99  const char * getLocalName();
100 
102 
109 
111 
117  const char* getBaseUri();
118 
120 
131  const char * getStringValue();
132 
133 
135 
157  const char * toString();
158 
159 
161 
166  XdmNode* getParent();
167 
168 
170 
178  const char* getAttributeValue(const char *name);
179 
181 
185  int getAttributeCount();
186 
188 
195  XdmNode** getAttributeNodes(bool cache=false);
196 
198 
202  jobject getUnderlyingValue() {
203 
205 
206  }
207 
209 
214  bool isNode(){
215  return true;
216  }
217 
218 
219 
221 
226  XdmNode** getChildren(bool cache = false);
227 
228 
229 
231 
236  XdmNode* getChild(int i, bool cache = false);
237 
238 
240 
244  int getChildCount();
245 
246 
248 
252  XDM_TYPE getType() {
253  return XDM_NODE;
254  }
255 
256 
257 
258 
259 
260 private:
261  const char * baseURI;
262  const char * nodeName;
263  const char * localName;
264  XdmNode ** children;
265  int childCount;
266  XdmNode * parent;
267  XdmValue * typedValue;
268  XdmNode ** attrValues;
269  int attrCount;
270  XDM_NODE_KIND nodeKind;
272 };
273 
274 #endif
Definition: XdmItem.h:29
virtual jobject getUnderlyingValue()
Definition: XdmItem.cpp:66
Definition: XdmNode.h:31
XDM_TYPE getType()
Get the type of the object.
Definition: XdmNode.h:252
const char * getStringValue()
Get the string value of the item. For a node, this gets the string value of the node.
Definition: XdmNode.cpp:203
XdmNode * getParent()
Get the parent of this node.
Definition: XdmNode.cpp:270
const char * getNodeName()
Get the name of the node, as a string in the form of a EQName.
Definition: XdmNode.cpp:133
const char * toString()
The toString() method returns a simple XML serialization of the node with defaulted serialization par...
Definition: XdmNode.cpp:207
XdmValue * getTypedValue()
Get the typed value of this node, as defined in XDM.
Definition: XdmNode.cpp:173
int getAttributeCount()
Get the number of attribute node for this current node.
Definition: XdmNode.cpp:363
const char * getBaseUri()
Get the base URI of this node.
Definition: XdmNode.cpp:229
XdmNode ** getChildren(bool cache=false)
Get all the child nodes from the current parent node.
Definition: XdmNode.cpp:401
const char * getLocalName()
Get the local name of the node.
Definition: XdmNode.cpp:93
XdmItem * getHead()
Get the first item in the sequence.
Definition: XdmNode.cpp:200
bool isNode()
Determine whether the item is a node or some other type of item.
Definition: XdmNode.h:214
virtual bool isAtomic()
Determine whether the item is an atomic value or some other type of item.
Definition: XdmNode.cpp:15
jobject getUnderlyingValue()
Get the underlying JNI Java object for the XdmNode.
Definition: XdmNode.h:202
int getChildCount()
Get the count of child nodes from thie current node.
Definition: XdmNode.cpp:382
XdmNode * getChild(int i, bool cache=false)
Get the ith child nodes from the current parent node.
Definition: XdmNode.cpp:441
XdmNode(jobject)
XdmNode constructor created as a wrapper around an existing Saxon Java object.
Definition: XdmNode.cpp:9
XDM_NODE_KIND getNodeKind()
Get the kind of node.
Definition: XdmNode.cpp:19
XdmNode ** getAttributeNodes(bool cache=false)
Get array of attribute nodes of this element.
Definition: XdmNode.cpp:328
virtual ~XdmNode()
Destructor.
Definition: XdmNode.cpp:56
const char * getAttributeValue(const char *name)
Get the string value of a named attribute (in no namespace) of this element.
Definition: XdmNode.cpp:295
Definition: XdmValue.h:50