Programatically reading a XSD File

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello,
Let us say I have a schema file like this sample below. How would I using
..NET classes be able to read this XSD file and get all the values for each
element, such
as "name", "type", "minoccurs" etc.,?

I would appreciate if somebody can help me with some sample code.

Thanks for your help.
Ganesh

*********************
<?xml version="1.0" standalone="yes"?>
<xs:schema id="Account_Did" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Account_Did" msdata:IsDataSet="true";>
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="account">
<xs:complexType>
<xs:sequence>
<xs:element name="ACCOUNT_NO" type="xs:int" minOccurs="0" />
<xs:element name="NAME" type="xs:string" minOccurs="0" />
<xs:element name="COMPANY" type="xs:string" minOccurs="0" />
<xs:element name="ADDRESS1" type="xs:string" minOccurs="0" />
<xs:element name="ADDRESS2" type="xs:string" minOccurs="0" />
<xs:element name="CITY" type="xs:string" minOccurs="0" />
<xs:element name="REGION" type="xs:string" minOccurs="0" />
<xs:element name="POSTCODE" type="xs:string" minOccurs="0" />
<xs:element name="COUNTRY" type="xs:string" minOccurs="0" />
<xs:element name="CONTACTPHONE" type="xs:string" minOccurs="0"
/>
<xs:element name="CONTACTFAX" type="xs:string" minOccurs="0" />
<xs:element name="provider_id" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Table1">
<xs:complexType>
<xs:sequence>
<xs:element name="did_id" type="xs:int" minOccurs="0" />
<xs:element name="instrument_id" type="xs:string"
minOccurs="0" />
<xs:element name="ACCOUNT_NO" type="xs:int" minOccurs="0" />
<xs:element name="Instrument_Type" type="xs:int" minOccurs="0"
/>
<xs:element name="Taxable_location" type="xs:string"
minOccurs="0" />
<xs:element name="TIMEZONE" type="xs:int" minOccurs="0" />
<xs:element name="START_DT" type="xs:dateTime" minOccurs="0" />
<xs:element name="END_DT" type="xs:dateTime" minOccurs="0" />
<xs:element name="NOTES" type="xs:string" minOccurs="0" />
<xs:element name="LTAP" type="xs:boolean" minOccurs="0" />
<xs:element name="status_type_id" type="xs:int" minOccurs="0" />
<xs:element name="sub_account_no" type="xs:int" minOccurs="0" />
<xs:element name="tag" type="xs:string" minOccurs="0" />
<xs:element name="quantity" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1">
<xs:selector xpath=".//account" />
<xs:field xpath="ACCOUNT_NO" />
</xs:unique>
<xs:keyref name="r1" refer="Constraint1">
<xs:selector xpath=".//Table1" />
<xs:field xpath="ACCOUNT_NO" />
</xs:keyref>
</xs:element>
</xs:schema>
*****************************





.



Relevant Pages

  • Converting a XSD to a *.DF
    ... Is there a way to convert a XSD file into a data definitions file? ... I'd like to load an entire schema file into a database (without doing ...
    (comp.databases.progress)
  • Use of GetNodeTypedValue() method to get a value of specific datat
    ... I have an XML file and an XSD file for validating it. ... getNodeTypeValue() to get an integer from an element(the restriction being ... specified in the Schema file) i get it only as VT_BSTR type. ... the dt:dt attribute for the element do i get the correct datatype. ...
    (microsoft.public.vc.atl)
  • howto extract type pattern from xsd shema file / or DOM Document object from JAVA
    ... Do i have to parse the xsd file using ... SAX or JDOM, and get the pattern form Document? ... here is the code of schema file ...
    (comp.lang.java.programmer)
  • Re: schema.ini question
    ... that builds the schema file, ... I normally use a create table query to export ... Prev by Date: ...
    (microsoft.public.access.externaldata)
  • Re: Generate Proxy or Server Side stub Problem
    ... my .wsdl is import the schema file also. ... this guy suggest copy all the wsdl and schema ... > David Mediavilla ... Prev by Date: ...
    (microsoft.public.dotnet.framework.webservices)