Revision 126
Added by Matt Jones over 24 years ago
src/edu/ucsb/nceas/metacat/ElementNode.java | ||
---|---|---|
180 | 180 |
children.add(child); |
181 | 181 |
} else if (nodetype.equals("ATTRIBUTE")) { |
182 | 182 |
setAttribute(nodename,nodedata); |
183 |
} else if (nodetype.equals("TEXT")) { |
|
184 |
appendContent(nodedata); |
|
185 |
} |
|
183 |
} |
|
184 |
//else if (nodetype.equals("TEXT")) { |
|
185 |
//appendContent(nodedata); |
|
186 |
//} |
|
186 | 187 |
|
187 | 188 |
} catch (SQLException e) { |
188 | 189 |
System.out.println("Error with getInt: " + e.getMessage()); |
... | ... | |
236 | 237 |
} |
237 | 238 |
} |
238 | 239 |
|
239 |
String cont = getContent(); |
|
240 |
if (!cont.equals("null")) { |
|
241 |
value.append(cont); |
|
242 |
} |
|
240 |
//String cont = getContent();
|
|
241 |
//if (!cont.equals("null")) {
|
|
242 |
//value.append(cont);
|
|
243 |
//}
|
|
243 | 244 |
|
244 | 245 |
if (nodetype.equals("ELEMENT")) { |
245 | 246 |
value.append("</"); |
src/edu/ucsb/nceas/metacat/ReaderElement.java | ||
---|---|---|
180 | 180 |
children.add(child); |
181 | 181 |
} else if (nodetype.equals("ATTRIBUTE")) { |
182 | 182 |
setAttribute(nodename,nodedata); |
183 |
} else if (nodetype.equals("TEXT")) { |
|
184 |
appendContent(nodedata); |
|
185 |
} |
|
183 |
} |
|
184 |
//else if (nodetype.equals("TEXT")) { |
|
185 |
//appendContent(nodedata); |
|
186 |
//} |
|
186 | 187 |
|
187 | 188 |
} catch (SQLException e) { |
188 | 189 |
System.out.println("Error with getInt: " + e.getMessage()); |
... | ... | |
236 | 237 |
} |
237 | 238 |
} |
238 | 239 |
|
239 |
String cont = getContent(); |
|
240 |
if (!cont.equals("null")) { |
|
241 |
value.append(cont); |
|
242 |
} |
|
240 |
//String cont = getContent();
|
|
241 |
//if (!cont.equals("null")) {
|
|
242 |
//value.append(cont);
|
|
243 |
//}
|
|
243 | 244 |
|
244 | 245 |
if (nodetype.equals("ELEMENT")) { |
245 | 246 |
value.append("</"); |
src/edu/ucsb/nceas/metacat/BasicNode.java | ||
---|---|---|
13 | 13 |
import java.io.IOException; |
14 | 14 |
import java.util.Hashtable; |
15 | 15 |
import java.util.Enumeration; |
16 |
import java.util.Vector; |
|
16 | 17 |
|
17 | 18 |
/** A Class that represents an XML element and its contents */ |
18 | 19 |
public class BasicElement { |
19 | 20 |
|
20 | 21 |
private long element_id; |
21 | 22 |
private String tagname; |
22 |
private StringBuffer content; |
|
23 |
//private StringBuffer content;
|
|
23 | 24 |
private long parent_id; |
24 | 25 |
private Hashtable attributes; |
25 | 26 |
private int childNum; |
26 | 27 |
private int nodeIndex; |
27 | 28 |
private String nodeType; |
29 |
private Vector children; |
|
28 | 30 |
|
29 | 31 |
/** Construct a Basic Element */ |
30 | 32 |
public BasicElement () { |
31 |
content = new StringBuffer(); |
|
33 |
//content = new StringBuffer(); |
|
34 |
children = new Vector(); |
|
32 | 35 |
attributes = new Hashtable(); |
36 |
this.childNum = 0; |
|
33 | 37 |
} |
34 | 38 |
|
35 | 39 |
/** Construct a Basic Element |
... | ... | |
46 | 50 |
this.tagname = tagname; |
47 | 51 |
this.parent_id = parent_id; |
48 | 52 |
this.nodeIndex = nodeIndex; |
49 |
this.childNum = 0; |
|
50 | 53 |
} |
51 | 54 |
|
52 | 55 |
/** Construct a Basic Element |
... | ... | |
62 | 65 |
} |
63 | 66 |
|
64 | 67 |
/** convert the element to a string representation for display */ |
68 |
/* |
|
65 | 69 |
public String toString () |
66 | 70 |
{ |
67 | 71 |
StringBuffer value = new StringBuffer(); |
... | ... | |
69 | 73 |
value.append(getTagName()); |
70 | 74 |
value.append(getAttributes().toString()); |
71 | 75 |
value.append('>'); |
72 |
// Process children recursively here? |
|
73 |
// Or do it in ReaderElement using a stack so we don;t have the |
|
74 |
// whole thing in memory at once? |
|
75 |
//value.append("</"); |
|
76 |
//value.append(getTagName()); |
|
77 |
//value.append('>'); |
|
78 | 76 |
return value.toString(); |
79 | 77 |
} |
78 |
*/ |
|
80 | 79 |
|
81 | 80 |
/** Get the id of this element */ |
82 | 81 |
public long getElementID() |
... | ... | |
147 | 146 |
} |
148 | 147 |
|
149 | 148 |
/** Append to the content of the element */ |
149 |
/* |
|
150 | 150 |
public void appendContent(char[] cbuf, int start, int len) { |
151 | 151 |
this.content.append( cbuf, start, len ); |
152 | 152 |
} |
153 |
|
|
153 |
*/ |
|
154 | 154 |
/** Append to the content of the element */ |
155 |
/* |
|
155 | 156 |
public void appendContent(String new_content) { |
156 | 157 |
this.content.append( new_content ); |
157 | 158 |
} |
158 |
|
|
159 |
*/ |
|
159 | 160 |
/** Get the content of the element */ |
161 |
/* |
|
160 | 162 |
public String getContent() { |
161 | 163 |
return this.content.toString(); |
162 | 164 |
} |
165 |
*/ |
|
163 | 166 |
|
164 |
/** Get nodeIndex of the element */ |
|
167 |
/** Get nodeIndex of the node element */
|
|
165 | 168 |
public int getNodeIndex() { |
166 | 169 |
return this.nodeIndex; |
167 | 170 |
} |
168 | 171 |
|
169 |
/** increase childNum when new child for the element is created */
|
|
170 |
public int incChildNum() {
|
|
171 |
return ++this.childNum;
|
|
172 |
}
|
|
172 |
/** Set the node index of this node */
|
|
173 |
public void setNodeIndex(int nodeIndex) {
|
|
174 |
this.nodeIndex = nodeIndex;
|
|
175 |
} |
|
173 | 176 |
|
174 | 177 |
/** Get the type of this node */ |
175 |
public String getNodeType() |
|
176 |
{ |
|
178 |
public String getNodeType() { |
|
177 | 179 |
return nodeType; |
178 | 180 |
} |
179 | 181 |
|
180 | 182 |
/** Set the type of this node */ |
181 |
public void setNodeType(String type) |
|
182 |
{ |
|
183 |
public void setNodeType(String type) { |
|
183 | 184 |
this.nodeType = type; |
184 | 185 |
} |
186 |
|
|
187 |
/** increase childNum when new child for the element is created */ |
|
188 |
public int incChildNum() { |
|
189 |
return ++this.childNum; |
|
190 |
} |
|
191 |
|
|
185 | 192 |
} |
src/edu/ucsb/nceas/metacat/BasicElement.java | ||
---|---|---|
13 | 13 |
import java.io.IOException; |
14 | 14 |
import java.util.Hashtable; |
15 | 15 |
import java.util.Enumeration; |
16 |
import java.util.Vector; |
|
16 | 17 |
|
17 | 18 |
/** A Class that represents an XML element and its contents */ |
18 | 19 |
public class BasicElement { |
19 | 20 |
|
20 | 21 |
private long element_id; |
21 | 22 |
private String tagname; |
22 |
private StringBuffer content; |
|
23 |
//private StringBuffer content;
|
|
23 | 24 |
private long parent_id; |
24 | 25 |
private Hashtable attributes; |
25 | 26 |
private int childNum; |
26 | 27 |
private int nodeIndex; |
27 | 28 |
private String nodeType; |
29 |
private Vector children; |
|
28 | 30 |
|
29 | 31 |
/** Construct a Basic Element */ |
30 | 32 |
public BasicElement () { |
31 |
content = new StringBuffer(); |
|
33 |
//content = new StringBuffer(); |
|
34 |
children = new Vector(); |
|
32 | 35 |
attributes = new Hashtable(); |
36 |
this.childNum = 0; |
|
33 | 37 |
} |
34 | 38 |
|
35 | 39 |
/** Construct a Basic Element |
... | ... | |
46 | 50 |
this.tagname = tagname; |
47 | 51 |
this.parent_id = parent_id; |
48 | 52 |
this.nodeIndex = nodeIndex; |
49 |
this.childNum = 0; |
|
50 | 53 |
} |
51 | 54 |
|
52 | 55 |
/** Construct a Basic Element |
... | ... | |
62 | 65 |
} |
63 | 66 |
|
64 | 67 |
/** convert the element to a string representation for display */ |
68 |
/* |
|
65 | 69 |
public String toString () |
66 | 70 |
{ |
67 | 71 |
StringBuffer value = new StringBuffer(); |
... | ... | |
69 | 73 |
value.append(getTagName()); |
70 | 74 |
value.append(getAttributes().toString()); |
71 | 75 |
value.append('>'); |
72 |
// Process children recursively here? |
|
73 |
// Or do it in ReaderElement using a stack so we don;t have the |
|
74 |
// whole thing in memory at once? |
|
75 |
//value.append("</"); |
|
76 |
//value.append(getTagName()); |
|
77 |
//value.append('>'); |
|
78 | 76 |
return value.toString(); |
79 | 77 |
} |
78 |
*/ |
|
80 | 79 |
|
81 | 80 |
/** Get the id of this element */ |
82 | 81 |
public long getElementID() |
... | ... | |
147 | 146 |
} |
148 | 147 |
|
149 | 148 |
/** Append to the content of the element */ |
149 |
/* |
|
150 | 150 |
public void appendContent(char[] cbuf, int start, int len) { |
151 | 151 |
this.content.append( cbuf, start, len ); |
152 | 152 |
} |
153 |
|
|
153 |
*/ |
|
154 | 154 |
/** Append to the content of the element */ |
155 |
/* |
|
155 | 156 |
public void appendContent(String new_content) { |
156 | 157 |
this.content.append( new_content ); |
157 | 158 |
} |
158 |
|
|
159 |
*/ |
|
159 | 160 |
/** Get the content of the element */ |
161 |
/* |
|
160 | 162 |
public String getContent() { |
161 | 163 |
return this.content.toString(); |
162 | 164 |
} |
165 |
*/ |
|
163 | 166 |
|
164 |
/** Get nodeIndex of the element */ |
|
167 |
/** Get nodeIndex of the node element */
|
|
165 | 168 |
public int getNodeIndex() { |
166 | 169 |
return this.nodeIndex; |
167 | 170 |
} |
168 | 171 |
|
169 |
/** increase childNum when new child for the element is created */
|
|
170 |
public int incChildNum() {
|
|
171 |
return ++this.childNum;
|
|
172 |
}
|
|
172 |
/** Set the node index of this node */
|
|
173 |
public void setNodeIndex(int nodeIndex) {
|
|
174 |
this.nodeIndex = nodeIndex;
|
|
175 |
} |
|
173 | 176 |
|
174 | 177 |
/** Get the type of this node */ |
175 |
public String getNodeType() |
|
176 |
{ |
|
178 |
public String getNodeType() { |
|
177 | 179 |
return nodeType; |
178 | 180 |
} |
179 | 181 |
|
180 | 182 |
/** Set the type of this node */ |
181 |
public void setNodeType(String type) |
|
182 |
{ |
|
183 |
public void setNodeType(String type) { |
|
183 | 184 |
this.nodeType = type; |
184 | 185 |
} |
186 |
|
|
187 |
/** increase childNum when new child for the element is created */ |
|
188 |
public int incChildNum() { |
|
189 |
return ++this.childNum; |
|
190 |
} |
|
191 |
|
|
185 | 192 |
} |
Also available in: Unified diff
continued changing to DOM TEXT node model