Saxon/C  1.2.1
Saxon Processor library for C/C++, PHP and Python
XdmNode.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_XDMNODE_h
9 #define SAXON_XDMNODE_h
10 
11 #include "XdmItem.h"
12 #include <string.h>
13 //#include "XdmValue.h"
14 
15 typedef enum eXdmNodeKind { DOCUMENT = 9, ELEMENT = 1, ATTRIBUTE = 2, TEXT = 3, COMMENT = 8, PROCESSING_INSTRUCTION = 7, NAMESPACE = 13, UNKNOWN = 0 } XDM_NODE_KIND;
16 
17 
18 
19 class XdmValue;
20 
21 class XdmNode : public XdmItem
22 {
23 
24 public:
25 
26 
27  /* XdmNode(const XdmValue& valuei){
28  //value = (sxnc_value *)malloc(sizeof(sxnc_value));
29  value = valuei.values[0]->getUnderlyingCValue();
30  xdmSize =1;
31  refCount = 1;
32  nodeKind = UNKNOWN;
33  }*/
34 
35  XdmNode(jobject);
36 
37  XdmNode(XdmNode *parent, jobject, XDM_NODE_KIND);
38 
39  virtual ~XdmNode() {
40  if (getRefCount() <1){
41  delete baseURI;
42  delete nodeName;
43  }
44 
45  //There might be potential issues with children and attribute node not being deleted when the parent node has been deleted
46  //we need to track this kind of problem.
47  }
48 
49  virtual bool isAtomic();
50 
51 
52  XDM_NODE_KIND getNodeKind();
53 
60  const char * getNodeName();
61 
69 
70  const char* getBaseUri();
71 
84  const char * getStringValue();
85 
86 
87  const char * toString();
88 
89  XdmNode* getParent();
90 
91 
92  const char* getAttributeValue(const char *str);
93 
94  int getAttributeCount();
95 
96  XdmNode** getAttributeNodes();
97 
98  jobject getUnderlyingValue() {
99 
101 
102  }
103 
104 
105  XdmNode** getChildren();
106 
107  int getChildCount();
108 
112  XDM_TYPE getType() {
113  return XDM_NODE;
114  }
115 
116  // const char* getOuterXml();
117 
118 
119 
120 private:
121  const char * baseURI;
122  const char * nodeName;
123  XdmNode ** children; //caches child nodes when getChildren method is first called;
124  int childCount;
125  XdmNode * parent;
126  XdmValue * typedValue;
127  XdmNode ** attrValues;//caches attribute nodes when getAttributeNodes method is first called;
128  int attrCount;
129  XDM_NODE_KIND nodeKind;
130 
131 };
132 
133 #endif
const char * getNodeName()
Definition: XdmNode.cpp:34
const char * getStringValue()
Definition: XdmNode.cpp:98
XdmValue * getTypedValue()
Definition: XdmNode.cpp:72
XDM_TYPE getType()
Definition: XdmNode.h:112
Definition: XdmNode.h:21
Definition: XdmValue.h:46
Definition: XdmItem.h:15
jobject getUnderlyingValue()
Definition: XdmNode.h:98
virtual jobject getUnderlyingValue()
Definition: XdmItem.cpp:46
const char * toString()
Definition: XdmNode.cpp:102