Restricting data

Hi 

I am trying to put value restrictions on certain elements in an xml file 
using a schema file.
The syntax in my schema file looks like the following 


  <xs:element name="AXYZMachines" msdata:IsDataSet="true" 
msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="MotionParameters">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="FeedRateMAX" type="xs:double">
			<xs:restriction base="xs:double">
				<xs:minInclusive value="0"/>
				<xs:maxInclusive value="1000"/>
			</xs:restriction>
      	  </xs:element>
              <xs:element name="PlungeRateMAX" type="xs:string" 
minOccurs="0" />
              <xs:element name="TravelRateMAX" type="xs:string" 
minOccurs="0" />
              <xs:element name="TravelRate" type="xs:string" minOccurs="0" />
              <xs:element name="PlungeRate" type="xs:string" minOccurs="0" />
              <xs:element name="FeedRate" type="xs:string" minOccurs="0" />
              <xs:element name="JogSpeedMode" type="xs:string" minOccurs="0" 
/>
              <xs:element name="SeekXYSpeed" type="xs:string" minOccurs="0" />
              <xs:element name="SeekZSpeed" type="xs:string" minOccurs="0" />
              <xs:element name="JerkGrate" type="xs:string" minOccurs="0" />
              <xs:element name="AccelerationG" type="xs:string" 
minOccurs="0" />
              <xs:element name="AccelMAX" type="xs:string" minOccurs="0" />
              <xs:element name="JerkMAX" type="xs:string" minOccurs="0" />
              <xs:element name="CentripetalG" type="xs:string" minOccurs="0" 
/>
              <xs:element name="BrakeG" type="xs:string" minOccurs="0" />
              <xs:element name="ArcError" type="xs:string" minOccurs="0" />
              <xs:element name="MinLength" type="xs:string" minOccurs="0" />
              <xs:element name="CornerPause" type="xs:string" minOccurs="0" />
              <xs:element name="StartPause" type="xs:string" minOccurs="0" />
              <xs:element name="JerkFactor" type="xs:string" minOccurs="0" />
              <xs:element name="CentripetalAcceleration" type="xs:string" 
minOccurs="0" />
              <xs:element name="LinearAcceleration" type="xs:string" 
minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>

I also have the following C# code that reads the schema in

            dsMachineParameters = new DataSet("MachineParameters");
                dsMachineParameters.ReadXmlSchema("SchemaA.xsd");

I get the following exception from my C# code:

The 'http/://www.w3.org/2001/XMLSchema:restriction' element is not supported 
in this context.  How can I add restrictions ranges on values?
-- 
Don
0
Don4849 (203)
5/30/2008 1:56:00 PM
dotnet.xml 7266 articles. 0 followers. Follow

5 Replies
981 Views

Similar Articles

[PageSpeed] 4

Don wrote:

>               <xs:element name="FeedRateMAX" type="xs:double">
> 			<xs:restriction base="xs:double">
> 				<xs:minInclusive value="0"/>
> 				<xs:maxInclusive value="1000"/>
> 			</xs:restriction>
>       	  </xs:element>

I think you need
   <xs:element name="FeedRateMAX">
     <xs:simpleType>
       <xs:restriction base="xs:double">


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
5/30/2008 3:08:27 PM
I tried the following:
               <xs:element name="FeedRateMAX" type="xs:double">
<xs:simpleType>
 			<xs:restriction base="xs:double">
				<xs:minInclusive value="0"/>
 				<xs:maxInclusive value="1000"/>
 			</xs:restriction>
</xs:simpleType>
       	  </xs:element>

and get the following exceptiion:
The type attribute cannot be present with either simpleType or complexType
-- 
Don


"Martin Honnen" wrote:

> Don wrote:
> 
> >               <xs:element name="FeedRateMAX" type="xs:double">
> > 			<xs:restriction base="xs:double">
> > 				<xs:minInclusive value="0"/>
> > 				<xs:maxInclusive value="1000"/>
> > 			</xs:restriction>
> >       	  </xs:element>
> 
> I think you need
>    <xs:element name="FeedRateMAX">
>      <xs:simpleType>
>        <xs:restriction base="xs:double">
> 
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
> 
0
Don4849 (203)
5/30/2008 3:44:00 PM
Don wrote:
> I tried the following:
>                <xs:element name="FeedRateMAX" type="xs:double">
> <xs:simpleType>
>  			<xs:restriction base="xs:double">
> 				<xs:minInclusive value="0"/>
>  				<xs:maxInclusive value="1000"/>
>  			</xs:restriction>
> </xs:simpleType>
>        	  </xs:element>
> 
> and get the following exceptiion:
> The type attribute cannot be present with either simpleType or complexType

Well that is not what I suggested, drop the type="xs:double" from the 
xs:element.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
5/30/2008 3:50:29 PM
Hi Martin,

Thanks for your input.  The exception does not happen anymore but now when I 
load the a datagrid using the following

           dsMachineParameters = new DataSet("MachineParameters");
            mydatagrid = new DataGrid();
            mydatagrid.DataSource = dsMachineParameters;
            dataGridView1.Controls.Add(mydatagrid);

I am still allowed to change the value to something greater than 1000. This 
is not what I expected?

-- 
Don


"Martin Honnen" wrote:

> Don wrote:
> > I tried the following:
> >                <xs:element name="FeedRateMAX" type="xs:double">
> > <xs:simpleType>
> >  			<xs:restriction base="xs:double">
> > 				<xs:minInclusive value="0"/>
> >  				<xs:maxInclusive value="1000"/>
> >  			</xs:restriction>
> > </xs:simpleType>
> >        	  </xs:element>
> > 
> > and get the following exceptiion:
> > The type attribute cannot be present with either simpleType or complexType
> 
> Well that is not what I suggested, drop the type="xs:double" from the 
> xs:element.
> 
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
> 
0
Don4849 (203)
5/30/2008 4:16:01 PM
Don wrote:

> Thanks for your input.  The exception does not happen anymore but now when I 
> load the a datagrid using the following
> 
>            dsMachineParameters = new DataSet("MachineParameters");
>             mydatagrid = new DataGrid();
>             mydatagrid.DataSource = dsMachineParameters;
>             dataGridView1.Controls.Add(mydatagrid);
> 
> I am still allowed to change the value to something greater than 1000. This 
> is not what I expected?

I think in terms of the W3C XML schema language you have the right type 
definition now. I don't know however whether such restrictions in a 
schema are enforced by DataSets or DataGridViews. I did a quick test 
here and it indeed looks as if the DataSet does not enforce such 
restrictions like minInclusive or maxInclusive. I am not sure how to 
change that. You might want to ask in an ADO.NET group.




-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
5/30/2008 4:42:10 PM
Reply:

Similar Artilces:

Restricting Input
Ok, I'm on a roll here. Could someone please tell me how to set up a cell restriction that will only allow data input if another cell is "empty" or has a certain value? Kind of like an IF function, only when "true" exists, I can input any value, and when "false" exists, I must leave it blank. Thanks in advance. Randy, you can accomplish this using data validation. Select: data-validation, then input your restriction. Randy Vieira wrote: > Ok, I'm on a roll here. Could someone please tell me how to set up a cell > restriction that will ...

Calendar,Data valid. and "Save as Webpage"
Hi, I tried for the first time to save a file as a web page. The sheet has a calendar and simple code to add the calendae selection to the active cell. I also have a data validation formula to change the list contents based on another cell's input. When I saved the file as a webpage (in anticipation of a upcoming work project) the .html file was only a copy of the worksheet with no controls or data validation. I tried again and added user interaction, but still only the worksheet and nothing else. Is it possible to save as webpage and keep it exactly like the .xls file and if so, how do I ...

change general format to time w/o losing the data
Help - I have several spreadsheet with military time i.e. 1701, 1615, etc. The cells are in general format. Since I need to calculate hours from these times, I tried to convert them to [h]:mm but when I do, it changed the number 1701 to 40824:00. I tried to change the cell format to hh:mm but it gave me zeros. I use Excel 2000. Thanks. Hi With your number in cell A2: =TIME(LEFT(A1,2),RIGHT(A1,2),0) -- Arvi Laanemets (When sending e-mail, use address arvil<At>tarkon.ee) "klaire" <anonymous@discussions.microsoft.com> wrote in message news:09db01c4a620$e775390...

Help! Xml Data Island is not refreshing!!!!
Hi, I have an xml data island which is used for providing data for a dropdown list. However, change the 'src' attribute of the xml data island doesn't seem to reload the xml island properly.... Here is my code: <html> <head> </head> <body> <script language="javascript"> function getNoneTextNode(node) { if(node.hasChildNodes && node.firstChild.nodeType!=3) { return node.firstChild; } else if(node.hasChildNodes && node.childNodes[1].nodeType==1) { return node.childNodes[1]; } else if(node.hasChildN...

public folder
Hello, We have recently run into some trouble on our Exchange 2007 server. When attempting to manage properties on public folders via the "Public Folder Management Console", we get the following error message (also attached): *** ERROR TEXT *** The properties on "<item name>" have invalid data. If you click OK, default values will be used instead and will be saved if you do not change them before hitting Apply or OK on the property page. If you click cancel, the object will be displayed read-only and corrupted values will be retained. The foll...

Macro to copy & paste-special-values data to selected worksheets
I have a workbook containing worksheets called “List-1”, “List-2”, “List-3”, “List-4” and many other worksheet “templates”. I need a macro to perform the following: 1. On any of the particular worksheet templates, copy the data on the entire row for all rows within the range A1:H50 only if the value for that row in column H is greater than 0, and then “paste special values” the data on the worksheet called “List-1” starting at cell A1. In other words, for any row within the range that has a value in column H that is greater than 0, the entire row of data in column A-H will be...

Data Validation #46
I am using Data Validation and in the settings I was wondering if there was a sample of when one would use Custom and formula - I have used Whole Number, Date, List etc.. but maybe this could be useful.\ Many thanks Ann Have a look at: http://www.contextures.com/xlDataVal07.html HTH Jason Atlanta, GA >-----Original Message----- >I am using Data Validation and in the settings I was >wondering if there was a sample of when one would use >Custom and formula - I have used Whole Number, Date, List >etc.. but maybe this could be useful.\ > >Many thanks > >Ann ...

Restrict calendar?
We are currently looking at moving to Exchange 2003 this year. Our employers are holding off on the purchase due to the fact that there is no way to restrict certain users from even being able to see "Free/Busy" on their calendars. They want it so that a whole Active Directory OU can be set to not have any calendar access to another OU's calendar. Does anyone know if this is possible? This is huge for us so a great big Thank You in advance to those who might have suggestion. sgsundqu wrote: > We are currently looking at moving to Exchange 2003 this year. Our > employe...

Pricing restriction to price lists
Most of our customers do no wish to load all products to MS CRM. Therefore the system restriction to use price lists is too inflexible. In case of opportunities it is even not possible to enter manual prices on product level. ...

Excel automatically copied data from one cell to another...
One of my excel spreadsheets has started automatically copying data from one cell to another (or rather ROWS of data) without displaying any formula or explanation for the information. It seems to insert it about 10 - 20 rows apart, just one cell, and slips it in before one can notice it happening... Can anyone suggest anything? Jenny Is this reproducible? If so I'll take a look at the file for you. Do you get any warning when you open the workbook, asking to enable macros? -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS &qu...

Latest BlackBerry DM wipes out data in iCal/Entourage
This is a warning to those using BlackBerries. DO NOT, I REPEAT DO NOT update to the latest version of the Mac DM. If you do, you will lose al your tasks, notes, and calendar entires on your Mac. http://supportforums.blackberry.com/t5/BlackBerry-for-Mac/Desktop-Mgr-1-0 3-problem/td-p/487090/page/2 http://forums.crackberry.com/f62/ John -- Are there errors in the Bible? How should a church conduct its worship services? Is drinking Alcohol a sin? Is racism wrong? If you want to learn, get answers, and be able to defend the faith, CERM is your place. http://www.cerm.in...

Sort Data Base By Column
I'd like to sort a data base by column C and have all the associate date in the rest of the columns sort as well. How is that done? Thanks for any help Travelerswa -- travelerswa ----------------------------------------------------------------------- travelersway's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1762 View this thread: http://www.excelforum.com/showthread.php?threadid=57385 travelersway wrote: > I'd like to sort a data base by column C and have all the associated > date in the rest of the columns sort as well. How is that done? >...

Restrictions
All of a sudden I am no longer able to click on hyperlinks embedded within email and get an error message "THIS OPERATION HAS BEEN CANCELLED DUE TO RESTRICTION IN EFFECT ON THIS COMPUTER. PLEASE CONTACT YOUR SYSTEM ADMINISTRATOR." I haven't knowingly changed anything but some other program may have. How do I get back to normal? See if the articles at http://support.microsoft.com/?kbid=3D310049 and http://support.microsoft.com/?kbid=3D307818 help with this.=20 --=20 Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for=20 Administrator...

Why would a Data Validation Listbox show all records during a Filter?
Greetings All, I set up a filter similar to Debra Dalgleish's Filter for Date Range, using a numeric range instead. This works fine. There is student data on a sheet named "Students," and filter criteria (grade levels 6 through 12) are on a sheet named "Schedules". On the "Schedules sheet are separate ranges for different class periods--each cell contains data validation with its source set =AbbNames, which is a column on the "Students" sheet. This allows the user to select student names instead of typing them. With the filter on, however, the listb...

Restrict DB Access
Is there a way in GP7.5 to restrict a user to only see a single SQL Database/Server when they login to GP? Thanks It's unclear exactly what you want to do. In GP, you can restrict access by user to the company databases via the User Access window. When you set up the ODBC DSN, you are determing which database server the user can access through GP. Additionally, if you happen to have multiple servers, the best way to handle it is to have different user accounts. -- Charles Allen, MVP "JDR" wrote: > Is there a way in GP7.5 to restrict a user to only see a si...

Trial CD
Hi, I've successfully installed CRM server and setup the sample users in my AD within the users group. Also, I've unchecked the Restricted access setting for the user in CRM setting up the sample data. I started the install and it autoselected the users from the ad and filled them into their appropriate slots but when I installed the sample data it didn't install all the data. It failed to setup the users and business groups. Here's a sample of the sample install log: ****************************************************************************************** Sample D...

Regular data file imports
We have a General Ledger file that is beining imported by Users on dialy basis into excel from a text file. The column widths are identical every day. Currently the Import wizard is used on a daily basis to split the dat into the selected columns. How can I have the file automatically complete the format when the fil is opened or after the file is opened. The file will have a different name each day. Is there an easy way or will a macro have to be written. Thanks ca -- Message posted from http://www.ExcelForum.com I receive a 4,000+ line bank statement each month in text format and h...

Restricting no. of recipients
Hello, We are using Exchange 5.5 server now and for some reason, we need to restrict the number of recipients that an user can send at once. I tried to find at most of configuration dialogs, but could not find it. Is it possible to enable this function in Exchange 5.5? Or is there a 3rd party tool regarding this? Appreciate it if you can find it or help me. Thanks. Richard You can set this, but it is for the maximum number of recipients in the message before distribution list expansion, so a distribution list counts as one recipient. It is much more accurate in Exchange 2000/2003....

form to enter Silent Auction data?
Does anyone have a form already set up to enter data for a silent auction? If so, how did you go about using it at check-out time? ...

search column for duplicate value during data entry
I'm entering data one row at a time. When I enter a value in column A, I need to know if that value has been entered (in Column A) before. Column A needs to be unique values. What is the best way to verify uniqueness, as I enter a new value? Should I use a module or can a formula check for? I'd prefer to have a Warning box pop up indicating "Value already entered in this column", so I'm assuming a module (VB?) is the way to go. If you have any suggestions, I'd be happy to read. Thanks, The easiest way to do this is to use a conditional format. ...

need help extracting partial data in a range of cells
if a have a column of cells, say from A1 to A150, and each cell contains a 10 digit number, for example xxx1236xxx, how can I parse, or remove the first 3 digits and the last 3 digits in all the cells? On Fri, 21 Mar 2008 19:37:26 -0400, "Walter Kaatz" <wkaat2s@comcast.net> wrote: >if a have a column of cells, say from A1 to A150, and each cell contains a >10 digit number, for example xxx1236xxx, how can I parse, or remove the >first 3 digits and the last 3 digits in all the cells? > If there will never be a leading zero, then simply: =MID(A1,4,4) and fi...

Data Validation Problem #2
I am stumped... I'm trying to set data validation for a group of cells. I choose to allow: decimal...greater than...0 However, for some reason it will not allow me to enter any value what-so-ever. I have done this many-a-time without problems. Is it possible that my spreadsheet has become corrupted or something. The same data validation is being used on another worksheet within the same workbook and it works fine. TIA... Check your cell format - if it's Text, then any entry you make will be interpreted as text rather than a number. If so, change the cell format to a nu...

Refresh existing data when changed in data validation list
I want to refresh my existing values when i change the data validation list . Is it possible??? For example if my list contained message1 and i changed it to message2 , the changed should be reflected whereever i had selected message1 from the list Problem Girl, Why not select the entire sheet, and to a global replace of Message1 with Message2? That should change the values both in your data validation list (use a worksheet range for that rather than a typed-in list from the DV dialog) and it will work. Excel ignores changes made to cells with DV when they are made through the replac...

data labels not linked to data source
I have a chart that displays two numbers in a stacked bar chart... but the data labels are integers, which the source data is. I want the data labels to display the percentage that source column A is of B... For example the source data is A1: 5, B1: 10, and the chart displays the data label as 5 and 10 respectively. I want the data label to show 50% (A1/B1) instead. How can I do that? --- Message posted from http://www.ExcelForum.com/ You can use Rob Bovey's XY Chart Labeler to add the labels. It's a free add-in that you can download from his web site: http://www.appspro...

Sorting spreadsheet data
I'm using Excel 2002 and have a workbook with 3 identical worksheets in it. I have frozen the top 5 rows, using them for headers. On one sheet, when I want to sort the data starting in cell A6, I go to that cell and then to Data & Sort. The window that opens, opens properly - with the "No header row" button selected. The window that opens for the other sheets has the "Header row" button selected and the data doesn't sort the first row. Why the discrepancy? And how do I get the "No header row" button to be the default? Can you post a sample o...