Changeset 9977
- Timestamp:
- 2005-05-26T16:20:45+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/xpointer/XPointer.java
r8456 r9977 107 107 if (!close) { 108 108 to.append(node.getNodeValue()); 109 to.append(" "); 109 110 } 110 111 } … … 114 115 to.append(node.getNodeValue()); 115 116 to.append(";"); 117 to.append(" "); 116 118 } 117 119 } … … 161 163 } 162 164 165 public static Node getNextNode(Node currentNode) { 166 167 // Try to get the first valid child 168 NodeList children = currentNode.getChildNodes(); 169 for (int c = 0; c < children.getLength(); c++) { 170 Node childNode = children.item(c); 171 172 if (childNode.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE || 173 childNode.getNodeType() == org.w3c.dom.Node.COMMENT_NODE || 174 childNode.getNodeType() == org.w3c.dom.Node.TEXT_NODE || 175 childNode.getNodeType() == org.w3c.dom.Node.ENTITY_NODE) { 176 return childNode; 177 } 178 } 179 180 // now try a siblings and parents siblings 181 Node siblingNode = null; 182 do { 183 siblingNode = currentNode.getNextSibling(); 184 if (siblingNode != null) { 185 // should we be checking type?? 186 return siblingNode; 187 } 188 189 currentNode = currentNode.getParentNode(); 190 } while (currentNode != null); 191 192 return null; 193 } 194 195 163 196 public static Node getNextNode(Node currentNode, StringBuffer buffer) 164 197 { Node reply; … … 176 209 } 177 210 } 178 211 179 212 // Repeat looking for a sibling & going up until done... 180 213 do {
Note:
See TracChangeset
for help on using the changeset viewer.