talend tExtractXMLField 返回相同的名字,而不是移动到下一个名字标签
我有一个下面的 xml 文件。我的工作是 tFileInputXML--->tExtractXMLField--->tlog
我的 tExtractXMLField 设置如下。它不断返回所有其他行的“仅第一个名字”,而不是预期的结果。如何将其设置为仅返回
<root><status>success</status><data><users><firstname>Abby</firstname>
<book><name>ABC</name>
<state><complete>true</complete></state>
</book>
<book><name>ZZZ</name>
<state><complete>true</complete></state>
</book>
</users>
<users><firstname>Abdul</firstname>
<book><name>SeeSaw</name>
<state><complete>true</complete></state>
</book>
<book><name>WWW</name>
<state><complete>true</complete></state>
</book>
</users>
</data>
}
I have an the below xml file . My job is tFileInputXML--->tExtractXMLField--->tlog
My tExtractXMLField is set as the below. It keeps returning the Only the first firstname for all the other rows instead of the expected results. How can I set it to return only
<root><status>success</status><data><users><firstname>Abby</firstname>
<book><name>ABC</name>
<state><complete>true</complete></state>
</book>
<book><name>ZZZ</name>
<state><complete>true</complete></state>
</book>
</users>
<users><firstname>Abdul</firstname>
<book><name>SeeSaw</name>
<state><complete>true</complete></state>
</book>
<book><name>WWW</name>
<state><complete>true</complete></state>
</book>
</users>
</data>
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 xpath 语法不正确。您的循环元素基于“book”。 “firstname”和“book”在同一层,如果你想访问它,你首先必须移动到上层节点。
使用
"../firstname"
代替。your xpath syntax is not correct. You have based your loop element on "book". "firstname" and "book" being on the same level, if you want to access it you first have to move to the upper node.
use
"../firstname"
instead.