小编Cob*_*bra的帖子

如何使用XML Twig将修改后的树保存到磁盘中

试过这个,但我得到一个0文件,这个错误.在未打开的文件句柄上打印()C:/Perl/site/lib/XML/Twig.pm第3036行.

#!c:\perl\bin\perl.exe
use strict;
use XML::Twig;

my $upd_file = "updev.xml" ;
my $main_file = "main.xml" ;

# get the info we need by loading the update file
my $t_upd= new XML::Twig();

$t_upd->parsefile( $upd_file);

my $upd_dev_id = $t_upd->root->next_elt( 'DEVNUM')->text;
my $upd_dev    = $t_upd->root->next_elt( 'DEVS');
my $upd_seg    = $t_upd->root ;

# now process the main file
my $t= new XML::Twig( TwigHandlers => { DEVS => \&DEVS, },
              PrettyPrint => 'indented',
            );
$t->parsefile( $main_file);
$t->flush;           # don't forget or the last closing tags …
Run Code Online (Sandbox Code Playgroud)

perl xml-twig

3
推荐指数
1
解决办法
2009
查看次数

标签 统计

perl ×1

xml-twig ×1