Name
type
Synopsis
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"/>
Get XForms Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.