Skip to content

Commit dc1af15

Browse files
committed
[bugfix] Compare node types to W3C DOM Node Types
1 parent f2abe8a commit dc1af15

File tree

1 file changed

+6
-6
lines changed
  • exist-core/src/main/java/org/exist/xquery/functions/fn

1 file changed

+6
-6
lines changed

exist-core/src/main/java/org/exist/xquery/functions/fn/FunPath.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ private static int getNodePosition(final Node node) {
133133
* @param node the node whose path values to get
134134
* @param values the path values
135135
*/
136-
private static void getPathValues(Node node, final List<String> values) {
136+
private static void getPathValues(final Node node, final List<String> values) {
137137
@Nullable Node parent = node.getParentNode();
138138

139139
final StringBuilder value = new StringBuilder();
140140

141-
if (node.getNodeType() == Type.ATTRIBUTE) {
141+
if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
142142
// For an attribute node, if the node is in no namespace,
143143
// @local, where local is the local part of the node name.
144144
// Otherwise, @Q{uri}local, where uri is the namespace URI of
@@ -154,23 +154,23 @@ private static void getPathValues(Node node, final List<String> values) {
154154
// attributes have an owner element - not a parent node!
155155
parent = ((Attr) node).getOwnerElement();
156156

157-
} else if (node.getNodeType() == Type.TEXT) {
157+
} else if (node.getNodeType() == Node.TEXT_NODE) {
158158
// For a text node: text()[position] where position is an integer
159159
// representing the position of the selected node among its text
160160
// node siblings
161161
final int nodePosition = getNodePosition(node);
162162
if (nodePosition > 0) {
163163
value.append(String.format("/text()[%d]", nodePosition));
164164
}
165-
} else if (node.getNodeType() == Type.COMMENT) {
165+
} else if (node.getNodeType() == Node.COMMENT_NODE) {
166166
// For a comment node: comment()[position] where position is an
167167
// integer representing the position of the selected node among
168168
// its comment node siblings.
169169
final int nodePosition = getNodePosition(node);
170170
if (nodePosition > 0) {
171171
value.append(String.format("/comment()[%d]", nodePosition));
172172
}
173-
} else if (node.getNodeType() == Type.PROCESSING_INSTRUCTION) {
173+
} else if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
174174
// For a processing-instruction node: processing-instruction(local)[position]
175175
// where local is the name of the processing instruction node and position is
176176
// an integer representing the position of the selected node among its
@@ -179,7 +179,7 @@ private static void getPathValues(Node node, final List<String> values) {
179179
if (nodePosition > 0) {
180180
value.append(String.format("/processing-instruction(%s)[%d]", node.getNodeName(), nodePosition));
181181
}
182-
} else if (node.getNodeType() == Type.NAMESPACE) {
182+
} else if (node.getNodeType() == INode.NAMESPACE_NODE) {
183183
// For a namespace node: If the namespace node has a name: namespace::prefix,
184184
// where prefix is the local part of the name of the namespace node
185185
// (which represents the namespace prefix). If the namespace node

0 commit comments

Comments
 (0)