2

我正在为我的 Plone 网站开发一个新的附加组件,因此它显示了我的错误

configure.zcml : unbound prefix.

在这里,我正在编写我的 zcml 代码:

    <configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    i18n_domain="customer.reports">

  <five:registerPackage package="." initialize=".initialize" />

  <include package="plone.resource" file="meta.zcml"/>
  <plone:static
      directory="templates"
      type="reports"
      name="customer"
  />
</configure>

如下所述的未绑定前缀错误。

文件“/Plone/Python-2.7/lib/python2.7/xml/sax/handler.py”,第 38 行,在 fatalError 中引发异常 zope.configuration.xmlconfig.ZopeXMLConfigurationError:文件“/Plone/zinstance/parts/instance/ etc/site.zcml”,第 16.2-16.23 行 ZopeXMLConfigurationError:文件“/Plone/buildout-cache/eggs/Products.CMFPlone-4.3-py2.7.egg/Products/CMFPlone/configure.zcml”,第 98.4-102.10 行 ZopeSAXParseException :文件“/Plone/zinstance/src/customer.reports/customer/reports/configure.zcml”,第 13.2 行,未绑定前缀

4

2 回答 2

5

Your code does not define a prefix plone that you are using in the element plone:static. You may need to add the corresponding namespace declaration somewhere, e.g. in the configure element: xmlns:plone="http://namespaces.plone.org/plone".

于 2016-02-08T05:59:56.717 回答
5

This error indicates that you're missing a namespace declaration at the top of your configure.zcml. Try including one of the following in the configure tag:

 xmlns:plone="http://namespaces.plone.org/plone"

As i added above line in my code to fix unbound error before this i was using plone to register my add-on but not declare the correct namespace i.e. plone at the name space declaration block of zcml file

<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    xmlns:plone="http://namespaces.plone.org/plone"
    i18n_domain="customer.reports">

  <five:registerPackage package="." initialize=".initialize" />

  <!-- -*- extra stuff goes here -*- -->

  <include package="plone.resource" file="meta.zcml"/>
  <plone:static
      directory="templates"
      type="reports"
      name="customer"
  />
</configure>
于 2016-02-08T06:00:15.987 回答