开发者

Uploading XML data to a Dataset

I am creating a generic XML to SQL Server data driver (In c#), that will take as input an XML file, and produce one or more data tables containing information.

So far I have an input XML file and an XSLT, the XSLT c开发者_如何学编程reates a new XML containing only the information needed from the xml.

My Problem lies in not knowing how to define a mapping from the XML elements to the columns in certain tables.

For example, say I have this extract of XML:

<Bug name = "MillenniumBug">
   <Severity value = "1" />
</Bug>

I would like to create two tables, a bugs table and a severity table, and I need the Bug name in the Bug table, and the severity value in the severity table.

A point in the right direction as to how I can specify this mapping would be really appreciated.

Thanks


You have already lined up your ruleset when you set up elements as tables and attributes as columnns in the table. Setting up the mapping, and even "table creation logic" is fairly easy using those rules. The harder part with your "driver" is going to be determination of types (is this number a byte, an int or a long?) and possibly creating an inferred schema to validate the input. Determining nullability of columns will also be an issue you have to examine.

Without better understanding the business driver for this project, I can't give you much more than that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜