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="AXYZMachi nes" msdata:IsDataSe t="true"
msdata:UseCurre ntLocale="true" >
<xs:complexType >
<xs:choice minOccurs="0" maxOccurs="unbo unded">
<xs:element name="MotionPar ameters">
<xs:complexType >
<xs:sequence>
<xs:element name="FeedRateM AX" type="xs:double ">
<xs:restricti on base="xs:double ">
<xs:minInclusiv e value="0"/>
<xs:maxInclusiv e value="1000"/>
</xs:restriction>
</xs:element>
<xs:element name="PlungeRat eMAX" type="xs:string "
minOccurs="0" />
<xs:element name="TravelRat eMAX" type="xs:string "
minOccurs="0" />
<xs:element name="TravelRat e" type="xs:string " minOccurs="0" />
<xs:element name="PlungeRat e" type="xs:string " minOccurs="0" />
<xs:element name="FeedRate" type="xs:string " minOccurs="0" />
<xs:element name="JogSpeedM ode" type="xs:string " minOccurs="0"
/>
<xs:element name="SeekXYSpe ed" type="xs:string " minOccurs="0" />
<xs:element name="SeekZSpee d" type="xs:string " minOccurs="0" />
<xs:element name="JerkGrate " type="xs:string " minOccurs="0" />
<xs:element name="Accelerat ionG" 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="Centripet alG" 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="CornerPau se" type="xs:string " minOccurs="0" />
<xs:element name="StartPaus e" type="xs:string " minOccurs="0" />
<xs:element name="JerkFacto r" type="xs:string " minOccurs="0" />
<xs:element name="Centripet alAcceleration" type="xs:string "
minOccurs="0" />
<xs:element name="LinearAcc eleration" type="xs:string "
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
I also have the following C# code that reads the schema in
dsMachineParame ters = new DataSet("Machin eParameters");
dsMachineParame ters.ReadXmlSch ema("SchemaA.xs d");
I get the following exception from my C# code:
The 'http/://www.w3.org/2001/XMLSchema:restr iction' element is not supported
in this context. How can I add restrictions ranges on values?
--
Don
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="AXYZMachi nes" msdata:IsDataSe t="true"
msdata:UseCurre ntLocale="true" >
<xs:complexType >
<xs:choice minOccurs="0" maxOccurs="unbo unded">
<xs:element name="MotionPar ameters">
<xs:complexType >
<xs:sequence>
<xs:element name="FeedRateM AX" type="xs:double ">
<xs:restricti on base="xs:double ">
<xs:minInclusiv e value="0"/>
<xs:maxInclusiv e value="1000"/>
</xs:restriction>
</xs:element>
<xs:element name="PlungeRat eMAX" type="xs:string "
minOccurs="0" />
<xs:element name="TravelRat eMAX" type="xs:string "
minOccurs="0" />
<xs:element name="TravelRat e" type="xs:string " minOccurs="0" />
<xs:element name="PlungeRat e" type="xs:string " minOccurs="0" />
<xs:element name="FeedRate" type="xs:string " minOccurs="0" />
<xs:element name="JogSpeedM ode" type="xs:string " minOccurs="0"
/>
<xs:element name="SeekXYSpe ed" type="xs:string " minOccurs="0" />
<xs:element name="SeekZSpee d" type="xs:string " minOccurs="0" />
<xs:element name="JerkGrate " type="xs:string " minOccurs="0" />
<xs:element name="Accelerat ionG" 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="Centripet alG" 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="CornerPau se" type="xs:string " minOccurs="0" />
<xs:element name="StartPaus e" type="xs:string " minOccurs="0" />
<xs:element name="JerkFacto r" type="xs:string " minOccurs="0" />
<xs:element name="Centripet alAcceleration" type="xs:string "
minOccurs="0" />
<xs:element name="LinearAcc eleration" type="xs:string "
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
I also have the following C# code that reads the schema in
dsMachineParame ters = new DataSet("Machin eParameters");
dsMachineParame ters.ReadXmlSch ema("SchemaA.xs d");
I get the following exception from my C# code:
The 'http/://www.w3.org/2001/XMLSchema:restr iction' element is not supported
in this context. How can I add restrictions ranges on values?
--
Don
Comment