|< 1 2 3 >| | 28 Einträge, 3 Seiten |
1
2
3
4
5
6
7
8
9
10
<toolbar>
<button id="msg-new" text="New" title="Create and Send a New Message">
<image src="msg-new.gif" width="16" height="16" alt="Create and Send a New Message" />
</button>
<button id="msg-new-drop" title="New" refid="newmsg" dropdown="1" />
<seperator />
<button id="msg-print">
<image src="print.gif" width="16" height="16" alt="Print Selected Message" />
</button>
</toolbar>
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[
"toolbar",
[
{},
0,
"\n\t",
"button",
[
{
id => "msg-new",
text => "New",
title => "Create and Send a New Message",
},
0,
"\n\t\t",
"image",
[
{
alt => "Create and Send a New Message",
height => 16,
src => "msg-new.gif",
width => 16,
},
],
0,
"\n\t",
],
0,
"\n\t",
"button",
[
{ dropdown => 1, id => "msg-new-drop", refid => "newmsg", title => "New" },
],
0,
"\n\t",
"seperator",
[{}],
0,
"\n\t",
"button",
[
{ id => "msg-print" },
0,
"\n\t\t",
"image",
[
{
alt => "Print Selected Message",
height => 16,
src => "print.gif",
width => 16,
},
],
0,
"\n\t",
],
0,
"\n",
],
]
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
my $xml = XML::Parser->new(Style => 'Tree');
my $xmltree = $xml->parsefile($filename);
my $toolbar = $xmltree->[1];
my @buttons = ();
my $count = scalar @{$toolbar};
for(my $i = 0; $i < $count-1; $i++) {
next unless $toolbar->[$i];
next if ref $toolbar->[$i];
if(lc($toolbar->[$i]) eq 'button') {
my $buttonobj = $toolbar->[++$i];
# mehr code
my $count = scalar @{$buttonobj};
for(my $i = 0; $i < $count; $i++) {
next unless $buttonobj->[$i];
next if ref $buttonobj->[$i] eq 'HASH';
if(lc($buttonobj->[$i]) eq 'image') {
my $imageobj = $buttonobj->[++$i];
# mehr code
last; # only one image
}
}
# mehr code
} elsif(lc($toolbar->[$i]) eq 'seperator') {
my $seperatorobj = $toolbar->[++$i];
# mehr code
}
}
1
2
3
4
5
use XML::LibXML;
my $xml = XML::LibXML->new;
my $doc = $xml->parse_string($xml_content);
my $doc_elem = $doc->documentElement;
my $value = $doc_elem->findvalue("/path/to/element");
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
C:\Dokumente und Einstellungen\sak>perl
use YAML;
my ($hashref, $arrayref, $string) = Load(<<'--END');
---
name: ingy
age: old
weight: heavy
# I should comment that I also like pink, but don't tell anybody.
favorite colors:
- red
- white
- blue
---
- clark
- oren
- ingy
--- ]
You probably think YAML stands for "Yet Another Markup Language". It
ain't! YAML is really a data serialization language. But if you want
to think of it as a markup, that's OK with me. A lot of people try
to use XML as a serialization format.
"YAML" is catchy and fun to say. Try it. "YAML, YAML, YAML!!!"
--END
print Store($string, $arrayref, $hashref);
use Data::Dumper;
print Dumper($string, $arrayref, $hashref);
^Z
--- !perl/YAML::Error
code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
msg: Inconsistent indentation level
line: 15
document: 3
...
at - line 2
|< 1 2 3 >| | 28 Einträge, 3 Seiten |