<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <head>
<link rel="stylesheet" type="text/css" href="menu/sddm.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>需求信息查询结果确认表单</title>


<xforms:model id="model">

<xforms:submission id="debug" action="pasreInstance.jsp" method="post"/>
<xforms:instance id="bill_instance" src="data/providercheck1_havedata.xml"/>
   
    <xforms:bind id="root" nodeset="/root" >
        
             <xforms:bind id="QueryKeyWord1" nodeset="QueryKeyWord1" required="true()" readonly="true()" />         
                 
         <xforms:bind id="myrealName" nodeset="info/info_desc/@realName" required="true()" readonly="true()" />
        
             <xforms:bind id="infolist" nodeset="infolist/info" >         
                           
 <xforms:bind id="id" nodeset="infolist/info/info_desc/@id" required="true()" readonly="true()"/>
 <xforms:bind id="realName" nodeset="infolist/info/info_desc/@realName" required="true()" readonly="true()"/>
 <xforms:bind id="createDate" nodeset="infolist/info/info_desc/@createDate" required="true()" readonly="true()"/>
 <xforms:bind id="info_desc" nodeset="infolist/info/info_desc" required="true()" readonly="true()"/>
        
   <xforms:bind id="ext_desc_realName" nodeset="ext_desc/@realName" required="true()" type="string" calculate="/root/info/info_desc/@realName"/>
   <xforms:bind id="ext_desc_createDate" nodeset="ext_desc/@createDate" required="true()" type="string" calculate="/root/info/info_desc/@createDate"/>
   <xforms:bind id="ext_desc" nodeset="ext_desc"  />
                 
        </xforms:bind>
        
       </xforms:bind>             

</xforms:model>



</head>
<body> <table width="898" border="00" align="center" cellpadding="0" cellspacing="0" bgcolor="#EBEEE1" class="pic"> <tr>

<td width="116" align="left" bgcolor="#E9ECDF">需求信息查询关键字:</td>
<td width="408" height="27" align="left" bgcolor="#E9ECDF"><xforms:label bind="QueryKeyWord1"/></td>

</tr>
</table>
需求信息查询结果:

<xhtml:table>
     <xhtml:tr>
         <xhtml:thead>
             <xhtml:th>编 号          </xhtml:th>
             <xhtml:th>需求信息代理人 </xhtml:th>
             <xhtml:th>需求信息提交时 </xhtml:th>
             <xhtml:th>需求信息       </xhtml:th>
             <xhtml:th>评价内容       </xhtml:th>
         </xhtml:thead>
     </xhtml:tr>
    
     <xforms:repeat id="bread-repeat" >
         <xforms:output bind="id">
             xforms:label/>
         </xforms:output>
         <xforms:output bind="realName">
             <xforms:label/>
         </xforms:output>
         <xforms:output bind="createDate">
             <xforms:label/>
         </xforms:output>
         <xforms:output bind="info_desc">
             <xforms:label/>
         </xforms:output>
        
         <xforms:input bind="ext_desc">
             <xforms:label/>
         </xforms:input>
     </xforms:repeat>
    
</xhtml:table>


<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="2" />
</tr>
</table>
<table width="898" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF" class="pic">
<tr bgcolor="#E9ECDF">
<td width="114" height="32" bgcolor="#E9ECDF">供应信息代理人签名:</td>
<td width="775"><xforms:label bind="myrealName"/></td>
</tr>
</table>

<table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<xforms:trigger>
<xforms:label id="sure_label">确定</xforms:label>
<xforms:action id="sure_action">
<xforms:send submission="debug"/>
</xforms:action>
</xforms:trigger>
</td>
</tr>
</table>
</body>
</html>
这是我的xhtml文件<instancedata> <QueryKeyWord1>%轴%</QueryKeyWord1> <info>
<info_desc id="20080408223458" realName="张三" createDate="2001-12-17" >提供:直径为30厘米的轴 23个</info_desc>
</info>
<suitedListInfo1>
       <infolist>
        <info>
           <info_desc id="20080408223458" realName="张三" createDate="2001-12-17T09:30:47.0Z">需求:直径为30厘米的轴 23个</info_desc>             
      </info>
   
     <info>
        <info_desc id="20080408233458" realName="桑三" createDate="2001-12-17T09:30:47.0Z">需求:半径为30厘米的轴 1个</info_desc>
       </info>     <info>
     <info_desc id="20080408223419" realName="桑三" createDate="2001-12-17T09:30:47.0Z">需求:加工 GB/12-80H螺钉30</info_desc>
    </info>
     </infolist>
  </suitedListInfo1> <Provider1>
   <Performer type="HUMAN">
<id>shop3</id>
<name>张三</name>
   </Performer>
</Provider1>

</instancedata>这是providercheck1_havedata.xml文件,想迭代显示元素infolist的info节点里面信息,运行是报错!
错误信息如下:
XML解析错误:前缀未绑定至名字空间
位置:file:///E:/Tomcat%205.0/webapps/my_chiba_test/forms/providercheck1_test.xhtml
行:54,列:3 <xhtml:table>
----------------^
请问是什么原因???谢谢!

解决方案 »

  1.   

    错误信息很明显了 没命名空间
    ----------------------------------------------------
    XForms 命名空间官方的 XForms 命名空间是:http://www.w3.org/2002/xforms如果您需要在 HTML(或者 XHTML 1.0) 中使用 XForms,就必须通过一个 XForms 命名空间声明所有的 XForms 元素。XForms 预计会成为 XHTML 2.0 的标准组成部分,这样就不再需要 XForms 命名空间了。这个例子使用的 XForms 命名空间:<html xmlns:xf="http://www.w3.org/2002/xforms"><head>
    <xf:model>
      <xf:instance>
      <person>
        <fname/>
        <lname/>
      </person>
      </xf:instance>
      <xf:submission id="form1" method="get"
      action="submit.asp"/>
    </xf:model>
    </head><body>
    <xf:input ref="fname">
    <xf:label>First Name</xf:label></xf:input>
    <br />
    <xf:input ref="lname">
    <xf:label>Last Name</xf:label></xf:input>
    <br />
    <br />
    <xf:submit submission="form1">
    <xf:label>Submit</xf:label></xf:submit>
    </body>
    </html>在上面的例子中,我使用了针对 XForms 命名空间的 xf: 前缀,但是您可自由调用你需要的任何前缀。