5.9 Augmenting Schemas with Type Constraints


Type declarations are mostly achieved via XML Schema. However, there may be situations where the XForms' author wishes to refine the type constraints provided by an existing schema. If the author has write access to the schema, such refinements might be implemented by modifying the schema. Model property type is for use in those cases where this is not possible.

Model property type provides functionality similar to XML Schema attribute xsi:type . However, notice that being an attribute itself, xsi:type cannot be used to specify type information for attributes. Using model property type via element bind does not suffer from this restriction. We show an example of this in Figure 5.11. Property type can also be used to advantage to provide basic type information on XForms environments where XML Schema is not available.

Figure 5.11 Declaring type information via property type .
 <  model   xmlns  ="http://www.w3.org/2002/xforms"  xmlns:xsd  ="http://www.w3.org/2001/XMLSchema">   <  instance  >     <  person   xmlns  =""  serial  ="1">     <  name  /><  age  /></  person  >   </  instance  >   <  bind   nodeset  ="/person">     <  bind   nodeset  ="@serial"  type  ="xsd:integer"/>     <  bind   nodeset  ="age"  type  ="xsd:integer"/>   </  bind  > </  model  > 


XForms. XML Powered Web Forms with CD
XForms. XML Powered Web Forms with CD
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 94

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net