views:

145

answers:

1

Do you know best practicies ?

A: 

In my thesis (Java 1.4) I resolved this problem in this way:

  1. 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);
  2. 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;
  3. 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