我正在更改代码以在XForms中使用绑定(这比在任何地方都使用节点集更好!)但我正在犯错误。
我收到的错误消息是:" error : XForms Error (8):id (data_criterion)不引用绑定元素.“
从我一直在使用的教程/指南来看,这似乎是可行的,但显然我遗漏了一些东西!(顺便说一句,我在这里的示例之后对绑定代码进行建模:http://en.wikibooks.org/wiki/XForms/Bind)
我最初认为问题是由于我使用的是xf:select控件,而不是xf:input,就像示例一样,但是即使我将代码简化为最简单的代码,我仍然会收到错误!
这是我使用的模型代码:
<xf:model id="select_data">
<xf:instance id="criteria_data" xmlns="">
<file>
<criteria>
<criterion></criterion>
</criteria>
</file>
</xf:instance>
<bind id="data_criterion" nodeset="instance('criteria_data')/criteria/criterion"/>
</xf:model>至于ui代码,这就是我所拥有的:
<xf:input bind="data_criterion">
<xf:label>Enter criteria:</xf:label>
</xf:input>我收到的错误消息是:" error : XForms Error (8):id (data_criterion)不引用绑定元素.“
有人知道问题出在哪里吗?另外,绑定和xf:select (与xf:itemset一起使用)控件是否有我应该知道的特殊用法?(我最终使用了大量的xf:选择窗体上的控件。)
提前感谢!
编辑:
我通过这个验证器运行了代码,得到了这样的消息(引用绑定行):“警告:下面的元素是否应该应用XForms命名空间?:bind (第66行)”
发布于 2010-06-04 01:21:00
有几件事你可能想改变:
nodeset表达式应该是instance('criteria_data')/criteria/...,没有file。记住:instance()返回根元素,而不是文档节点。(这是你通过更新问题来处理的;很好)xf上的bind。应该是:<xf:bind id="data_criterion" nodeset="instance('criteria_data')/criteria/criterion"/>。下面是一个完整的代码示例,在Orbeon窗体下对我很好:
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
<xhtml:head>
<xhtml:title>SO Bind</xhtml:title>
<xf:model id="select_data">
<xf:instance id="criteria_data" xmlns="">
<file>
<criteria>
<criterion>Gaga</criterion>
</criteria>
</file>
</xf:instance>
<xf:bind id="data_criterion" nodeset="instance('criteria_data')/criteria/criterion"/>
</xf:model>
</xhtml:head>
<xhtml:body>
<xf:input bind="data_criterion">
<xf:label>Enter criteria:</xf:label>
</xf:input>
</xhtml:body>
</xhtml:html>https://stackoverflow.com/questions/2968780
复制相似问题