Changeset 15669 for other-projects
- Timestamp:
- 2008-05-23T12:35:40+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/trunk/gs3-webservices-democlient/src/GS3DemoClient/org/greenstone/gs3client/data/NodeData.java
r15222 r15669 65 65 * or <documentNode nodeID = "x" /> */ 66 66 public NodeData(Element nodeTag) { 67 this.nodeTag = nodeTag; // store this node's tag information. Useful 68 // for when we are setting the children of this NodeData 69 this.hasChildren = this.nodeTag.hasChildNodes(); 70 71 // We'd definitely have the nodeID attribute, but to be on the safe 72 // side, check it's there first: 73 this.nodeID = nodeTag.hasAttribute(GSXML.NODE_ID_ATT) ? 74 nodeTag.getAttribute(GSXML.NODE_ID_ATT) : ""; 67 this.nodeTag = nodeTag; // store this node's tag information. Useful 68 // for when we are setting the children of this NodeData 69 70 // We'd definitely have the nodeID attribute, but to be on the safe 71 // side, check it's there first: 72 this.nodeID = nodeTag.hasAttribute(GSXML.NODE_ID_ATT) ? 73 nodeTag.getAttribute(GSXML.NODE_ID_ATT) : ""; 74 75 // To determine whether this DocumentNodeData has children, we need 76 // to know whether the DocumentNodeElement it represents has child 77 // DocNodeElements. This kind of information is embedded inside a 78 // nodeStructure element which will often contain a repeat of the 79 // nodeTag-documentNodeElement itself. Therefore, we get the nodeTag's 80 // first descendent element that is a documentNodeElement and check 81 // whether it too has the same nodeID. If so, then we check whether 82 // that documentNodeElement has child nodes - which in that case will 83 // all be documentNodeElements. 84 Element innerDocNode = ParseUtil.getFirstDescElementCalled( 85 nodeTag, GSXML.DOC_NODE_ELEM); 86 if(innerDocNode == null 87 || !innerDocNode.getAttribute(GSXML.NODE_ID_ATT).equals(this.nodeID)) 88 { 89 innerDocNode = this.nodeTag; 90 } 91 this.hasChildren = innerDocNode.hasChildNodes(); 75 92 } 76 93
Note:
See TracChangeset
for help on using the changeset viewer.