|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello...
I have 2 xml files, say dsg.xml and my.xml as follows... dsg.xml --------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE dsg SYSTEM "dsg.dtd"> <DBCSSCHEMA> <TABLE name="t_fbpe_part_earn" shortname="fbpe"> <FIELDLIST> <FIELD name="clnt_id_n" type="int" /> <FIELD name="ssn_n" type="char" default1="' '" /> <FIELD name="earn_rcvd_ts" type="datetime" default1="' '"/> <FIELD name="earn_type_c" type="char" default1="' '"/> <FIELD name="pay_prd_end_d" type="datetime" default1="' '"/> <FIELD name="earn_q" type="float" default1="' '"/> <FIELD name="data_src_type_c" type="char" default1="' '"/> <FIELD name="rec_upd_type_c" type="char" default1="' '"/> <FIELD name="rec_upd_ts" type="datetime" default1="getdate()" /> <FIELD name="rec_upd_user_nm" type="char" default1="XYZ" /> </FIELDLIST> </TABLE> <TABLE name="t_fpaa_activity" shortname="fpaa"> <FIELDLIST> <FIELD name="clnt_id_n" type="int" /> <FIELD name="ssn_n" type="char" default1="' '" /> <FIELD name="earn_rcvd_ts" type="datetime" default1="' '"/> <FIELD name="earn_type_c" type="char" default1="' '"/> <FIELD name="benf_c" type="char" default1="' '"/> <FIELD name="pay_prd_end_d" type="datetime" default1="' '"/> <FIELD name="rec_upd_ts" type="datetime" default1="getdate()" /> </FIELDLIST> </TABLE>..... and my.xml ---------- <?xml version="1.0" ?> <!DOCTYPE workbook SYSTEM "workbook.dtd"> <workbook> <sheet> <name value="tbcc"/> <row number="0"> <col number="0" field="Create new calculation using Calc Creator tool"></col> <col number="1" field="See modCalcCreator in Calc Creator for instructions on data for fields."></col> </row> <row number="1"> <col number="0" field="t_tbcc_benf_calc_creator"></col> <col number="1" field="clnt_id_n"></col> <col number="2" field="db_plan_n"></col> <col number="3" field="ssn_n"></col> <col number="4" field="benf_c"></col> <col number="5" field="plan_feat_c"></col> <col number="6" field="bcd_d"></col> <col number="7" field="benf_pmt_a"></col> <col number="8" field="benf_calc_c"></col> <col number="9" field="srvr_ben_pmt_a"></col> <col number="10" field="pmt_stop_d"></col> <col number="11" field="pmt_stop_rsn_c"></col> <col number="12" field="svc_qty_q"></col> <col number="13" field="ben_elig_d"></col> <col number="14" field="nxt_pmt_adj_a"></col> <col number="15" field="nxt_pmt_adj_d"></col> <col number="16" field="srvr_pmt_adj_a"></col> <col number="17" field="acru_benf_a"></col> </row> <row number="2"> <col number="0" field="(Link to Calc Creator)"></col> <col number="1" field="15180"></col> <col number="2" field="001"></col> <col number="3" field="236-64-6709"></col> <col number="4" field="1001"></col> <col number="5" field="1"></col> <col number="6" field="8/7/91"></col> <col number="7" field="1032.59"></col> <col number="8" field="2"></col> <col number="10" field="21/9/99"></col> </row> <row number="3"> <col number="0" field="xyz"></col> <col number="1" field="15180"></col> <col number="2" field="001"></col> <col number="3" field="236-64-6666"></col> <col number="4" field="1001"></col> <col number="5" field="1"></col> <col number="6" field="8/7/91"></col> <col number="7" field="1032.59"></col> <col number="8" field="2"></col> <col number="10" field="21/9/99"></col> </row> </sheet> <sheet> <name value="Sheet2"/> </sheet> <sheet> <name value="Sheet3"/> </sheet> </workbook> Now I want to compare these 2 files... if for example the table 't_fpaa_activity''s fields 'clnt_id_n' and 'ssn_n' are matching with my.xml... Now what I need is their's corresponding values... 15180,236-64-6709 15180,236-64-6666 (2 separate records) in my output... Can anyone help me in this regard Thanks in advance |
|
#2
|
|||
|
|||
|
Hi,
There is a visual tool for comparison XML documents. ExamXML at URL |
|
#3
|
|||
|
|||
|
Hello..
Thanks for replying. But I need to use java for this. I used 2 separate classes to read each of these xml's and stored in a hash table, with table name as key and vector of fields as value for 'dsg.xml'. And for 'my.xml'.....row as key and vector of col as value. And traversed the second vector for each element of the first vector and stored the matching position in a variable. And again traversed the second vector and tried to get the element at the position stored in a variable. Now my problem is printing them as single record.....ie., I need somewhat like this... INSERT into table1 VALUES(...record of first row which matches with the second xml) INSERT into table2 VALUES(...record of second row which matches with the first xml) Thanx |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Compare 2 xml files and get the matched node's values |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|