How to create XSD schema from XML with this kind of structure (in .net)?
Posted
by Mr. Brownstone
on Stack Overflow
See other posts from Stack Overflow
or by Mr. Brownstone
Published on 2010-03-14T19:47:40Z
Indexed on
2010/03/14
19:55 UTC
Read the original article
Hit count: 269
Here's the problem: my input is XML file that looks something like:
<BaseEntityClassInfo>
<item>
<key>BaseEntityClassInfo.SomeField</key>
<value>valueData1</value>
</item>
<item>
<key>BaseEntityClassInfo.AdditionalDataClass.SomeOtherField</key>
<value>valueData2</value>
</item>
<item>
<key>BaseEntityClassInfo.AdditionalDataClass.AnotherClassInfo.DisplayedText</key>
<value>valueData3</value>
</item>
...
...
</BaseEntityClassInfo>
The <key>
element somehow describes entity classes fields and relationships (used in some other app that I don't have access to) and the <value>
stores the actual data that I need.
My goal is to programatically generate a typed Dataset from this XML that could then be used for creating reports. I thought of building some XSD schema from input XML file first and then use this schema to generate Dataset but I'm not sure how to do that. The problem is that I don't want all data in one table, I need several tables with relationships based on the <key>
value so I guess I need to infer relational structure from XML <key>
data in some way.
So what do you think? How could this be done and what would be the best approach?
Any advice, ideas, suggestions would be appreciated!
© Stack Overflow or respective owner