Question Work with XSD

Simeon

Member
Joined
Sep 14, 2009
Messages
13
Programming Experience
Beginner
I have to output data from a SQL Server database. I've been given an XSD.
using VB 2005.
Have not worked with supplied XSD before, so I'm a bit unsure about what to do next.


1) I've added the XSD to a VB project. The dataset seems to have several datatables, broken down like
Policy
____Premium
____Proposer
_________Name
_________Address
____RiskDetails
_________Business
_____________Trade
_____________Employees
_____________Wage Details
_________Clauses

So Business is a sub datatable of RiskDetails, and Trade is a sub of Business.
Going to the data sources window, I can see the breakdown as above. However, clicking the design box opens up some sort of schema design window. There are no options to add a table adapter.
What would be the best way to add the data?

2) Validation
The XSD also has extra information about the data, such as that below. Which I think means that the Category Code must be one of the values in the list. How should I use this information?
Is doesn't seem to come into the dataset.
Let says I add all my info to the dataset, and then output the XML. Is there a way to validate that the XML I've produced conforms to the XSD format I've been given?


<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="3" />
<!-- Category code for Clerical Staff -->
<xsd:enumeration value="119" />
<!-- Category code for Manual Principals -->
<xsd:enumeration value="111" />
<!-- Category code for Manual Employees -->
<xsd:enumeration value="006" />
<!-- Category code for Machinists (woodworking cover) -->
<xsd:enumeration value="125" />
</xsd:restriction>
</xsd:simpleType>


Thanks
Simeon
 
Found out how to get the different design.
If you right click on a XSD, you can select Open With.
The option I have above is 'XML Schema Editor'.
MS won't let me open it with the Dataset Designer, as this XSD was not a dataset one.
Note that you can open your standard dataset with the XML Schema Editor to get a different view.
 
Found out how to get the different design.
If you right click on a XSD, you can select Open With.
The option I have above is 'XML Schema Editor'.
MS won't let me open it with the Dataset Designer, as this XSD was not a dataset one.
Note that you can open your standard dataset with the XML Schema Editor to get a different view.
Didn't know that, it's good to see you've stuck with it to figure it out as I haven't had the time.
 
In the Xml Schema Editor, you can make the changes to force the attribute but again Im kind of surprised the option isnt in the designer. Also kinda worried since old .Net 2003 when you made changes in this area (previously for nesting/releationships), they would be lost/overwritten when ever you rebuilt the dataset.
 
Well you can create the adapter thru coding or have it and lose the ability to output to xml using writexml and instead use the xmldocument class. I think coding the adapter would be easier.
 
Adding by row is as easy in this case. I'm looping through the source data, and just adding by row.
There is no time pressure, as its a once a month operation, so I think I'll leave it in that format.
Well, now I know a lot more about XSD. Thanks everyone for their help.
 
Back
Top