【发布时间】:2011-02-14 10:56:18
【问题描述】:
我在 Talend 有一份工作,应该检索一个字段并循环遍历它。
我的大问题是代码在 XML 字段中循环,但它返回 null。 这是 XML 的示例:
<?xml version="1.0" encoding="ISO-8859-1"?>
<empresas>
<empresa>
<imoveis>
<imovel>
[-- some fields -- ]
<fotos>
<nome id="" order="">photo1</nome>
<nome id="" order=""></nome>
<nome id="" order=""></nome>
<nome id="" order=""></nome>
</fotos>
</imovel>
[ -- other entries here -- ]
</imoveis>
</empresa>
</empresas>
现在我正在使用 tExtractXMLField 组件来获取“fotos”元素。 这是我在组件中的内容:
我尝试更改 XPath 查询和 XPath 循环查询,但结果要么我没有循环通过该字段,要么我在 tMap 的 value 字段中得到了 null。
这是工作的图片:
您可以看到我已经从 XML 中检索了 4 个项目,但在“nome”字段中我得到的是 null。 XPath 一定有问题,但我似乎找不到问题:(
希望有人可以帮助我。谢谢 注意:我在 ubuntu 10.10 64bit 上使用 talendv4.1.2
【问题讨论】: