Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Here is my problem,

 

my client has several customers who send him xml files. I need to dump all those xml files data into an existing table (insert and update depending on key)

 

The problem the all xml do not have the same structure, i.e there are a few common that every xml has , but they are others that the customer may or may not fill depending on his choice.

 

For Example

 

Customer 1 XML might have the following

<root>
<product>
<PrimaryField1>111</PrimaryField1>
<MandatoryField2>aaa<MandatoryField2>
<MandatoryField3>bbb</MandatoryField3>
<ExtraField1>extrainfo</ExtraField1>
<ExtraField3>extrainfo</ExtraField3>
</product>
<product>
<PrimaryField1>222</PrimaryField1>
<MandatoryField2>aaa<MandatoryField2>
<MandatoryField3>bbb</MandatoryField3>
<ExtraField1>extrainfo</ExtraField1>
<ExtraField3>extrainfo</ExtraField3>
</product>
</root>

 

Customer 2 XML might have the following

<root>
<product>
<PrimaryField1>555</PrimaryField1>
<MandatoryField2>aaa<MandatoryField2>
<MandatoryField3>bbb</MandatoryField3>
<ExtraField1>extrainfo</ExtraField1>
<ExtraField3>extrainfo</ExtraField3>
</product>
<product>
<PrimaryField1>666</PrimaryField1>
<MandatoryField2>aaa<MandatoryField2>
<MandatoryField3>bbb</MandatoryField3>
<ExtraField2>sf</ExtraField2>
<ExtraField4>extrainfo</ExtraField4>
</product>
</root>

 

The table has all the fields the primary fields,mandatory fields and all the other fields for which customer(s) may or may not give data.

 

What is the best possible to do this.

 

I tried generating an insert statement depending on the xml structure but that made the system slow, it was almost impossible to work with large xml files. some of the xml files have more than million records.

 

I use dotnet 2.0, in case you want to know.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...