gpt4 book ai didi

xml - 使用perl脚本拆分xml文件

转载 作者:数据小太阳 更新时间:2023-10-29 02:51:26 25 4
gpt4 key购买 nike

您好,我正在使用 perl 脚本将大 xml 拆分为小块。我已经引用了这个链接 Split file by XML tag

我的代码是这样的

if($line =~ /^</row>/)
{
$count++;
}

但是我收到这个错误

 works\filesplit.pl line 20.
Bareword found where operator expected at E:\Work\perl works\filesplit.pl line 2
0, near "/^</row"
(Missing operator before row?)
syntax error at E:\Work\perl works\filesplit.pl line 20, near "/^</row"
Search pattern not terminated at E:\Work\perl works\filesplit.pl line 20.

谁能帮帮我

更新

<row>
<date></date>
<ForeignpostingId />
<country>11</country>
<domain>http://www.xxxx.com</domain>
<domainid>20813</domainid>
</row>
<row>
<date></date>
<ForeignpostingId />
<country>11</country>
<domain>http://www.xxxx.com</domain>
<domainid>20813</domainid>
</row>
<row>
<date></date>
<ForeignpostingId />
<country>11</country>
<domain>http://www.xxxx.com</domain>
<domainid>20813</domainid>
</row>

最佳答案

你试过了吗xml_split ?这是XML::Twig 附带的工具它专门设计用于根据各种标准(标签名称、级别、大小)拆分大型 XML 文件。

关于xml - 使用perl脚本拆分xml文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20257914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com