Reputation: 113
I'm trying to bind XForms instances according to an XML Schema. It works fine with facets, like in the following case, where ValeurNoteType
is a restriction on an xs:decimal
type :
<xforms:bind nodeset="instance('note-template')">
<xforms:bind nodeset="Valeur" type="ValeurNoteType"/>
</xforms:bind>
XForms 1.1 doesn't seems to support complex types for binding, like in the following example, where ExamenType
is a sequence :
<xforms:bind nodeset="instance('examen-template')">
<xforms:bind nodeset="Examen" type="ExamenType"/>
</xforms:bind>
What I want is to avoid to write <xforms:bind nodeset="Titre" required="true()"/>
for every element of the ExamenType
type for which there is a Min Occurs = 1
in the xml schema (or other conditions, like xs:date
type for an element in the sequence and so on).
Is there a way to do it with Orbeon ?
Upvotes: 0
Views: 503
Reputation: 7857
XForms 1.1 is clear in specifying how the type
attribute is handled:
"The
type
model item property is not applied to instance nodes that contain child elements. Thetype
model item property associates a datatype (as defined in [XML Schema part 2]) with the string-value (as defined in [XPath 1.0]) of an instance node. The datatype being associated can be obtained from a simpleType definition or a simpleContent definition from a complexType. If the datatype cannot be obtained as just described, then the Default Value ofxsd:string
is used."
In other words, the type
attribute only works as a way to validate text content, not the structure of the document.
If a schema is present, the entire instance is validated (Orbeon forms has extensions to control that, see Validation) and nodes can be marked as invalid as well in that process, including due to complex content validation. But I am not sure if this will help in your case. In any case, this is a process separate from the handling of the type
attribute.
Upvotes: 1