shift->{file};
}
+=method file_version
+
+ $version = $homebank->file_version;
+
+Get the file format version.
+
+=cut
+
+sub file_version {
+ shift->{homebank}{version};
+}
+
=method title
$title = $homebank->title;
$account = $homebank->find_account_by_key($key);
-Find a account with the given key.
+Find an account with the given key.
=cut
sub parse_string {
my $str = shift or die _usage(q{parse_string($str)});
+ my %homebank;
my %properties;
my @accounts;
my @payees;
$attr{$key} = _decode_xml_entities($attr{$key});
}
- if ($node eq 'properties') {
+ if ($node eq 'homebank') {
+ $attr{version} = delete $attr{v} if $attr{v};
+ %homebank = %attr;
+ }
+ elsif ($node eq 'properties') {
$attr{currency} = delete $attr{curr} if $attr{curr};
%properties = %attr;
}
$attr{flags}{$name} = $flags & (1 << $shift) ? 1 : 0;
}
+ for my $bnum (0 .. 12) {
+ $attr{budget_amounts}[$bnum] = delete $attr{"b$bnum"} if $attr{"b$bnum"};
+ }
+
push @categories, \%attr;
}
elsif ($node eq 'ope') { # transaction
- $attr{paymode} = $TRANSACTION_PAYMODES{$attr{paymode} || ''} || 'unknown';
- $attr{status} = $TRANSACTION_STATUSES{delete $attr{st}} || 'unknown';
+ $attr{paymode} = $TRANSACTION_PAYMODES{$attr{paymode} || ''} || 'unknown';
+ $attr{status} = $TRANSACTION_STATUSES{delete $attr{st} || ''} || 'unknown';
$attr{transfer_key} = delete $attr{kxfer} if $attr{kxfer};
$attr{split_amount} = delete $attr{samt} if $attr{samt};
$xml_parser->parse($str);
return {
+ homebank => \%homebank,
properties => \%properties,
accounts => \@accounts,
payees => \@payees,