【问题标题】:PyXB - AssertionError: No element bindings in http://www.w3.org/1999/xhtmlPyXB - AssertionError:http://www.w3.org/1999/xhtml 中没有元素绑定
【发布时间】:2014-04-26 08:13:36
【问题描述】:

我正在尝试使用 PyXB 为 WSDL 生成绑定,它在标题中给出了 AssertionError 异常。

根据 PyXB 文档,我的理解是 http://www.w3.org/1999/xhtml 的捆绑包存档包含在 PyXB 中。然而,似乎有些不对劲。它要么没有被使用,要么内容不正确。

我使用以下命令行尝试生成绑定:

python c:\Python27\Scripts\pyxbgen.py --wsdl-location=http://xx.xxx.xxx.xxx/YYY.asmx?WSDL --module=client --write-for-customization

回溯:

Traceback (most recent call last):
File "c:\Python27\Scripts\pyxbgen.py", line 51, in <module> generator.resolveExternalSchema()
File "c:\Python27\lib\site-packages\pyxb\binding\generate.py", line 2647, in resolveExternalSchema
schema = converter(self, sl)
File "c:\Python27\Scripts\pyxbgen.py", line 28, in WSDLToSchema
spec = wsdl.definitions.createFromDOM(pyxb.utils.domutils.StringToDOM(xmld,
location_base=wsdl_uri), process_schema=True, generation_uid=generator.generationUID())
File "c:\Python27\lib\site-packages\pyxb\binding\basis.py", line 1767, in createFromDOM
return self._createFromDOM(node, expanded_name, **kw)
File "c:\Python27\lib\site-packages\pyxb\binding\basis.py", line 1791, in _createFromDOM
return element.CreateDOMBinding(node, self.elementForName(expanded_name), **kw)
File "c:\Python27\lib\site-packages\pyxb\binding\basis.py", line 1735, in elementForName
assert 'elementBinding' in elt_en.namespace()._categoryMap(), 'No element bindings in %s' % (elt_en.namespace(),)
AssertionError: No element bindings in http://www.w3.org/1999/xhtml

另外,我将 PYXB_ARCHIVE_PATH 环境变量设置为:

C:\Python27\Lib\site-packages\pyxb\bundles\common\raw

我不确定这是否是正确的方法。我也尝试指定 --archive-path 命令行选项,但我得到了同样的错误。

【问题讨论】:

    标签: python wsdl pyxb


    【解决方案1】:

    可能你需要使用:

    --archive-path=${PYXB_ROOT}/pyxb/bundles/common//:+
    

    作为论据。这首先在公共包中递归搜索可用的命名空间,然后包括任何其他搜索路径。有一个接近这个的example in the manual

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-24
      • 2016-09-24
      • 2019-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多