XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 4th, 2003, 07:39 AM
geetha.K.R. geetha.K.R. is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 3 geetha.K.R. User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post Compare 2 xml files and get the matched node's values

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

Reply With Quote
  #2  
Old August 19th, 2003, 02:51 AM
YuriKernogo YuriKernogo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 2 YuriKernogo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi,
There is a visual tool for comparison XML documents.
ExamXML at URL

Reply With Quote
  #3  
Old August 19th, 2003, 04:07 AM
geetha.K.R. geetha.K.R. is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 3 geetha.K.R. User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Compare 2 xml files and get the matched node's values


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway