- Timestamp:
- 2003-09-19T15:03:09+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/help/HelpFrame.java
r5521 r5525 158 158 // Traverse the document hierarchy, building a tree representing its structure 159 159 Node documentNode = document.getFirstChild(); 160 NodeList sections = documentNode.getChildNodes(); 161 for (int i = 0; i < sections.getLength(); i++) { 162 Node section = sections.item(i); 163 buildContentsHierarchy(rootNode, section); 160 161 int sectionNum = 0; 162 NodeList children = documentNode.getChildNodes(); 163 for (int i = 0; i < children.getLength(); i++) { 164 Node child = children.item(i); 165 if (child.getNodeName().equals("Section")) { 166 sectionNum++; 167 buildContentsHierarchy(rootNode, sectionNum + "", child); 168 } 164 169 } 165 170 } … … 170 175 171 176 172 public void buildContentsHierarchy(MutableTreeNode parent, Node node) 173 { 174 // We're only interested in the Section nodes 175 if (!node.getNodeName().equals("Section")) { 176 return; 177 } 178 177 public void buildContentsHierarchy(MutableTreeNode parent, String pos, Node node) 178 { 179 179 // Determine the section name 180 180 String sectionName = ((Element) node).getAttribute("name"); … … 186 186 Node child = children.item(i); 187 187 if (child.getNodeName().equals("Title")) { 188 sectionTitle = child.getFirstChild().getNodeValue();188 sectionTitle = pos + ": " + child.getFirstChild().getNodeValue(); 189 189 } 190 190 } … … 195 195 196 196 // Apply recursively to the children of this node 197 int sectionNum = 0; 197 198 for (int i = 0; i < children.getLength(); i++) { 198 199 Node child = children.item(i); 199 buildContentsHierarchy(item, child); 200 if (child.getNodeName().equals("Section")) { 201 sectionNum++; 202 buildContentsHierarchy(item, pos + "." + sectionNum, child); 203 } 200 204 } 201 205 }
Note:
See TracChangeset
for help on using the changeset viewer.