Venkatesh,
I believe that Jon Stephens posted a response to a similar question here:
http://forums.mysql.com/read.php?44,98608,161200#msg-161200 for how to load an entire XML file into MySQL. If you use the forum's search capabilities, you may find other methods as well.
In addition, if you don't find any resources here, please consider our product which is available at XAware.org.
I didn't have time to mock up a sample database that could demonstrate your, so I'll use one of our examples to show how you would accomplish this insert.
If this is the XML I'm trying to insert into MySQL:
<employees>
<employee>
<num>9</num>
<lastname>Geller</lastname>
<firstname>Frank</firstname>
<address>1058 University Lane</address>
<city>Adamsville</city>
<state>Utah</state>
<zip>84731</zip>
<salary>7525000</salary>
</employee>
...
</employees>
... the processing document to insert it (built in XAware's Designer tool) would look like this:
<sql xmlns:xa="
http://xaware.org/xas/ns1" xa:bizcomptype="SQL" xa:bizdriver="myCompany/common/humanresources.xdr" xa:response_type="storeEmployees">
<xa:request xa:oper="insert_update" xa:table="HUMANRESOURCES.EMPLOYEES">UPDATE
HUMANRESOURCES.EMPLOYEES
SET
HUMANRESOURCES.EMPLOYEES.SALARY = ?,
HUMANRESOURCES.EMPLOYEES.ENDHIRE = ?,
HUMANRESOURCES.EMPLOYEES.STARTHIRE = ?,
HUMANRESOURCES.EMPLOYEES.ZIP = ?,
HUMANRESOURCES.EMPLOYEES.DIVID = ?,
HUMANRESOURCES.EMPLOYEES.REGION = ?,
HUMANRESOURCES.EMPLOYEES.CITY = ?,
HUMANRESOURCES.EMPLOYEES.STREET = ?,
HUMANRESOURCES.EMPLOYEES.FIRSTNAME = ?,
HUMANRESOURCES.EMPLOYEES.LASTNAME = ?,
HUMANRESOURCES.EMPLOYEES.EMPNUM = ?</xa:request>
<xa:column_map>
<SALARY xa:sql_type="3" xa:sql_type_name="DECIMAL" xa:column_class="java.math.BigDecimal">%//employee/salary%</SALARY>
<ZIP xa:sql_type="4" xa:sql_type_name="INTEGER" xa:column_class="java.lang.Integer">%//employee/zip%</ZIP>
<REGION xa:sql_type="12" xa:sql_type_name="VARCHAR" xa:column_class="java.lang.String">%//employee/state%</REGION>
<CITY xa:sql_type="12" xa:sql_type_name="VARCHAR" xa:column_class="java.lang.String">%//employee/city%</CITY>
<STREET xa:sql_type="12" xa:sql_type_name="VARCHAR" xa:column_class="java.lang.String">%//employee/address%</STREET>
<FIRSTNAME xa:sql_type="12" xa:sql_type_name="VARCHAR" xa:column_class="java.lang.String">%//employee/firstname%</FIRSTNAME>
<LASTNAME xa:sql_type="12" xa:sql_type_name="VARCHAR" xa:column_class="java.lang.String">%//employee/lastname%</LASTNAME>
<EMPNUM xa:sql_type="4" xa:sql_type_name="INTEGER" xa:column_class="java.lang.Integer">%//employee/num%</EMPNUM>
</xa:column_map>
Note: I've trimmed off the beginning and end of the document to focus on the necessary part, so you get the idea.
Please see the xaware.org for questions about XAware and good luck with your project!
Virginia
XAware.org