Partager via


XMLConstraints Property

Contains an object reference to the ISchemaItemCollection object after the successful execution of the XMLAdapterLoadXML or Attach method.

If the LoadXML and Attach methods analyze the XML schema, they set XMLConstraints to the appropriate value, although Visual FoxPro neither analyzes nor enforces any constraints declared in the XMLConstraints collection.

Object.XMLConstraints 

Property Values

Object reference. XMLConstraints contains an object reference to the ISchemaItemCollection object or a null value (.NULL.) when not populated.

Remarks

XML schema can contain constraints, which are associated with the schema. XMLConstraints provides you with access to constraints defined within the DataSet element.

Visual FoxPro does not include any functionality in XMLAdapter that uses these constraints, but it provides access so that you can obtain constraints information and use them in your application if needed.

In the following XML example, note the location of the Primary Key constraint:

<?xml version="1.0" encoding="Windows-1252"?>
<DataSet xmlns="http://tempuri.org/">
<xs:schema id="NewDataSet"  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
   <xs:complexType>
      <xs:choice maxOccurs="unbounded">
         <xs:element name="Tbl2">
            <xs:complexType>
               <xs:sequence>
                  <xs:element name="source"/>
                  <xs:element name="num" type="xs:int"/>
                  <xs:element name="xdtime" type="xs:dateTime"/>
                  <xs:element name="xlog" type="xs:boolean"/>
               </xs:sequence>
            </xs:complexType>
         </xs:element>
      </xs:choice>
   </xs:complexType>
   <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//Tbl2"/>
      <xs:field xpath="source"/>
   </xs:unique>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet >
   <Tbl2 diffgr:id="Tbl21" msdata:rowOrder="0">
      <source>Buckner             </source>
      <num>9</num>
      <xdtime>2002-04-03T00:00:00.0000000-08:00</xdtime>
      <xlog>true</xlog>
   </Tbl2>
</NewDataSet>
   </diffgr:diffgram>
</DataSet>

See Also

Properties | XMLAdapter Object Properties, Methods, and Events | XMLTable Object Properties, Methods, and Events | LoadXML Method | Attach Method

Applies To: XMLAdapter Class | XMLTable Class