You are reading O'Reilly XForms Essentials by Micah Dubinko. (What is this?) - Buy XForms Essentials Online
| Allowed values:a xs:QName representing an available XML Schema datatype. |
| Default value:xs:string |
This property associates an XML Schema datatype with an instance data node.
The unusual thing about this property is that it's technically unnecessary. The right XML Schema incantations can accomplish the same result. In many cases, however, using this model item property is more convenient than using XML Schema features.
Attaching a datatype to an element node is the most straightforward scenario. XML Schema provides an instance-based syntax, using an xsi:type attribute that can be attached to any element. The main drawbacks of this technique are that it is highly intrusive to the instance data and that it works only with elements.
Normal XML Schema conventions can also be used to associate a datatype with a node, and this works with attributes, too. For example, the following XML Schema fragment associates a datatype of my:phoneNum to an attribute named pn:
<xs:attribute name="pn" type="my:phoneNum"/>