Advertisement
Guest User

Untitled

a guest
Jan 10th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.98 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3.  
  4. use Data::Dumper qw( Dumper );
  5. use XML::SAX     qw( );
  6. use XML::Simple  qw( XMLin );
  7.  
  8. #$XML::Simple::PREFERRED_PARSER = "XML::Parser";
  9. $XML::Simple::PREFERRED_PARSER = "XML::SAX::Expat";
  10.  
  11. print(Dumper(XMLin(\*DATA, NSExpand => 1)));
  12.  
  13. __DATA__
  14. <doc xmlns:xyz="http://a" xmlns:ec="http://b">
  15.    <xyz:CostFee>
  16.       <ec:OPA>25.00</ec:OPA>
  17.       <ec:CTID>278421</ec:CTID>
  18.       <xyz:CDEPSID>82</xyz:CDEPSID>
  19.       <ec:IID>8765654</ec:IID>
  20.    </xyz:CostFee>
  21. </doc>
  22.  
  23. __END__
  24. $VAR1 = {
  25.           '{http://a}CostFee' => {
  26.                                    '{http://a}CDEPSID' => '82',
  27.                                    '{http://b}CTID' => '278421',
  28.                                    '{http://b}IID' => '8765654',
  29.                                    '{http://b}OPA' => '25.00'
  30.                                  },
  31.           '{http://www.w3.org/2000/xmlns/}xyz' => 'http://a',
  32.           '{http://www.w3.org/2000/xmlns/}ec' => 'http://b'
  33.         };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement