Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 从响应中提取数据_Regex_Apache Nifi - Fatal编程技术网

Regex 从响应中提取数据

Regex 从响应中提取数据,regex,apache-nifi,Regex,Apache Nifi,我有这样的回应: <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>

我有这样的回应:

<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>

假的
-7
找不到数据
我想从响应流文件中提取ErrorCode值,并检查它是否等于-7,如果是,我将不得不记录它。 我在ExtractText处理器中尝试了这一点:
${flowfile.content}=(.*)[a-zA-Z0]
但它对我和特罗斯都不起作用类似的例外:

  • 我应该更改什么来获取ErrorCode的值

  • 因为您的输入是XML,所以您可能会发现XML或更有用。对于EvaluatePath,尝试使用
    //ErrorCode
    作为路径,它应该从triage中将-7提取到属性或内容中(取决于目标属性的设置)

    :您至少应该设置一个更具体的标题我使用了带编号的EvaluatePath(//ErrorCode)然后使用executescript processor获取ErrorCode的值,然后将其放入flowfile名称中,但仍然是Nan。您能给我一些信息来获取ErrorCode编号并将其作为属性写入flowfile吗?在联机解析器中,它的工作编号(//ErrorCode)但对于EvaluatePath处理器和//Errorcode,这两个数字(//Errorcode)都没有正确的结果