File: ex10.1.pl

package info (click to toggle)
libxml-dt-perl 0.69-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 388 kB
  • sloc: perl: 1,432; xml: 438; makefile: 16
file content (36 lines) | stat: -rw-r--r-- 880 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl

use XML::DT;
use Data::Dumper;

%handler = ( -default => sub{$c},
	     packages => sub{ [ split(",",$c)] },
             -type    => { vendorinfo => 'MAP',
                           paks       => 'SEQ' }
           ); 

$a = dtstring ("
  <vendorinfo>
    <id> netscape.com </id> 
    <id> netscape.commmm</id>
    <name> Netscape </name> 
    <status> active </status> 
    <packages> communicator-4.07, communicator-4.5, navigator-4.07 </packages> 
  </vendorinfo>",%handler);
    
print Dumper($a);         

$a = dtstring ("
  <vendorinfo>
    <id> netscape.com </id> 
    <id> netscape.commmm</id>
    <name> Netscape </name> 
    <status> active </status> 
    <paks> 
       <item>communicator-4.07 </item>
       <item> communicator-4.5, </item>
       <item> navigator-4.07 </item> 
    </paks> 
  </vendorinfo>",%handler);

print Dumper($a);