Ant*_*oCS 3 java xml xpath talend
我在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>
Run Code Online (Sandbox Code Playgroud)
现在使用tExtractXMLField组件我试图获取"fotos"元素.以下是我在组件中的内容:

我曾试图改变XPath查询和XPath的循环查询,但结果是要么我不循环通过现场或我得到在TMAP值字段为空.
这是工作的形象:

你可以看到我从XML中检索了4个项目但是我在"nome"字段中得到的是null.XPath肯定有问题,但我似乎无法找到问题:(
希望有人可以帮助我.谢谢笔记:我在ubuntu 10.10 64bit上使用talendv4.1.2
如果要在<nome>节点上循环,则必须使用循环XPath查询
"/empresas/empresa/imoveis/imovel/fotos/nome"
Run Code Online (Sandbox Code Playgroud)
和foto_nome XPath查询类似的东西
"text()"
Run Code Online (Sandbox Code Playgroud)
注意:我还纠正了XML中可能带来问题的错误(</imoveis>缺少"s").