XML•Enhance the DataSet XML Schema

Listing 1. You can enhance the DataSet XML schema the VS.NET designer generates to declare validation constraints at the field, row, table, and DataSet levels.

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema ... omitted >
<xs:element name="CustomerOrders" msdata:IsDataSet="true"  
	msprop:ruleassembly="BoOrders" <!-- DS level 
	validation -->
	msprop:ruleclass="ValidationRules.CValidateDs">
	<xs:complexType>
	 <xs:choice maxOccurs="unbounded">
	<xs:element name="Customers" 
		msprop:ruleassemblyrow="BoOrders" 
			<!-- Row level validation -->
		msprop:ruleclassrow=
			"ValidationRules.customerrowvalidate" 
	msprop:ruleassemblytable=
			"BoOrders" <!-- Table level validation -->
	msprop:ruleclasstable=
		"ValidationRules.customertablevalidate">
	<xs:complexType>
	<xs:sequence>
		<xs:element name="ShipName" type=
			"xs:string" minOccurs="0" 
		msprop:ruleassembly="BoOrders" 
			<!-- Field level validation -->
		msprop:ruleclass=
			"ValidationRules.shipnamefieldvalidate" />
		<xs:element name="Email" type=
			"xs:string" minOccurs="0" 
			<!-- Field level validation using regular 
				expressions -->
msprop:regexpconstraint=
		"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
		<!-- simple field validation: field can't be 
			null -->
	 <xs:element name="CompanyName" type="xs:string" 
		msprop:required= "true"/>
...
/>