我有一个XML在下面提到的格式。我正在使用五旬节中的Get XML来解析这一点。但是我无法得到正确的路径来得到所有的值。我想要'custom-attributes'.的所有值
它只给了我“性”的第一个属性.i.e的值。有谁能帮我得到其他custom-attributes.的值吗?
我已将“LoopXpath”设置为:- /names/name
在按“Get字段”之后,在“字段”选项卡中按下。我将自动在字段选项卡中获得自定义属性xpath,如下所述:-并且它只给出了'sex‘的值。
Name |Xpath |Element | ResultType |Type
----------------------------------------------------------------------------------------------
custom-attributes |custom-attributes/custom-attribute |Node |Value of |String
<names>
<name>
<firstname>ABCDEH</firstname>
<lastname>JKLAM</lastname>
<custom-attributes>
<custom-attribute attribute-id="sex">male</custom-attribute>
<custom-attribute attribute-id="height">169</custom-attribute>
<custom-attribute attribute-id="weight">78</custom-attribute>
<custom-attribute attribute-id="dateofbirth">09/09/1990</custom-attribute>
<custom-attribute attribute-id="occupation">engineer</custom-attribute>
</custom-attributes>
</name>
</names>最后,我想要一排,如下所述:
firstname lastname sex height weight dateofbirth occupation
ABCDEH JKLAM male 160 78 09/09/1990 engineer有人能帮我一下吗
发布于 2015-02-05 18:22:04
我不知道你在代码中做了什么。首先,在步骤的“循环XPATH”设置部分中,定义父节点路径,而不是路径(如上文所述),如下所示:
/names/name/custom-attributes//*其次,当您获得字段属性(即"custom-attribute",)时,需要将XPATH指定为'.‘(点)。这将执行属性值的递归。检查下面的图像:

最后,您将获得递归数据如下:

我在这里中放置了一个示例代码。请查一下,以供参考。
希望它有帮助:)
https://stackoverflow.com/questions/28348709
复制相似问题