Do you know best practicies ?
A:
In my thesis (Java 1.4) I resolved this problem in this way:
- DOM parsing (but SAX way is better) for reading the XML file and insert the values in a Collection of Object (1 Collection for 1 type of node);
- cycle of this array: in the cycle , at the k step, I build a StringBuffer of the SQL insert adding the k-Object (as a String: using the toString() implemented correctly) in the k-place;
- execute insert of this StringBuffer with another or the same cycle;
This system is a draft: really you can optimize decreasing the number of step, etc.
The XML schema is useless at run-time with this system, but you cuold use it for project the database.
Is'nt a very optimized and elegant system, but it works :)
alepuzio
2009-02-26 16:20:49