Revision 826
Added by bojilova over 22 years ago
DBSAXNode.java | ||
---|---|---|
67 | 67 |
* @param tagname the name of the node |
68 | 68 |
* @param parentNode the parent node for this node being created |
69 | 69 |
*/ |
70 |
public DBSAXNode (Connection conn, String tagname, DBSAXNode parentNode, |
|
71 |
long rootnodeid, String docid, String doctype) |
|
72 |
throws SAXException { |
|
70 |
public DBSAXNode (Connection conn, String qName, String lName, |
|
71 |
DBSAXNode parentNode, long rootnodeid, |
|
72 |
String docid, String doctype) |
|
73 |
throws SAXException { |
|
73 | 74 |
|
74 |
super(tagname);
|
|
75 |
super(lName);
|
|
75 | 76 |
this.conn = conn; |
76 | 77 |
this.parentNode = parentNode; |
77 | 78 |
setParentID(parentNode.getNodeID()); |
78 | 79 |
setRootNodeID(rootnodeid); |
79 | 80 |
setDocID(docid); |
80 | 81 |
setNodeIndex(parentNode.incChildNum()); |
81 |
writeChildNodeToDB("ELEMENT", getTagName(), null, docid);
|
|
82 |
writeChildNodeToDB("ELEMENT", qName, null, docid);
|
|
82 | 83 |
//No writing XML Index from here. New Thread used instead. |
83 | 84 |
//updateNodeIndex(docid, doctype); |
84 | 85 |
} |
... | ... | |
92 | 93 |
if (nodetype == "DOCUMENT") { |
93 | 94 |
pstmt = conn.prepareStatement( |
94 | 95 |
"INSERT INTO xml_nodes " + |
95 |
"(nodetype, nodename, docid) " + |
|
96 |
"VALUES (?, ?, ?)"); |
|
96 |
"(nodetype, nodename, nodeprefix, docid) " +
|
|
97 |
"VALUES (?, ?, ?, ?)");
|
|
97 | 98 |
MetaCatUtil.debugMessage("INSERTING DOCNAME: " + nodename); |
98 | 99 |
} else { |
99 | 100 |
pstmt = conn.prepareStatement( |
100 | 101 |
"INSERT INTO xml_nodes " + |
101 |
"(nodetype, nodename, docid, " + |
|
102 |
"(nodetype, nodename, nodeprefix, docid, " +
|
|
102 | 103 |
"rootnodeid, parentnodeid, nodedata, nodeindex) " + |
103 |
"VALUES (?, ?, ?, ?, ?, ?, ?)"); |
|
104 |
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
|
104 | 105 |
} |
105 | 106 |
|
106 | 107 |
// Bind the values to the query |
107 | 108 |
pstmt.setString(1, nodetype); |
108 |
pstmt.setString(2, nodename); |
|
109 |
pstmt.setString(3, docid); |
|
109 |
int idx; |
|
110 |
if ( nodename != null && (idx = nodename.indexOf(":")) != -1 ) { |
|
111 |
pstmt.setString(2, nodename.substring(idx+1)); |
|
112 |
pstmt.setString(3, nodename.substring(0,idx)); |
|
113 |
} else { |
|
114 |
pstmt.setString(2, nodename); |
|
115 |
pstmt.setString(3, null); |
|
116 |
} |
|
117 |
pstmt.setString(4, docid); |
|
110 | 118 |
if (nodetype == "DOCUMENT") { |
111 | 119 |
// moved it to separate method updateRootNodeID |
112 | 120 |
//pstmt.setLong(4, nid); |
113 | 121 |
} else { |
114 | 122 |
if (nodetype == "ELEMENT") { |
115 |
pstmt.setLong(4, getRootNodeID());
|
|
116 |
pstmt.setLong(5, getParentID());
|
|
117 |
pstmt.setString(6, data);
|
|
118 |
pstmt.setInt(7, getNodeIndex());
|
|
123 |
pstmt.setLong(5, getRootNodeID());
|
|
124 |
pstmt.setLong(6, getParentID());
|
|
125 |
pstmt.setString(7, data);
|
|
126 |
pstmt.setInt(8, getNodeIndex());
|
|
119 | 127 |
} else { |
120 |
pstmt.setLong(4, getRootNodeID());
|
|
121 |
pstmt.setLong(5, getNodeID());
|
|
122 |
pstmt.setString(6, data);
|
|
123 |
pstmt.setInt(7, incChildNum());
|
|
128 |
pstmt.setLong(5, getRootNodeID());
|
|
129 |
pstmt.setLong(6, getNodeID());
|
|
130 |
pstmt.setString(7, data);
|
|
131 |
pstmt.setInt(8, incChildNum());
|
|
124 | 132 |
} |
125 | 133 |
} |
126 | 134 |
// Do the insertion |
Also available in: Unified diff
changes to store namespace prefixes separately from the local names of nodes (elements and attributes)
in xml_nodes.nodeprefix column