I have created an xsd file named reason.xsd what I would like to do is is determine the fields within the file programatically. Could someone please show me how I would open up the file and traverse through each element in the file obtaining the field name
and its type? Thanks in advance The schema is below Reason.xsd
ReasonID integer image string Description string
You don't have to do all that manually. Check out the System.Xml.Schema namespace. It lets you access the information in a schema file via a nice object model. The Framework SDK documentation has a whole section dedicated to the classes in that namespace [0]
( this link is local, but it also available online in the MSDN library ). You'll also find some samples on the Xml Schema Object Model on gotdotnet [1] [0] ms-help://MS.NETFrameworkSDKv1.1/cpguidenf/html/cpconxsdschemaobjectmodelsom.htm [1] http://samples.gotdotnet.com/quickstart/howto/doc/Xml/XmlSchemaObjectModel.aspx
HTH
Christoph Schittko
Architect, Microsoft
http://weblogs.asp.net/cschittko
here is what worked for me. If you have other alternatives please post would like to to look at them. Thanks again Dim myDS As DataSet = New DataSet myDS.ReadXmlSchema("reason.xsd") Dim s As String Dim i As Integer For i = 0 To myDS.Tables(0).Columns.Count
- 1 s = myDS.Tables(0).Columns(i).ToString Next
TinyPond
Member
739 Points
228 Posts
XSD File obatining schema information programatically
Sep 29, 2003 07:24 PM|LINK
ReasonID integer image string Description string
ChristophDot...
Member
85 Points
17 Posts
Re: XSD File obatining schema information programatically
Sep 30, 2003 05:30 PM|LINK
Architect, Microsoft
http://weblogs.asp.net/cschittko
TinyPond
Member
739 Points
228 Posts
Re: XSD File obatining schema information programatically
Oct 01, 2003 01:43 PM|LINK