理解XForm——學習IBM DW的資料 (3)
來源:互聯網
上載者:User
1、XForm靈活的用戶端資料校正功能
資料驗證一般包括三種類型:
完整性(Completeness):使用者必須填充所有要求的欄位。有時候,某個欄位是否必須填充依賴於另一個欄位的值。比如,只有當使用者使用信用卡支付時才需要信用卡號。
資料類型(Data types): 數字必須是數字、日期必須是日期,依次類推。
合理性(Appropriateness):電話號碼應該只包含數字,或者還可以包含與區號有關的短線和括弧。郵遞區號必須有 5 個數字組成,還可以帶有短線和“加四”號碼。
XForm提供Model中資料節點的類型綁定機制,如:
<xforms:model id=“payinfo“>
<xforms:submission action="http://www.example.com/orderform.php"
method="post"/>
<xforms:instance xmlns="">
<paymentinfo>
<method></method>
<cardtype></cardtype>
<cardnumber></cardnumber>
<expdate></expdate>
</paymentinfo>
</xforms:instance>
<xforms:bind ref="paymentinfo" type="ccnumber"/>
<xsd:schema>
<xsd:simpleType name="ccnumber">
<xsd:restriction base="xsd:string">
<xsd:pattern value="d{14,18}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
</xforms:model>
2、強制輸入
...
</xsd:schema>