Revision 22
Added by Matt Jones almost 25 years ago
src/edu/ucsb/nceas/metacat/ElementNode.java | ||
---|---|---|
1 |
/** |
|
2 |
* Name: ReaderElement.java |
|
3 |
* Purpose: A Class that represents an XML element and its contents, |
|
4 |
* and can build itself from a database connection |
|
5 |
* Institution: National Center for Ecological Analysis and Synthesis |
|
6 |
* Copyright: 2000 |
|
7 |
* Authors: Matt Jones |
|
8 |
* |
|
9 |
* Version: '$Id$' |
|
10 |
*/ |
|
11 |
|
|
12 |
//package project; |
|
13 |
|
|
14 |
import java.sql.*; |
|
15 |
import java.io.IOException; |
|
16 |
import java.util.Hashtable; |
|
17 |
import java.util.Enumeration; |
|
18 |
|
|
19 |
public class ReaderElement extends BasicElement { |
|
20 |
|
|
21 |
private Connection conn; |
|
22 |
|
|
23 |
public ReaderElement (Connection conn, long nodeid) { |
|
24 |
|
|
25 |
this.conn = conn; |
|
26 |
//Lookup data for self |
|
27 |
String tagname = "foo"; |
|
28 |
long parent_id = 999; |
|
29 |
super(tagname, parent_id); |
|
30 |
|
|
31 |
//Lookup list of child nodes |
|
32 |
//foreach childnode (childid,childtype) |
|
33 |
// if (type.equals("ATTRIBUTE")) { |
|
34 |
// add the att to attribute hash |
|
35 |
// else (type.equals("ELEMENT")) { |
|
36 |
// ReaderElement child = new ReaderElement(childid); |
|
37 |
// add child to vector of children |
|
38 |
// } |
|
39 |
//} |
|
40 |
|
|
41 |
} |
|
42 |
} |
|
0 | 43 |
src/edu/ucsb/nceas/metacat/DBSAXNode.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
this.conn = conn; |
28 | 28 |
writeElementToDB(); |
29 |
};
|
|
29 |
} |
|
30 | 30 |
|
31 | 31 |
/** creates SQL code and inserts new element into DB connection */ |
32 | 32 |
private void writeElementToDB() { |
src/edu/ucsb/nceas/metacat/DBSAXElement.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
this.conn = conn; |
28 | 28 |
writeElementToDB(); |
29 |
};
|
|
29 |
} |
|
30 | 30 |
|
31 | 31 |
/** creates SQL code and inserts new element into DB connection */ |
32 | 32 |
private void writeElementToDB() { |
src/edu/ucsb/nceas/metacat/ReaderElement.java | ||
---|---|---|
1 |
/** |
|
2 |
* Name: ReaderElement.java |
|
3 |
* Purpose: A Class that represents an XML element and its contents, |
|
4 |
* and can build itself from a database connection |
|
5 |
* Institution: National Center for Ecological Analysis and Synthesis |
|
6 |
* Copyright: 2000 |
|
7 |
* Authors: Matt Jones |
|
8 |
* |
|
9 |
* Version: '$Id$' |
|
10 |
*/ |
|
11 |
|
|
12 |
//package project; |
|
13 |
|
|
14 |
import java.sql.*; |
|
15 |
import java.io.IOException; |
|
16 |
import java.util.Hashtable; |
|
17 |
import java.util.Enumeration; |
|
18 |
|
|
19 |
public class ReaderElement extends BasicElement { |
|
20 |
|
|
21 |
private Connection conn; |
|
22 |
|
|
23 |
public ReaderElement (Connection conn, long nodeid) { |
|
24 |
|
|
25 |
this.conn = conn; |
|
26 |
//Lookup data for self |
|
27 |
String tagname = "foo"; |
|
28 |
long parent_id = 999; |
|
29 |
super(tagname, parent_id); |
|
30 |
|
|
31 |
//Lookup list of child nodes |
|
32 |
//foreach childnode (childid,childtype) |
|
33 |
// if (type.equals("ATTRIBUTE")) { |
|
34 |
// add the att to attribute hash |
|
35 |
// else (type.equals("ELEMENT")) { |
|
36 |
// ReaderElement child = new ReaderElement(childid); |
|
37 |
// add child to vector of children |
|
38 |
// } |
|
39 |
//} |
|
40 |
|
|
41 |
} |
|
42 |
} |
|
0 | 43 |
DBSAXElement.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
this.conn = conn; |
28 | 28 |
writeElementToDB(); |
29 |
};
|
|
29 |
} |
|
30 | 30 |
|
31 | 31 |
/** creates SQL code and inserts new element into DB connection */ |
32 | 32 |
private void writeElementToDB() { |
Also available in: Unified diff
created code to read XML doc from db source and emit it as an XML stream