Finance::OFX::Tree - Convert Open Financial Exchange content into a tree


p5-Finance-OFX documentation  | view source Contained in the p5-Finance-OFX distribution.

Index


NAME

Top

Finance::OFX::Tree - Convert Open Financial Exchange content into a tree similar to XML::Parser::EasyTree

SYNOPSIS

Top

 use Finance::OFX::Tree
 my $tree = Finance::OFX::Tree::parse($ofxContent);

DESCRIPTION

Top

Finance::OFX::Tree provides a single function, parse(), that accepts the contents of an OFX "file" as a scalar argument and returns a reference to an array tree representing the contents of the file. The array tree returned by parse() is remarkably similar to that created by XML::Parser::EasyTree.

NOTE

parse() can't process the OFX header block, only the <OFX> block.

EXAMPLE

If $ofxContent in the above code is...

 <OFX>
    <SIGNONMSGSRSV1>
 	<SONRS>
 	    <STATUS>
 		<CODE>0
 		<SEVERITY>INFO
 		<MESSAGE>SonRq is successful
 	    </STATUS>
 	    <DTSERVER>20080220161753.501[-8:PST]
 	    <LANGUAGE>ENG
 	    <FI>
 		<ORG>DI
 		<FID>074014187
 	    </FI>
 	</SONRS>
    </SIGNONMSGSRSV1>
 </OFX>

...the resulting array tree will be...

 $VAR1 = [
   {
     'content' => [
       {
         'content' => [
           {
             'content' => [
               {
                 'content' => [
                   {
                     'content' => '0',
                     'name' => 'code'
                   },
                   {
                     'content' => 'INFO',
                     'name' => 'severity'
                   },
                   {
                     'content' => 'SonRq is successful',
                     'name' => 'message'
                   }
                 ],
                 'name' => 'status'
               },
               {
                 'content' => '20080220161753.501[-8:PST]',
                 'name' => 'dtserver'
               },
               {
                 'content' => 'ENG',
                 'name' => 'language'
               },
               {
                 'content' => [
                   {
                     'content' => 'DI',
                     'name' => 'org'
                   },
                   {
                     'content' => '074014187',
                     'name' => 'fid'
                   }
                 ],
                 'name' => 'fi'
               }
             ],
             'name' => 'sonrs'
           }
         ],
         'name' => 'signonmsgsrsv1'
       }
     ],
     'name' => 'ofx'
   }
 ];

FUNCTIONS

Top

$tree = parse($ofx)

parse() accepts a single scalar argument containing the OFX data to be parsed and retunrs a reference to an array tree.

SEE ALSO

Top

HTML::Parser XML::Parser::EasyTree http://ofx.net

WARNING

Top

From Finance::Bank::LloydsTSB:

This is code for online banking, and that means your money, and that means BE CAREFUL. You are encouraged, nay, expected, to audit the source of this module yourself to reassure yourself that I am not doing anything untoward with your banking data. This software is useful to me, but is provided under NO GUARANTEE, explicit or implied.

AUTHOR

Top

Brandon Fosdick, <bfoz@bfoz.net>

COPYRIGHT AND LICENSE

Top


p5-Finance-OFX documentation  | view source Contained in the p5-Finance-OFX distribution.