Spec file fix
[profile/ivi/perl-SGMLSpm.git] / DOC / sample.pl
1 #!/usr/bin/perl
2
3 use SGMLS;
4
5 $this_parse = new SGMLS(STDIN); # Read from standard input.
6
7 while ($this_event = $this_parse->next_event) {
8     my $type = $this_event->type;
9     my $data = $this_event->data;
10   SWITCH: {
11       $type eq 'start_element' && do {
12           print "Beginning element: " . $data->name . "\n";
13           last SWITCH;
14       };
15       $type eq 'end_element' && do {
16           print "Ending element: " . $data->name . "\n";
17           last SWITCH;
18       };
19       $type eq 'cdata' && do {
20           print "Character data: " . $data . "\n";
21           last SWITCH;
22       };
23       $type eq 'sdata' && do {
24           print "Special data: " . $data . "\n";
25           last SWITCH;
26       };
27       $type eq 're' && do {
28           print "Record End\n";
29           last SWITCH;
30       };
31       $type eq 'pi' && do {
32           print "Processing Instruction: " . $data . "\n";
33           last SWITCH;
34       };
35       $type eq 'entity' && do {
36           print "External Data Entity: " . $data->name .
37               " with notation " . $data->notation->name . "\n";
38           last SWITCH;
39       };
40       $type eq 'start_subdoc' && do {
41           print "Beginning Subdocument Entity: " . $data->name . "\n";
42           last SWITCH;
43       };
44       $type eq 'end_subdoc' && do {
45           print "Ending Subdocument Entity: " . $data->name . "\n";
46           last SWITCH;
47       };
48       $type eq 'conforming' && do {
49           print "This is a conforming SGML document\n";
50           last SWITCH;
51       };
52   }
53 }