Programatically reading a XSD File

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>
*****************************





0
1/10/2006 8:40:05 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
693 Views

Similar Articles

[PageSpeed] 41

https://blogs.msdn.com/stan_kitsis/archive/2005/08/06/448572.aspx

-- 
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights. 
Use of included script samples are subject to the terms specified at 
http://www.microsoft.com/info/cpyright.htm

"Ganesh Muthuvelu" <GaneshMuthuvelu@discussions.microsoft.com> wrote in 
message news:EBA7E773-CA90-4D44-B34F-1AA83E6789A8@microsoft.com...
> 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>
> *****************************
>
>
>
>
> 


0
skits (68)
1/10/2006 10:08:55 PM
Reply:

Similar Artilces:

Roll up detail to summary in separate files
I have 2 worksheets - I am looking to do a lookup by date and populate a subtotal. the 1st has transaction level details by day. i.e. 12/1 $1 12/1 $2 12/1 $3 12/2 $4 12/3 $5 12/3 $6 the 2nd has totals by day. 12/1 $6 12/2 $4 12/3 $11 I am looking to place a formula in the 2nd sheet to eliminate having to key the daily total in. Any suggestions what formula to use? Thanks! on second sheet: list each day in column A; in column B: =SUMIF(Sheet1!E1:E5,A1,Sheet1!F1:F5) where e1:e5 and f1:f5 represent your daily data on sheet1. copy down beside ...

Reading keyboard's key names (Internalization)
Hi all! I'm trying to make my little app "international-aware" and I'm using the GetKeyNameText() function to retrieve the name of a key. The function works good in getting the key names based on the current keyboard layout. The reason I'm doing this is because users of my app will be able to access the settings to customize the program's hotkeys, so I would like to display these in the user's language. For example, the following key name retrieval work: GetKeyText(vbKeyControl ) -> "Ctrl" GetKeyText(vbKeyShift ) -> "...

List of File Extensions
Is there a list somewhere that contains the file extensions used in Office 2003 applications? I need to backup files before re-installing my OS. These include files that store settings, customizations, macros, Outlook address books, etc. ...

Outlook and read-only Global Catalog
Hi all, our customer wishes an explanation on the following Outlook problem that not browse any error when it try to update active directory on a read-only GC. For reproduce the problem: Force some outlook clients to use a GC that is not a DC of the domain the user is a member of. In this case the write to the directory can not take place. However if we define a delegate this is written in Outlook but not in Active Directory,so it doesn't work. Questions: Why Outlook doesn't dipslay any error when we define the delegate? Where Outlook write this delegate when the DC used is read-o...

deleting all html from excel files
Is there a way to delete all HTML coding from Excel files (ex. br, table, font commands) while keeping the text in between the commands? I have over 3000 rows, each of which has some HTML coding that I must get rid of. Have you tried being creative with find/replace (using nothing in the replace with)? If we could see the syntax of your data, we could probably help easier. <-*-><-*-><-*-><-*-><-*-><-*-><-*-><-*-> Anne Troy Author: Dreamboat on Word Email: Dreamboat*at*Piersontech.com Web: www.TheOfficeExperts.com Unfortunately, I do not kn...

Programatically do a recall
Does anyone know how to programitcally via the api/SQL to recall a transcation or specifically a quote. We have a custom button that calls a dot net program to provide the lsit of quotes but the information does not completely get re-populated into the transaction screen. We are specifically not able to get line item comments back in. Any help greatly appreciated. On Wed, 18 Apr 2007 11:26:02 -0700, Scarpa <Scarpa@discussions.microsoft.com> wrote: >Does anyone know how to programitcally via the api/SQL to recall a >transcation or specifically a quote. We have a custom bu...

Help needed with Money 2003 files
Hi there, I've been using money 2003 for years even when upgrading to new PC's as I had the original disk. I've just had to rebuild my hard drive and now cannot find the disk anywhere so cannot install Money. As you cannot now buy Money, I've tried downloading the trial version of Money so that I can access all the account details/balances but it says that they're not compatible with earlier versions of money. Is there anything that I can do to get these files open or have I lost all my records for the last 6 years? I'd really appreciate your assistance. Jayne EggHead...

How do I reduce the size of my excel files?
My spreadsheet file size has grown to @ 4-5 Meg. When I delete data from the sheet it remains large in size. Find where your sheet ends (Ctrl-End) Delete all extraneous Rows & Columns Save the Workbook If XL 2003 -> Close the workbook. -- Regards; Rob ------------------------------------------------------------------------ "Swimming Wombat" <Swimming Wombat@discussions.microsoft.com> wrote in message news:C2EBBABD-C7AE-4101-B3E0-40AFA9D2A5FA@microsoft.com... > My spreadsheet file size has grown to @ 4-5 Meg. When I delete data from the > sheet it remains large ...

Print a HTML document programatically
Hi, I need to print a html docment dynamically produced at runtime, at that instance. I'm using shellexecute for this, which is popping up the Windows default PrintDialog. I want it to be printed directly. Can anyone suggest a solution or give some sample code for this. Please do reply. Thanks in Advance. Regards, Ajay Kumar Have you looked at IWebBrowser2::ExecWB? This also might be helpful: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html /wb_print.asp -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "Ajay Kumar" &...

File shared on network, can it be opened READ ONLY from all but one computer?
I would like to have only one, maybe two computers on the network, have the ability to open the Excel file with read and write capability. I want all other computers on the network to have the ability to open the file in a READ ONLY status. I do NOT want the user to have the option of read only. Because I don't know if this can be done, I have made a "linked" file, which is read only, for users on the network. This works OK, but my file has forumlas with don't work on the linked file, without converting the links to values. I want the networked users to be able to manipu...

Help files for installing SP3
Since there have been lots of things learned about installing SP3, can someone *point me to* (1) the best information for getting ready for the install. (2) information to follow when things don't go right. Not sure if I have the correct Microsoft instructions (getting ready to install) (what not to do) (how to get out of a jam) etc. I could be described as a power user of software apps, but I'm not familiar with hardware-drivers, etc. I may have to do my own install. 5tulips "5tulips" <5tulips@discussions.microsoft.com> wrote in message new...

xsd enumeration
Hi, I parse an XML file with a XSD schema. One XmlNode has an attribute whose type is a restriction of xs:string : <xs:simpleType name="stypeDay"> <xs:restriction base="xs:string"> <xs:enumeration value="Mon"/> <xs:enumeration value="Tue"/> <xs:enumeration value="Wed"/> <xs:enumeration value="Thur"/> <xs:enumeration value="Fri"/> <xs:enumeration value="Sat"/> <xs:enumeration value="Sun"/> </xs:restriction> </xs:simpleType>...

Word cannot complete the save due to a file permission error
Hi there, One of my corporate users is experiencing an odd issue producing an error message when attempting to save a Word 2007 document. 1. User has the pre-existing (not new) document open and clicks the save button. 2. In what seems to be a random occurrence, the document will bring up a "Save As" dialog box asking him where to save, as if Word forgot where the document is already saved! Odd thing is, it shows the proper location where the file already exists. 3. User will choose the same location and replace the file. Sometimes it will overwrite and save prope...

QSCimport file
Does anyone have this file they would be willing to give me? I have searched the CustomerSource site and the net and can't find the install for it. Thanks It is available on JeanHolland.com in the RMS downloads section. It was too large to attach here. Marc "WIS Pubs" <WISPubs@discussions.microsoft.com> wrote in message news:895547B3-6CD7-4AF3-B1BE-6944C894D19C@microsoft.com... > Does anyone have this file they would be willing to give me? I have > searched > the CustomerSource site and the net and can't find the install for it. > Thanks ...

Read receipts
I need to do two things 1. Disable the ability of some users to request read reciepts on a user by user basis. 2. Over ride user/client settings that deny read reciepts when the message comes from certain users. For example mail from an administrator or owner would always get a read receipt if they had requested it, even if the client was set to deny all receipts. We are using Exchange 2000 and will be upgrading to 2003 in the next few months. Thanks in advance On Wed, 7 Dec 2005 15:56:02 -0800, "Mark" <Mark@discussions.microsoft.com> wrote: >I need to do two th...

Linking .JPG files using VBA
I have a Table that includes the field "FileLocation" which contains the full file name of various JPG files. I wish to preview those files on an Access Form but I do not wish to manually insert the protographs one-by-one: rather I wish the photo to be displayed or, create an additional OLE Object field in the Table and, using VBA, populate that field with the required linkages. What version of Access is this? In Access 2007, you can bind an image control to a field. Dead simple. Even works even on continuous view forms. In older versions, use the Current event of the form t...

Read-Only Compatibility Mode
I wrote an application in Excel 2003 for a client with a four computer network. The application is on a shared network drive, and it seems to work correctly (Read/Write) for two of the machines. However, with no other users accessing the application, the other two machines present Read-Only versions of the application. One of these machines uses Windows 2000 and Excel 2003 and displays [Read-Only] behind the file name. The other machine uses Vista and Excel 2007 and displays [Read-Only] [Compatibility Mode]. Both of the machines that work correctly use Windows XP Professiona...

prompt to file mail
is there a way to get outlook to prompt a user to file a sent message? also prior to upgrading to exchange 2010, I was using public folders as a collabrative mail store for various projects, so we had a folder called live jobs, and then a number of sub folders listed by the job number so for example jh242, jh243, jh244 and so on. I am told that exchnage 2010 does not like this, but how do I enbale my project teams to have a shared mail folder where they can all file the e-mail for each job they are working on? I appreciate this may be more of an exchange question, so sorry...

Opening Pub 2000 files after upgrading to 2003
i have just upgraded to Office 2003. When I try to open a pub file created in Publisher 2000 , the program crashes. When I start to open and select the file I want from the list, it does not show in the file name box in the Open Publication window. Is this question answered somewhere on this site? Thanks. When you go to File, Open see if there is a drop down list for the different versions of Publisher. This is a guess on my part; I'm a Pub 2000 user. -- Don Vancouver, USA "Jim" <Jim@discussions.microsoft.com> wrote in message news:80AAD03E-8F3B-469F-A3A7-F7C71F9...

Is it possible to programatically set a tree item as hit?
Hi, In my CTreeCtrl derived class, I have a OnRClick() handler to handle mouse clicking event. Inside it, I use HitTest() to determine which tree item is hit. But now I have a special need to programmatically simulate an event r-clicking a given tree item (HTREEITEM). Is it possible to programmatically set the given tree item as hit and then call OnRClick()? Thanks for any advice. Tony I haven't tried this out, so it may not work. But you could try sending a TVN_SELCHANGED notification with the itemNew member of the NM_TREEVIEW structure set to a TVITEM representing the HTREE...

synchronizing desktop/laptop PST file
What's the easiest way to have my laptop Outlook profile to look exactly as my desktop in terms of same folders? On the laptop, there are folders and messages that I do not want there anymore, and I don't want to have go in and manually remove them all as I did on the desktop. So, just want to have an exact copy of the desktop now to reside on the laptop. What is the best way to accomplish? See if the information on the following page helps: http://www.slipstick.com/outlook/sync.htm -- Jocelyn Fiorello MVP - Outlook *** Replies sent to my e-mail address will probably not be ...

Reading Excel Checkboxes in Access
Hi All I created a spreadsheet with checkboxes (controls) on it for reporting purposes. I now need to import the data contained on the spreadsheets into Access. The data is not laid out in neat columns or rows, it was formated to be a stand alone report originally. My problem is not in reading cells within the spreadsheet, I'm able to do that. My issue is that I can't tell if a checkbox is checked or not. What I've done: If I execute the following code in Excel I return a boolean partAM = CheckBox15.Value I return true or false Here is my access code: Set xlapp = New Excel....

Paste Data to Sheet programatically
I want to be able to "Copy and Paste" one Sheet to another using th Excel Com component for version 2000. At the moment I have written something like the code below, but th THEN-part doesn't work. Here is an example: // source_worksheet is a WorkSheet from another WorkBook that ma contain data. IF WorkSheetFound (workbook=myWorkBook, string sheetName=strSheetName) THEN { dest_worksheet = getWorkSheet (myWorkBook, trSheetName); //dest_worksheet is an existing WorkSheet in currentWorkBook //Paste Source to Destination - worksheet source_worksheet.Paste (Destination = dest_work...

How do you 'file' an email you have finished with?
Just starting to use MSCRM. We are not using Exchange. In Outlook we mark emails for tracking in CRM, which then get put in the 'MyWork|Assigned' folder, from there we accept them and they get put into the 'INProgress' folder. Once the email has been actioned how do we remove them from the assigned/Inprogress but retain the history against the Account? In the paper world I would equate this with filing the paperwork and removing it from my desk. TIA Antony You can delete the e-mail (or indeed any activity) from a queue without it being deleted from the account's history....

Virus and PST file
The PST file for my Outlook2K got inflected by the virus "JS.Fortnight.C" and Norton quarantine this file. What should I do? I did try repair it by running scanpst.exe on the pst file and import the file back into Outlook but there is no message inside the 600MB pst file. ...