XML::Simple

作って学ぶ、今どきのWebサービス: 第3回 XML::SimpleであらゆるXML文書を料理する
http://www.ibm.com/developerworks/jp/webservices/library/itm-ws3-xml/


XML::Simple
http://search.cpan.org/~grantm/XML-Simple-2.20/lib/XML/Simple.pm


(xmldump.pl)

#!/usr/bin/env perl

use XML::Simple;
use Data::Dumper;

print Dumper (XML::Simple->new()->XMLin('-'));


http://d.hatena.ne.jp/tigerii/20150328/1427542344
で作ったプログラムの出力結果を読み込んで、データ構造を出力してみる。
1回目

$ ./ora_table_info.pl hr/hr@192.168.0.19:1521/xe HR | ./xmldump.pl | more
$VAR1 = {
          'name' => 'HR',
          'table' => {
                     'EMPLOYEES' => {
                                    'row' => [
                                             {
                                               'column' => {
                                                           'DATA_LENGTH' => {
                                                                            'con
tent' => 'DATA_LENGTH'
                                                                          },
                                                           'COLUMN_NAME' => {
                                                                            'con
tent' => 'COLUMN_NAME'
                                                                          },
                                                           'DATA_TYPE' => {
                                                                          'conte
nt' => 'DATA_TYPE'
                                                                        },
                                                           'COMMENTS' => {
                                                                         'conten
t' => 'COMMENTS'
                                                                       }
...


2回目

$ ./ora_table_info.pl hr/hr@192.168.0.19:1521/xe HR | ./xmldump.pl | more
$VAR1 = {
          'table' => {
                     'DEPARTMENTS' => {
                                      'row' => [
                                               {
                                                 'column' => {
                                                             'COLUMN_NAME' => {
                                                                              'c
ontent' => 'COLUMN_NAME'
                                                                            },
                                                             'DATA_TYPE' => {
                                                                            'con
tent' => 'DATA_TYPE'
                                                                          },
                                                             'DATA_LENGTH' => {
                                                                              'c
ontent' => 'DATA_LENGTH'
                                                                            },
                                                             'COMMENTS' => {
                                                                           'cont
ent' => 'COMMENTS'
                                                                         }
                                                           }
...


出力される順番が毎回違う。。