在NIFI中将XML分配后,如何将流file名称更改为XML行?

发布于 2025-02-13 14:14:31 字数 926 浏览 0 评论 0原文

我使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡淡の花香 2025-02-20 14:14:32

您可以通过将它们引导到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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文