标题: [问题求助] perl解析singer.xml报错 [打印本页]
作者: netdzb 时间: 2020-6-22 06:18 标题: perl解析singer.xml报错
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/"
xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/">
<title>歌手姓名</title>
<trackList>
<track>
<album>Winnie Ho - Finally Chapter 01 (2016)
/</album>
<title>01 - Me and Myself.mp3</title>
<location>位置1</location>
<duration>172000</duration>
</track>
<track>
<album>Winnie Ho - Finally Chapter 01 (2016)
/</album>
<title>02 - Keep in Touch.mp3</title>
<location>位置2</location>
<duration>200000</duration>
</track>
<track>
<album>Winnie Ho - Finally Chapter 01 (2016)
/</album>
<title>03 - Missing.mp3</title>
<location>位置3</location>
<duration>207000</duration>
</track>
</trackList>
</playlist>
=================
1楼是singer.xml
作者: netdzb 时间: 2020-6-22 06:18
回复 1# netdzb
use strict;
use warnings;
use XML::Simple;
use Data:: Dumper;
use 5.010;
my $xmlfile = "singer.xml";
my $xml = XML::Simple->new(KeyAttr=>"", ForceArray => 1);
my $tree = $xml->XMLin($xmlfile);
say Dumper($tree);
作者: 523066680 时间: 2021-4-17 09:32
直接复制执行后没有报错也- $VAR1 = {
- 'title' => [
- "\x{6b4c}\x{624b}\x{59d3}\x{540d}"
- ],
- 'xmlns:vlc' => 'http://www.videolan.org/vlc/playlist/ns/0/',
- 'xmlns' => 'http://xspf.org/ns/0/',
- 'version' => '1',
- 'trackList' => [
- {
- 'track' => [
- {
- 'duration' => [
- '172000'
- ],
- 'location' => [
- "\x{4f4d}\x{7f6e}1"
- ],
- 'album' => [
- 'Winnie Ho - Finally Chapter 01 (2016)
- /'
- ],
- 'title' => [
- '01 - Me and Myself.mp3'
- ]
- },
- {
- 'title' => [
- '02 - Keep in Touch.mp3'
- ],
- 'album' => [
- 'Winnie Ho - Finally Chapter 01 (2016)
- /'
- ],
- 'duration' => [
- '200000'
- ],
- 'location' => [
- "\x{4f4d}\x{7f6e}2"
- ]
- },
- {
- 'location' => [
- "\x{4f4d}\x{7f6e}3"
- ],
- 'duration' => [
- '207000'
- ],
- 'album' => [
- 'Winnie Ho - Finally Chapter 01 (2016)
- /'
- ],
- 'title' => [
- '03 - Missing.mp3'
- ]
- }
- ]
- }
- ]
- };
复制代码
主要看报错说的啥。
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |