在NIFI中将XML分配后,如何将流file名称更改为XML行?
我使用splitxml
-processor将大型XML文件分为237个较小的文件。作为一个基础,我使用了根源的孩子。
现在,我想将每个结果文件作为文件名将相应的XML行标签作为文件名。
例如,以下结构导致名为package
,计费
,policy> policy
等文件中的文件结果。
root
|-- Package: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- package12: array (nullable = true)
| | | |-- element: struct (containsNull = true)
| | | | |-- Type: string (nullable = true)
| | |-- Addr: struct (nullable = true)
| | | |-- Addr1: string (nullable = true)
| | | |-- Addr2: string (nullable = true)
|-- Billing: struct (nullable = true)
| |-- PhlyRepresentativeEmail: string (nullable = true)
|-- Policy: struct (nullable = true)
| |-- PolicyName: string (nullable = true)
I devided a large XML file into 237 smaller files by using the SplitXML
-Processor. As a basis, I used the children of the roots.
Now I want to give each resulted file their corresponding XML row tag as filename.
For example, following structure results in files named Package
, Billing
, Policy
and so on...
root
|-- Package: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- package12: array (nullable = true)
| | | |-- element: struct (containsNull = true)
| | | | |-- Type: string (nullable = true)
| | |-- Addr: struct (nullable = true)
| | | |-- Addr1: string (nullable = true)
| | | |-- Addr2: string (nullable = true)
|-- Billing: struct (nullable = true)
| |-- PhlyRepresentativeEmail: string (nullable = true)
|-- Policy: struct (nullable = true)
| |-- PolicyName: string (nullable = true)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过将它们引导到
extracttext
-processor中来拔出每个流file的“新根”。然后,您使用Regex提取相应的标签并将其存储到特定的变量中。看
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.1.12.1/org.apache.nifi.nifi.nifi.processors.processors.standard.standard.startard.extracttext/ < /a>更多
You can pull out the "new root" of each FlowFile by directing them into a
ExtractText
-Processor. Then you use RegEx to pull the corresponding tag and store it into a specific variable.See
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.12.1/org.apache.nifi.processors.standard.ExtractText/ for more