我在 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 的值字段中得到空值。
这是该工作的图像:
您可以看到我已经从 XML 中检索了 4 个项目,但在“nome”字段中我得到的是 null。XPath 一定有问题,但我似乎找不到问题:(
希望有人可以帮助我。谢谢 注意:我在 ubuntu 10.10 64bit 上使用 talendv4.1.2