Arif YILMAZ
Arif YILMAZ

Reputation: 5866

How to convert unfamiliar xml into datatable

I have an xml coming from a webservice which I am not familiar with. Here is the xml sample that comes from the webservice.

<?xml version='1.0' standalone='yes'?>

<dtCariHesapBakiyeListesi diffgr:id='dtCariHesapBakiyeListesi0' msdata:rowOrder='0'><LOGICALREF>2267</LOGICALREF><CARI_HESAP_KODU>2100892</CARI_HESAP_KODU></dtCariHesapBakiyeListesi>

<dtCariHesapBakiyeListesi diffgr:id='dtCariHesapBakiyeListesi1' msdata:rowOrder='1'><LOGICALREF>2268</LOGICALREF><CARI_HESAP_KODU>2100283</CARI_HESAP_KODU></dtCariHesapBakiyeListesi>

<dtCariHesapBakiyeListesi diffgr:id='dtCariHesapBakiyeListesi2' msdata:rowOrder='2'><LOGICALREF>2269</LOGICALREF><CARI_HESAP_KODU>2100831</CARI_HESAP_KODU></dtCariHesapBakiyeListesi>

There is no root in the xml. it returns 3 company information. but I am not sure how to iterate this. Would you please help me?

Upvotes: 0

Views: 47

Answers (1)

Nitesh Kumar SHARMA
Nitesh Kumar SHARMA

Reputation: 98

If you can use SSIS it will be really easy . you just have add an xml source and generate a xsd file for that and connect to your database. And then you can update it. But for this you should have BIDS and then you just add a sql serve integration services project. 1. add data flow task (drag and drop from the toolbox) 2. go to data flow task by double clicking on it and add xml source. 3. use a variable and use the source as varible in xml source. 4. generate xsd file for that. 5. add oledb destination and connect to your database.

It will be really quick and easy if you are a bit aware about SSIS

Let me know if you need any help

Upvotes: 1

Related Questions