• Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating a Dynamic mapping between XML tags and DB fields  RSS feed

 
amit bose
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a XML file e.g.
<Root>
<CarModel>
<ModelNumber>MXT987</ModelNumber>
<SellCode>HJ-ER-M5</SellCode>
</CarModel>
<Buyers>
<Buyer>
<Name>Smith</Name>
<ReceiptNo>RC123</ReceiptNo>
</Buyer>
<Buyer>
<Name>Marshall</Name>
<ReceiptNo>RC888</ReceiptNo>
</Buyer>
<Buyer>
<Name>John</Name>
<ReceiptNo>RC111</ReceiptNo>
</Buyer>
<Buyer>
...
</Buyer>
</Buyers>
</Root>

I have the following tables:


[TABLE1 ] :CAR
[COLUMN1] :Model_Number
[COLUMN2] :Sell_Code

[TABLE2 ] :CUSTOMER
[COLUMN1] :Model_Number
[COLUMN2] :Name
[COLUMN3] :Receipt_No

Is it posible to have a dynamic mapping between the XML data and the Database columns?
Say if there is a new XML like:

<Header>
<Item>
<ChasisNo>POU986</ChasisNo>
<TxnCode>KL-78-RT</TxnCode>
</Item>
<Merchants>
<Merchant>
<Title>Alpha</Title>
<BillNo>ML987</Title>
</Merchant>
<Merchant>
<Title>Beta</Title>
<BillNo>ML787</Title>
</Merchant>
<Merchant>
...
</Merchant>
</Merchants>
</Header>

Then the fields must be mapped to DB colums like:

ChasisNo:Model_Number(i.e. ChasisNo in XML tag must be mapped to DB column Model_Number)
TxnCode:Sell_Code
Title:Name
BillNo:Receipt_No

Regards,
Amit
[ February 15, 2007: Message edited by: amit bose ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!