1 |
14
|
jones
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
2 |
|
|
<!--NewPage-->
|
3 |
|
|
<html>
|
4 |
|
|
<head>
|
5 |
|
|
<!-- Generated by javadoc on Fri Sep 24 03:23:03 CEST 1999 -->
|
6 |
|
|
<title>
|
7 |
|
|
Class de.tudarmstadt.ito.xmldbms.DOMToDBMS
|
8 |
|
|
</title>
|
9 |
|
|
</head>
|
10 |
|
|
<body>
|
11 |
|
|
<a name="_top_"></a>
|
12 |
|
|
<pre>
|
13 |
|
|
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-de.tudarmstadt.ito.xmldbms.html">This Package</a> <a href="de.tudarmstadt.ito.xmldbms.DBMSToDOM.html#_top_">Previous</a> <a href="de.tudarmstadt.ito.xmldbms.DocumentInfo.html#_top_">Next</a> <a href="AllNames.html">Index</a></pre>
|
14 |
|
|
<hr>
|
15 |
|
|
<h1>
|
16 |
|
|
Class de.tudarmstadt.ito.xmldbms.DOMToDBMS
|
17 |
|
|
</h1>
|
18 |
|
|
<pre>
|
19 |
|
|
java.lang.Object
|
20 |
|
|
|
|
21 |
|
|
+----de.tudarmstadt.ito.xmldbms.DOMToDBMS
|
22 |
|
|
</pre>
|
23 |
|
|
<hr>
|
24 |
|
|
<dl>
|
25 |
|
|
<dt> public class <b>DOMToDBMS</b>
|
26 |
|
|
<dt> extends Object
|
27 |
|
|
</dl>
|
28 |
|
|
Transfers data from a DOM tree to the database.
|
29 |
|
|
<P>DOMToDBMS transfers data from a DOM tree to the database according
|
30 |
|
|
to a particular Map. The caller must always provide a Map object, a
|
31 |
|
|
KeyGenerator (if any keys are to be generated), and a NameQualifier
|
32 |
|
|
(if the XML document uses namespaces). It returns a DocumentInfo with
|
33 |
|
|
information about the tables and keys needed to retrieve the data.</P>
|
34 |
|
|
<P>For example, the following code transfers data from the "sales_in.xml"
|
35 |
|
|
document to the database. It does not use a KeyGenerator, but uses the
|
36 |
|
|
NameQualifier for Oracle's implementation of the DOM:</P>
|
37 |
|
|
<PRE>
|
38 |
|
|
// Use a user-defined function to create a map.
|
39 |
|
|
Map map = createMap("sales.map", conn1);<BR />
|
40 |
|
|
// Use a user-defined function to create a DOM tree over sales_in.xml
|
41 |
|
|
doc = openDocument("sales_in.xml");<BR />
|
42 |
|
|
// Create a new DOMToDBMS object and store the data.
|
43 |
|
|
domToDBMS = new DOMToDBMS(map, null, new NQ_Oracle());
|
44 |
|
|
domToDBMS.storeDocument(doc);
|
45 |
|
|
</PRE>
|
46 |
|
|
<P>The default KeyGenerator is (KeyGeneratorImpl) can be found in
|
47 |
|
|
de.tudarmstadt.ito.xmldbms.helpers. Many NameQualifiers can be found
|
48 |
|
|
in de.tudarmstadt.ito.domutils.</P>
|
49 |
|
|
<P><B>WARNING!</B> DOMToDBMS modifies the DOM tree in the process of
|
50 |
|
|
transferring data to the database.</P>
|
51 |
|
|
<p>
|
52 |
|
|
<hr>
|
53 |
|
|
<a name="index"></a>
|
54 |
|
|
<h2>
|
55 |
|
|
<img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
|
56 |
|
|
</h2>
|
57 |
|
|
<dl>
|
58 |
|
|
<dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
|
59 |
|
|
<a href="#COMMIT_AFTERDOCUMENT"><b>COMMIT_AFTERDOCUMENT</b></a>
|
60 |
|
|
<dd> Call commit after the entire document has been stored.
|
61 |
|
|
<dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
|
62 |
|
|
<a href="#COMMIT_AFTERINSERT"><b>COMMIT_AFTERINSERT</b></a>
|
63 |
|
|
<dd> Call commit after each INSERT statement is executed (default).
|
64 |
|
|
<dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
|
65 |
|
|
<a href="#COMMIT_NONE"><b>COMMIT_NONE</b></a>
|
66 |
|
|
<dd> Don't call commit.
|
67 |
|
|
</dl>
|
68 |
|
|
<h2>
|
69 |
|
|
<img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
|
70 |
|
|
</h2>
|
71 |
|
|
<dl>
|
72 |
|
|
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
|
73 |
|
|
<a href="#DOMToDBMS()"><b>DOMToDBMS</b></a>()
|
74 |
|
|
<dd> Construct a DOMToDBMS object.
|
75 |
|
|
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
|
76 |
|
|
<a href="#DOMToDBMS(de.tudarmstadt.ito.xmldbms.Map)"><b>DOMToDBMS</b></a>(Map)
|
77 |
|
|
<dd> Construct a DOMToDBMS object and set the Map object and commit mode.
|
78 |
|
|
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
|
79 |
|
|
<a href="#DOMToDBMS(de.tudarmstadt.ito.xmldbms.Map, de.tudarmstadt.ito.xmldbms.KeyGenerator, de.tudarmstadt.ito.domutils.NameQualifier)"><b>DOMToDBMS</b></a>(Map, KeyGenerator, NameQualifier)
|
80 |
|
|
<dd> Construct a DOMToDBMS object and set the Map, KeyGenerator, and
|
81 |
|
|
NameQualifier objects.
|
82 |
|
|
</dl>
|
83 |
|
|
<h2>
|
84 |
|
|
<img src="images/method-index.gif" width=207 height=38 alt="Method Index">
|
85 |
|
|
</h2>
|
86 |
|
|
<dl>
|
87 |
|
|
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
|
88 |
|
|
<a href="#getCommitMode()"><b>getCommitMode</b></a>()
|
89 |
|
|
<dd> Get the current commit mode.
|
90 |
|
|
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
|
91 |
|
|
<a href="#getKeyGenerator()"><b>getKeyGenerator</b></a>()
|
92 |
|
|
<dd> Get the current KeyGenerator.
|
93 |
|
|
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
|
94 |
|
|
<a href="#getMap()"><b>getMap</b></a>()
|
95 |
|
|
<dd> Get the current Map.
|
96 |
|
|
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
|
97 |
|
|
<a href="#getNameQualifier()"><b>getNameQualifier</b></a>()
|
98 |
|
|
<dd> Get the current NameQualifier.
|
99 |
|
|
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
|
100 |
|
|
<a href="#setCommitMode(int)"><b>setCommitMode</b></a>(int)
|
101 |
|
|
<dd> Set the current commit mode.
|
102 |
|
|
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
|
103 |
|
|
<a href="#setKeyGenerator(de.tudarmstadt.ito.xmldbms.KeyGenerator)"><b>setKeyGenerator</b></a>(KeyGenerator)
|
104 |
|
|
<dd> Set the current KeyGenerator.
|
105 |
|
|
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
|
106 |
|
|
<a href="#setMap(de.tudarmstadt.ito.xmldbms.Map)"><b>setMap</b></a>(Map)
|
107 |
|
|
<dd> Set the current Map.
|
108 |
|
|
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
|
109 |
|
|
<a href="#setNameQualifier(de.tudarmstadt.ito.domutils.NameQualifier)"><b>setNameQualifier</b></a>(NameQualifier)
|
110 |
|
|
<dd> Set the current NameQualifier.
|
111 |
|
|
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
|
112 |
|
|
<a href="#storeDocument(org.w3c.dom.Document)"><b>storeDocument</b></a>(Document)
|
113 |
|
|
<dd> Store the data from a DOM tree in the database.
|
114 |
|
|
</dl>
|
115 |
|
|
<a name="variables"></a>
|
116 |
|
|
<h2>
|
117 |
|
|
<img src="images/variables.gif" width=153 height=38 alt="Variables">
|
118 |
|
|
</h2>
|
119 |
|
|
<a name="COMMIT_AFTERINSERT"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
|
120 |
|
|
<b>COMMIT_AFTERINSERT</b>
|
121 |
|
|
<pre>
|
122 |
|
|
public static final int COMMIT_AFTERINSERT
|
123 |
|
|
</pre>
|
124 |
|
|
<dl>
|
125 |
|
|
<dd> Call commit after each INSERT statement is executed (default).<p>
|
126 |
|
|
</dl>
|
127 |
|
|
<a name="COMMIT_AFTERDOCUMENT"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
|
128 |
|
|
<b>COMMIT_AFTERDOCUMENT</b>
|
129 |
|
|
<pre>
|
130 |
|
|
public static final int COMMIT_AFTERDOCUMENT
|
131 |
|
|
</pre>
|
132 |
|
|
<dl>
|
133 |
|
|
<dd> Call commit after the entire document has been stored.<p>
|
134 |
|
|
</dl>
|
135 |
|
|
<a name="COMMIT_NONE"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
|
136 |
|
|
<b>COMMIT_NONE</b>
|
137 |
|
|
<pre>
|
138 |
|
|
public static final int COMMIT_NONE
|
139 |
|
|
</pre>
|
140 |
|
|
<dl>
|
141 |
|
|
<dd> Don't call commit. In this case, the application must call commit,
|
142 |
|
|
such as when the data is part of a larger transaction.<p>
|
143 |
|
|
</dl>
|
144 |
|
|
<a name="constructors"></a>
|
145 |
|
|
<h2>
|
146 |
|
|
<img src="images/constructors.gif" width=231 height=38 alt="Constructors">
|
147 |
|
|
</h2>
|
148 |
|
|
<a name="DOMToDBMS"></a>
|
149 |
|
|
<a name="DOMToDBMS()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
|
150 |
|
|
<b>DOMToDBMS</b>
|
151 |
|
|
<pre>
|
152 |
|
|
public DOMToDBMS()
|
153 |
|
|
</pre>
|
154 |
|
|
<dl>
|
155 |
|
|
<dd> Construct a DOMToDBMS object.
|
156 |
|
|
<p>
|
157 |
|
|
</dl>
|
158 |
|
|
<a name="DOMToDBMS(de.tudarmstadt.ito.xmldbms.Map)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
|
159 |
|
|
<b>DOMToDBMS</b>
|
160 |
|
|
<pre>
|
161 |
|
|
public DOMToDBMS(<a href="de.tudarmstadt.ito.xmldbms.Map.html#_top_">Map</a> map)
|
162 |
|
|
</pre>
|
163 |
|
|
<dl>
|
164 |
|
|
<dd> Construct a DOMToDBMS object and set the Map object and commit mode.
|
165 |
|
|
<p>
|
166 |
|
|
</dl>
|
167 |
|
|
<a name="DOMToDBMS(de.tudarmstadt.ito.xmldbms.Map, de.tudarmstadt.ito.xmldbms.KeyGenerator, de.tudarmstadt.ito.domutils.NameQualifier)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
|
168 |
|
|
<b>DOMToDBMS</b>
|
169 |
|
|
<pre>
|
170 |
|
|
public DOMToDBMS(<a href="de.tudarmstadt.ito.xmldbms.Map.html#_top_">Map</a> map,
|
171 |
|
|
<a href="de.tudarmstadt.ito.xmldbms.KeyGenerator.html#_top_">KeyGenerator</a> keyGenerator,
|
172 |
|
|
<a href="de.tudarmstadt.ito.domutils.NameQualifier.html#_top_">NameQualifier</a> qualifier)
|
173 |
|
|
</pre>
|
174 |
|
|
<dl>
|
175 |
|
|
<dd> Construct a DOMToDBMS object and set the Map, KeyGenerator, and
|
176 |
|
|
NameQualifier objects.
|
177 |
|
|
<p>
|
178 |
|
|
</dl>
|
179 |
|
|
<a name="methods"></a>
|
180 |
|
|
<h2>
|
181 |
|
|
<img src="images/methods.gif" width=151 height=38 alt="Methods">
|
182 |
|
|
</h2>
|
183 |
|
|
<a name="getCommitMode()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
|
184 |
|
|
<a name="getCommitMode"><b>getCommitMode</b></a>
|
185 |
|
|
<pre>
|
186 |
|
|
public int getCommitMode()
|
187 |
|
|
</pre>
|
188 |
|
|
<dl>
|
189 |
|
|
<dd> Get the current commit mode.
|
190 |
|
|
<p>
|
191 |
|
|
<dd><dl>
|
192 |
|
|
<dt> <b>Returns:</b>
|
193 |
|
|
<dd> The current commit mode.
|
194 |
|
|
</dl></dd>
|
195 |
|
|
</dl>
|
196 |
|
|
<a name="setCommitMode(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
|
197 |
|
|
<a name="setCommitMode"><b>setCommitMode</b></a>
|
198 |
|
|
<pre>
|
199 |
|
|
public void setCommitMode(int commitMode)
|
200 |
|
|
</pre>
|
201 |
|
|
<dl>
|
202 |
|
|
<dd> Set the current commit mode.
|
203 |
|
|
<p>
|
204 |
|
|
<dd><dl>
|
205 |
|
|
<dt> <b>Parameters:</b>
|
206 |
|
|
<dd> commitMode - COMMIT_AFTERINSERT, COMMIT_AFTERDOCUMENT, or COMMIT_NONE.
|
207 |
|
|
</dl></dd>
|
208 |
|
|
</dl>
|
209 |
|
|
<a name="getMap()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
|
210 |
|
|
<a name="getMap"><b>getMap</b></a>
|
211 |
|
|
<pre>
|
212 |
|
|
public <a href="de.tudarmstadt.ito.xmldbms.Map.html#_top_">Map</a> getMap()
|
213 |
|
|
</pre>
|
214 |
|
|
<dl>
|
215 |
|
|
<dd> Get the current Map.
|
216 |
|
|
<p>
|
217 |
|
|
<dd><dl>
|
218 |
|
|
<dt> <b>Returns:</b>
|
219 |
|
|
<dd> The current Map.
|
220 |
|
|
</dl></dd>
|
221 |
|
|
</dl>
|
222 |
|
|
<a name="setMap(de.tudarmstadt.ito.xmldbms.Map)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
|
223 |
|
|
<a name="setMap"><b>setMap</b></a>
|
224 |
|
|
<pre>
|
225 |
|
|
public void setMap(<a href="de.tudarmstadt.ito.xmldbms.Map.html#_top_">Map</a> map)
|
226 |
|
|
</pre>
|
227 |
|
|
<dl>
|
228 |
|
|
<dd> Set the current Map.
|
229 |
|
|
<p>
|
230 |
|
|
<dd><dl>
|
231 |
|
|
<dt> <b>Parameters:</b>
|
232 |
|
|
<dd> map - The Map.
|
233 |
|
|
</dl></dd>
|
234 |
|
|
</dl>
|
235 |
|
|
<a name="getKeyGenerator()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
|
236 |
|
|
<a name="getKeyGenerator"><b>getKeyGenerator</b></a>
|
237 |
|
|
<pre>
|
238 |
|
|
public <a href="de.tudarmstadt.ito.xmldbms.KeyGenerator.html#_top_">KeyGenerator</a> getKeyGenerator()
|
239 |
|
|
</pre>
|
240 |
|
|
<dl>
|
241 |
|
|
<dd> Get the current KeyGenerator.
|
242 |
|
|
<p>
|
243 |
|
|
<dd><dl>
|
244 |
|
|
<dt> <b>Returns:</b>
|
245 |
|
|
<dd> The current KeyGenerator.
|
246 |
|
|
</dl></dd>
|
247 |
|
|
</dl>
|
248 |
|
|
<a name="setKeyGenerator(de.tudarmstadt.ito.xmldbms.KeyGenerator)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
|
249 |
|
|
<a name="setKeyGenerator"><b>setKeyGenerator</b></a>
|
250 |
|
|
<pre>
|
251 |
|
|
public void setKeyGenerator(<a href="de.tudarmstadt.ito.xmldbms.KeyGenerator.html#_top_">KeyGenerator</a> keyGenerator)
|
252 |
|
|
</pre>
|
253 |
|
|
<dl>
|
254 |
|
|
<dd> Set the current KeyGenerator.
|
255 |
|
|
<p>
|
256 |
|
|
<dd><dl>
|
257 |
|
|
<dt> <b>Parameters:</b>
|
258 |
|
|
<dd> keyGenerator - The KeyGenerator.
|
259 |
|
|
</dl></dd>
|
260 |
|
|
</dl>
|
261 |
|
|
<a name="getNameQualifier()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
|
262 |
|
|
<a name="getNameQualifier"><b>getNameQualifier</b></a>
|
263 |
|
|
<pre>
|
264 |
|
|
public <a href="de.tudarmstadt.ito.domutils.NameQualifier.html#_top_">NameQualifier</a> getNameQualifier()
|
265 |
|
|
</pre>
|
266 |
|
|
<dl>
|
267 |
|
|
<dd> Get the current NameQualifier.
|
268 |
|
|
<p>
|
269 |
|
|
<dd><dl>
|
270 |
|
|
<dt> <b>Returns:</b>
|
271 |
|
|
<dd> The current NameQualifier.
|
272 |
|
|
</dl></dd>
|
273 |
|
|
</dl>
|
274 |
|
|
<a name="setNameQualifier(de.tudarmstadt.ito.domutils.NameQualifier)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
|
275 |
|
|
<a name="setNameQualifier"><b>setNameQualifier</b></a>
|
276 |
|
|
<pre>
|
277 |
|
|
public void setNameQualifier(<a href="de.tudarmstadt.ito.domutils.NameQualifier.html#_top_">NameQualifier</a> qualifier)
|
278 |
|
|
</pre>
|
279 |
|
|
<dl>
|
280 |
|
|
<dd> Set the current NameQualifier.
|
281 |
|
|
<p>
|
282 |
|
|
<dd><dl>
|
283 |
|
|
<dt> <b>Parameters:</b>
|
284 |
|
|
<dd> qualifier - The NameQualifier.
|
285 |
|
|
</dl></dd>
|
286 |
|
|
</dl>
|
287 |
|
|
<a name="storeDocument(org.w3c.dom.Document)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
|
288 |
|
|
<a name="storeDocument"><b>storeDocument</b></a>
|
289 |
|
|
<pre>
|
290 |
|
|
public <a href="de.tudarmstadt.ito.xmldbms.DocumentInfo.html#_top_">DocumentInfo</a> storeDocument(Document doc) throws SQLException, <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>, <a href="de.tudarmstadt.ito.xmldbms.KeyException.html#_top_">KeyException</a>
|
291 |
|
|
</pre>
|
292 |
|
|
<dl>
|
293 |
|
|
<dd> Store the data from a DOM tree in the database.
|
294 |
|
|
<p>
|
295 |
|
|
<dd><dl>
|
296 |
|
|
<dt> <b>Parameters:</b>
|
297 |
|
|
<dd> doc - The DOM tree.
|
298 |
|
|
<dt> <b>Returns:</b>
|
299 |
|
|
<dd> A DocumentInfo object containing information that can be used
|
300 |
|
|
to retrieve the data at a later time.
|
301 |
|
|
<dt> <b>Throws:</b> SQLException
|
302 |
|
|
<dd> Thrown if an error occurs storing data in the
|
303 |
|
|
database.
|
304 |
|
|
<dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>
|
305 |
|
|
<dd> Thrown if the Map contains invalid or
|
306 |
|
|
incomplete information.
|
307 |
|
|
<dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.xmldbms.KeyException.html#_top_">KeyException</a>
|
308 |
|
|
<dd> Thrown if an error occurs generating a key or
|
309 |
|
|
if keys are to be generated and no KeyGenerator has been specified.
|
310 |
|
|
</dl></dd>
|
311 |
|
|
</dl>
|
312 |
|
|
<hr>
|
313 |
|
|
<pre>
|
314 |
|
|
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-de.tudarmstadt.ito.xmldbms.html">This Package</a> <a href="de.tudarmstadt.ito.xmldbms.DBMSToDOM.html#_top_">Previous</a> <a href="de.tudarmstadt.ito.xmldbms.DocumentInfo.html#_top_">Next</a> <a href="AllNames.html">Index</a></pre>
|
315 |
|
|
</body>
|
316 |
|
|
</html>
|