我使用refs将模型绑定到Xforms中的控件。我想通过xml架构将模型绑定到类型。然而,它不起作用。我必须在模型元素中手动编写类型,以使其工作。我究竟做错了什么?如何避免修改模型元素?
document.xhtml:
...
<xf:model id="default-model" xmlns="" schema="document.xsd">
<xf:instance>
<elem>
<!-- <n3 xsi:type="xs:anyURI"></n3> -->
<n3></n3>
<n2></n2>
</elem>
</xf:instance>
</xf:model>
....
<xf:upload id="object6" ref="/elem/n3" >
</xf:upload>
....
document.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="ct1">
<xs:sequence>
<xs:element name="n1" type="ct11" minOccurs="0"/>
<xs:element name="n3" type="xs:anyURI"/>
<xs:element name="n2" type="ct12"/>
</xs:sequence>
<xs:attribute name="attr3" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="ct11">
<xs:sequence>
<xs:element name="n11" type="ct111"/>
<xs:element name="n12" type="xs:date" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="attr11" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="ct12">
<xs:sequence>
<xs:element name="n21" type="xs:date" minOccurs="0"/>
<xs:element name="n22" type="xs:date" minOccurs="0"/>
<xs:element name="n23" type="xs:date" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="attr12" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="ct111">
<xs:sequence>
<xs:element name="n31" type="xs:date" minOccurs="0"/>
<xs:element name="n32" type="xs:date"/>
</xs:sequence>
<xs:attribute name="attr111" type="TypDaty" use="optional"/>
</xs:complexType>
<xs:element name="elem" type="ct1"/>
</xs:schema>