SEARCH

Linux Install

Android

Linux Tools

Linux AV

Linux Memo

WINDOWS

PROGRAM

動画 Memo

音楽 Memo

モバイルアプリ Memo

FILE FORMAT

PROTOCOL

DEVICE

BookMark

その他


XML   

perl で xml

http://www.kawa.net/works/perl/treepp/treepp.html
#!/usr/bin/perl

$xmlfile = "test.xml";

use XML::TreePP;
use Data::Dumper;

$xml = XML::TreePP->new();
$tree = $xml->parsefile($xmlfile); 

print Dumper($tree);
#$xml->writefile("out.xml",$tree);

#$data = $xml->XMLout($data,KeepRoot=>1,OutputFile=>'out.xml');

<urllist>
  <urlitem>
    <id>1</id>
    <title>yahoo</title>
    <url>http://weather.yahoo.co.jp/weather/jp/12/4510.html</url>
    <size>800,600</size>
    <offset>242,263</offset>
    <staytime>20</staytime>
    <starttime>12:00</starttime>
  </urlitem>
  <urlitem>
    <id>2</id>
    <title>yahoo</title>
    <url>http://weather.yahoo.co.jp/weather/jp/12/4510.html</url>
    <size>800,600</size>
    <offset>242,263</offset>
    <staytime>20</staytime>
    <starttime>12:00</starttime>
  </urlitem>
</urllist>

<?xml version="1.0" encoding="UTF-8" ?>
<urllist><urlitem><id>1</id>
<offset>242,263</offset>
<size>800,600</size>
<starttime>12:00</starttime>
<staytime>20</staytime>
<title>yahoo</title>
<url>http://weather.yahoo.co.jp/weather/jp/12/4510.html</url>
</urlitem>
<urlitem><id>2</id>
<offset>242,263</offset>
<size>800,600</size>
<starttime>12:00</starttime>
<staytime>20</staytime>
<title>yahoo</title>
<url>http://weather.yahoo.co.jp/weather/jp/12/4510.html</url>
</urlitem>
</urllist>