我有这样的 xml 响应:
<Result xmlns="olineservice" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ResponseStatus>false</ResponseStatus>
<Error>
<ErrorCode>-7</ErrorCode>
<ErrorDescription>data wasn't found</ErrorDescription>
</Error>
</Result>
我想获取ErrorCode
的值。我试过这个:
//Error[1]/text()
但是 ErrorCode
属性似乎是 Nan
。
您能给我推荐任何解决方案吗?
最佳答案
具体获取错误代码:
//Error[1]/ErrorCode/text()
具体获取错误描述:
//Error[1]/ErrorDescription/text()
这些值都以这种方式读取为文本,因此您可以读取为数字:
//Error[1]/ErrorCode/number()
关于xml - 在nifi中使用EvaluateXpath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45835324/