1
|
/**
|
2
|
* Name: TextNode.java
|
3
|
* Purpose: A Class that represents an XML Text node and its contents,
|
4
|
* and can build itself from a database connection
|
5
|
* Copyright: 2000 Regents of the University of California and the
|
6
|
* National Center for Ecological Analysis and Synthesis
|
7
|
* Authors: Matt Jones
|
8
|
*
|
9
|
* Version: '$Id: TextNode.java 129 2000-06-07 02:08:37Z jones $'
|
10
|
*/
|
11
|
|
12
|
package edu.ucsb.nceas.metacat;
|
13
|
|
14
|
import java.sql.*;
|
15
|
|
16
|
/**
|
17
|
* A Class that represents an XML element and its contents,
|
18
|
* and can build itself from a database connection
|
19
|
*/
|
20
|
public class TextNode extends BasicNode {
|
21
|
|
22
|
private Connection conn;
|
23
|
private String nodeData = null;
|
24
|
|
25
|
/**
|
26
|
* Construct a new TextNode instance
|
27
|
*
|
28
|
* @param conn the database connection to use to initialize
|
29
|
* @param nodeid the element_id for the node to be created
|
30
|
* @param parentnodeid the id of the parent node
|
31
|
* @param nodedata the text of the node
|
32
|
* @param nodetype the type of the node
|
33
|
*/
|
34
|
public TextNode (Connection conn, long nodeid, long parentnodeid,
|
35
|
String nodedata, String nodetype) {
|
36
|
this.conn = conn;
|
37
|
setElementID(nodeid);
|
38
|
setParentID(parentnodeid);
|
39
|
setNodeData(nodedata);
|
40
|
setNodeType(nodetype);
|
41
|
}
|
42
|
|
43
|
/** Set the node data to the given string */
|
44
|
public void setNodeData(String nodedata) {
|
45
|
this.nodeData = nodedata;
|
46
|
}
|
47
|
|
48
|
/** Get the node data as a string value */
|
49
|
public String getNodeData() {
|
50
|
return nodeData;
|
51
|
}
|
52
|
|
53
|
/**
|
54
|
* String representation of this text node
|
55
|
*/
|
56
|
public String toString () {
|
57
|
return nodeData;
|
58
|
}
|
59
|
}
|