Revision 127
Added by Matt Jones over 24 years ago
src/edu/ucsb/nceas/metacat/ElementNode.java | ||
---|---|---|
23 | 23 |
public class ReaderElement extends BasicElement { |
24 | 24 |
|
25 | 25 |
private Connection conn; |
26 |
private Vector children; |
|
27 | 26 |
|
28 | 27 |
/** |
29 | 28 |
* Construct a new ReaderElement instance |
... | ... | |
32 | 31 |
*/ |
33 | 32 |
public ReaderElement (Connection conn) { |
34 | 33 |
this.conn = conn; |
35 |
this.children = new Vector(); |
|
36 | 34 |
} |
37 | 35 |
|
38 | 36 |
/** |
... | ... | |
58 | 56 |
* @param nodeid the element_id for the node to be created |
59 | 57 |
* @param parentnodeid the id of the parent node |
60 | 58 |
* @param nodename the name of the element |
61 |
* @param nodedata the text content of the node |
|
62 | 59 |
*/ |
63 | 60 |
public ReaderElement (Connection conn, long nodeid, long parentnodeid, |
64 |
String nodename, String nodedata) {
|
|
61 |
String nodename, String nodetype) {
|
|
65 | 62 |
this(conn); |
66 | 63 |
setElementID(nodeid); |
67 | 64 |
setParentID(parentnodeid); |
68 | 65 |
setTagName(nodename); |
69 |
//appendContent(nodedata);
|
|
66 |
setNodeType(nodetype);
|
|
70 | 67 |
|
71 | 68 |
// Create child nodes (elements or attributes) |
72 | 69 |
setChildrenNodes(nodeid); |
... | ... | |
127 | 124 |
setElementID(element_id); |
128 | 125 |
setParentID(parentnodeid); |
129 | 126 |
setTagName(nodename); |
130 |
//appendContent(nodedata); |
|
131 | 127 |
} |
132 | 128 |
} |
133 | 129 |
|
... | ... | |
169 | 165 |
nodename = rs.getString(4); |
170 | 166 |
nodedata = rs.getString(5); |
171 | 167 |
|
172 |
// Record our node type |
|
173 |
setNodeType(nodetype); |
|
174 |
|
|
175 | 168 |
if ( (nodetype.equals("ELEMENT")) || |
176 | 169 |
(nodetype.equals("DOCUMENT")) |
177 | 170 |
) { |
178 | 171 |
ReaderElement child = new ReaderElement(conn, |
179 |
element_id,parentnodeid,nodename,nodedata);
|
|
180 |
children.add(child);
|
|
172 |
element_id,parentnodeid,nodename, nodetype);
|
|
173 |
addChildNode(child);
|
|
181 | 174 |
} else if (nodetype.equals("ATTRIBUTE")) { |
182 | 175 |
setAttribute(nodename,nodedata); |
183 | 176 |
} |
... | ... | |
227 | 220 |
|
228 | 221 |
// Process children recursively here |
229 | 222 |
ReaderElement child = null; |
230 |
Enumeration e = children.elements();
|
|
223 |
Enumeration e = getChildren();
|
|
231 | 224 |
while (e.hasMoreElements()) { |
232 | 225 |
child = (ReaderElement)e.nextElement(); |
233 | 226 |
try { |
src/edu/ucsb/nceas/metacat/ReaderElement.java | ||
---|---|---|
23 | 23 |
public class ReaderElement extends BasicElement { |
24 | 24 |
|
25 | 25 |
private Connection conn; |
26 |
private Vector children; |
|
27 | 26 |
|
28 | 27 |
/** |
29 | 28 |
* Construct a new ReaderElement instance |
... | ... | |
32 | 31 |
*/ |
33 | 32 |
public ReaderElement (Connection conn) { |
34 | 33 |
this.conn = conn; |
35 |
this.children = new Vector(); |
|
36 | 34 |
} |
37 | 35 |
|
38 | 36 |
/** |
... | ... | |
58 | 56 |
* @param nodeid the element_id for the node to be created |
59 | 57 |
* @param parentnodeid the id of the parent node |
60 | 58 |
* @param nodename the name of the element |
61 |
* @param nodedata the text content of the node |
|
62 | 59 |
*/ |
63 | 60 |
public ReaderElement (Connection conn, long nodeid, long parentnodeid, |
64 |
String nodename, String nodedata) {
|
|
61 |
String nodename, String nodetype) {
|
|
65 | 62 |
this(conn); |
66 | 63 |
setElementID(nodeid); |
67 | 64 |
setParentID(parentnodeid); |
68 | 65 |
setTagName(nodename); |
69 |
//appendContent(nodedata);
|
|
66 |
setNodeType(nodetype);
|
|
70 | 67 |
|
71 | 68 |
// Create child nodes (elements or attributes) |
72 | 69 |
setChildrenNodes(nodeid); |
... | ... | |
127 | 124 |
setElementID(element_id); |
128 | 125 |
setParentID(parentnodeid); |
129 | 126 |
setTagName(nodename); |
130 |
//appendContent(nodedata); |
|
131 | 127 |
} |
132 | 128 |
} |
133 | 129 |
|
... | ... | |
169 | 165 |
nodename = rs.getString(4); |
170 | 166 |
nodedata = rs.getString(5); |
171 | 167 |
|
172 |
// Record our node type |
|
173 |
setNodeType(nodetype); |
|
174 |
|
|
175 | 168 |
if ( (nodetype.equals("ELEMENT")) || |
176 | 169 |
(nodetype.equals("DOCUMENT")) |
177 | 170 |
) { |
178 | 171 |
ReaderElement child = new ReaderElement(conn, |
179 |
element_id,parentnodeid,nodename,nodedata);
|
|
180 |
children.add(child);
|
|
172 |
element_id,parentnodeid,nodename, nodetype);
|
|
173 |
addChildNode(child);
|
|
181 | 174 |
} else if (nodetype.equals("ATTRIBUTE")) { |
182 | 175 |
setAttribute(nodename,nodedata); |
183 | 176 |
} |
... | ... | |
227 | 220 |
|
228 | 221 |
// Process children recursively here |
229 | 222 |
ReaderElement child = null; |
230 |
Enumeration e = children.elements();
|
|
223 |
Enumeration e = getChildren();
|
|
231 | 224 |
while (e.hasMoreElements()) { |
232 | 225 |
child = (ReaderElement)e.nextElement(); |
233 | 226 |
try { |
src/edu/ucsb/nceas/metacat/BasicNode.java | ||
---|---|---|
184 | 184 |
this.nodeType = type; |
185 | 185 |
} |
186 | 186 |
|
187 |
/** Add a child node to this node */ |
|
188 |
public void addChildNode(BasicElement child) { |
|
189 |
this.children.add(child); |
|
190 |
} |
|
191 |
|
|
192 |
/** Get the an enumeration of the children of this node */ |
|
193 |
public Enumeration getChildren() { |
|
194 |
return children.elements(); |
|
195 |
} |
|
196 |
|
|
187 | 197 |
/** increase childNum when new child for the element is created */ |
188 | 198 |
public int incChildNum() { |
189 | 199 |
return ++this.childNum; |
src/edu/ucsb/nceas/metacat/BasicElement.java | ||
---|---|---|
184 | 184 |
this.nodeType = type; |
185 | 185 |
} |
186 | 186 |
|
187 |
/** Add a child node to this node */ |
|
188 |
public void addChildNode(BasicElement child) { |
|
189 |
this.children.add(child); |
|
190 |
} |
|
191 |
|
|
192 |
/** Get the an enumeration of the children of this node */ |
|
193 |
public Enumeration getChildren() { |
|
194 |
return children.elements(); |
|
195 |
} |
|
196 |
|
|
187 | 197 |
/** increase childNum when new child for the element is created */ |
188 | 198 |
public int incChildNum() { |
189 | 199 |
return ++this.childNum; |
Also available in: Unified diff
continued changing to DOM TEXT node model