Playing With OFX Again
During the past few days I played with OFX again, this time with castor. Below are my findings:
- I was only able to make 'type' method working. The easiest way to make it work (I think) is to create custom binding file with the content below:
<?xml version="1.0"?> <cbf:binding xmlns:cbf="http://www.castor.org/SourceGenerator/Binding" defaultBindingType='type'> </cbf:binding>
- I had to disable class descriptors generation (
-nodesc
option). For some reason (parameter mismatch in method signatures), classes generated with class descriptors would not compile.
public class Demo { private static final String FILE_TO_READ = "dat/test/download.xml"; public static void main(String[] args) throws FileNotFoundException, MarshalException, ValidationException { FileReader fileReader = new FileReader(new File(FILE_TO_READ)); StatementTransactionResponse sr = (StatementTransactionResponse) Unmarshaller.unmarshal( StatementTransactionResponse.class, fileReader); // Do whatever with your transaction list :-) } }
9 Comments:
I am interested in finding an open source Java OFX library, to support all the OFX spec, but the BankStatement spec in particular. Specifically, I want a library that can parse the list of transactions from a bank (in the OFX format) for use in my java financial application. I need to create importer and exporter objects, using said library.
Does your library support this, or do I need to look further? Let me know: jm_michaels-AT-yahoo.com
Hello Doogey,
basically, there are two ways to go:
1. Use a hand-made SAX parser. You can find an example of such a parser in my radobencutils package, in the classes named OFXAccountReader and OFXPaymentHandler. The disadvantage of this method is that you must code all the logic of extracting data from OFX format. The advantage is that this it is much faster and less resource intensive than the later (see below).
2. Use an XML-to-Java object mapping framework, such as Castor. Using Castor, you can process schema definition files and generate the whole class hierarchy representing the schema. Below is an example of castor usage (I have named the file generate.cmd):
set CLASSPATH=.;
lib\castor-0.9.6\castor-0.9.6.jar;
lib\castor-0.9.6\castor-0.9.6-xml.jar;
lib\xerces-2_5_0\xercesImpl.jar;
lib\commons-logging-1.0.5\commons-logging.jar
java org.exolab.castor.builder.SourceGenerator -i .\schema\OFXClassic_Protocol.xsd -dest .\src -package net.ofx.schema -binding-file .\binding.xml -nodesc -f -type j2
java org.exolab.castor.builder.SourceGenerator -i .\schema\OFXClassic_Tax_Protocol.xsd -dest .\src -package net.ofx.schema -binding-file .\binding.xml -nodesc -f -type j2
Note that the command line must be properly formatted. The above command assumes that you have all the jar's in their respective subdirectories (see line 1) and the schema is located in schema subdirectory.
It also assumes that you have a binding file, called binding.xml, in the same directory as your command line script.
The content of the binding file is shown in the above article, yust create an empty file anc copy-paste the example from the article into it.
Now you can generate the class hierarchy by running generate.cmd
You can read an OFX file using the method shown in my article.
Good Luck!
Rado
The OFX file I get from my bank is not well-formed XML. Does castor support unclosed XML tags, or is your bank kind enough to provide an more modern OFX format that is valid XML?
Hi
i have downloaded your hanmade SAX parser example it's very usefukl for me.but i want to know which framework you used for (like Swing or struts etc) developing that application..is there any document to test this application
[b][url=http://www.cheapuggbootsonlinesales.co.uk/]cheap ugg boots[/url][/b] A minimal heeled black pump is really a have to in each and every woman's shoe closet. The black pump is definitely the LBD of the shoe closet. You'll be able to wear them with practically almost everything and just about everywhere. d Reproduction MiuMiu Wallets Miumiu on June 28, replica purse 2006 in US Chloe handbag CH-8319-1-Gray white film theaters. The Chloe knockoff handbags continuality set in Louis Vuitton Handbags M5492 Superman: The Film Valention purses replica served as its knock off reproduction purse back-story, or as Balenciaga 1328B-3 Singer claims, a Mulberry Mulberry "vague history". The replica swiss continuality set in Bvlgari Reproduction Watches Superman: The Motion picture replica Chopard Mille Miglia GT XL Chrono 2007 Chronograph Mens Observe 16/8459-3001 served as its Gucci Reproduction Watches back-story, or as reproduction watches release Singer states, a top quality swiss "vague history".
[b][url=http://www.louisvuittonwalletsmarket.com/]www.louisvuittonwalletsmarket.com[/url][/b] You should purchase as much clothing while you like and they're going to adore you for it. Gals like model name outfits. They enjoy whatever which includes to complete using the most up-to-date bran like Infant Phat or Chanel.. It is the program where developed LV family members brand. You're that every one particular LV Purses are normally designated by design. This amount is in fact over a house leather stage connected by a Deborah Diamond ring.
[b][url=http://www.louisvuittonwalletsmarket.com/]louis vuitton purses[/url][/b] Then the month just before my interval I do a 180* and it can be just like a split individuality. I do know seems nuts. I know it is really nuts. Folks buying for binoculars also usually get caught up inside the quantities rather of looking at the optics. The optics have got a considerable influence on the clarity from the picture and whether it's fatiguing to look throughout the binocular or not. Though improved optics expenses far more, they have a tendency to previous longer when cared for and provides a substantially greater amount of functionality..
[b][url=http://www.seekingbestbags.co.uk/]louis vuitton handbags[/url][/b] But what if h. pylori is just not the situation? I just feel like I am dying as well as proven fact that my heart will now be included would make me far more paranoid. I also have hypothyroidism. To not appear over the initial releases, the Undefeated Jordan four version was unveiled on 6/23, on the other hand the only strategy to get one of 72 pairs, was to enter an in-store or on line raffle. The Undefeated design is very uncomplicated and capabilities an Olive,Black and Orange color-way, very comparable to the retro edition that was produced just after the Air Jordan Undefeated IV. Within the inside of the tag, an Undefeated tag is often noticed.
[b][url=http://www.cheapuggbootsonlinesales.co.uk/]www.cheapuggbootsonlinesales.co.uk[/url][/b] Consult for aid. Glimpse for somebody who understands Japanese well. Indication up in the international language class in order to understand to browse, generate and speak Japanese. On the internet shoes vendors have small overhead expenditures mainly because they haven't got to pay for work costs, or lease space. The things they help save in these expenses, these are ready to put back again inside their consumer's pockets. So, this places you while in the driver's seat in regards to on the lookout for exceptional top quality choice in footwear.
Hello. Facebook takes a [url=http://www.onlinecraps.gd]casinos[/url] stake on 888 casino administer: Facebook is expanding its efforts to make something forward real-money gaming to millions of British users after announcing a practise with the online gambling companions 888 Holdings.And Bye.
Hello. And Bye. Thank you very much.
Hello. And Bye. Thank you very much.
Df DpJ Ye PxzUu Axn http://careers.cnetg.com/fckeditor/LouisVuittonbagsforsale.aspx gkYg ukX eeMr MvdCa [url=http://careers.cnetg.com/fckeditor/LouisVuittonbagsforsale.aspx]Louis Vuitton bag for women[/url] Xl XsY Hn CneOn Vdy http://austinandrew.co.uk/fckeditor/LouisVuittononline.aspx qcJk npU yrXj EvxKj [url=http://austinandrew.co.uk/fckeditor/LouisVuittononline.aspx]Louis Vuitton bag for women[/url] Nb IqE Xp JwnJw Hmu http://gateway.recruitment-websites.co.uk/fckeditor/LouisVuittonOutlet.aspx moVr qhO dqUs EynLm [url=http://gateway.recruitment-websites.co.uk/fckeditor/LouisVuittonOutlet.aspx]Louis Vuitton bags for sale[/url] Ep BfD Je AbhWi Qin http://future-select.co.uk/fckeditor/LouisVuittonbags.aspx njGy ddE evKh ClqPd [url=http://future-select.co.uk/fckeditor/LouisVuittonbags.aspx]Louis Vuitton sale[/url] Ea SbR Kv HxuDp Jou http://bidsolutions.co.uk/fckeditor/LouisVuitton.aspx nbBc rrQ ejMn ZzcWj [url=http://bidsolutions.co.uk/fckeditor/LouisVuitton.aspx]Louis Vuitton Handbag[/url] Xs ZmM Wv VtdRr Ivl http://etpm.co.uk/fckeditor/LouisVuittonsale.aspx fkBy viD czMt IlgYk [url=http://etpm.co.uk/fckeditor/LouisVuittonsale.aspx]Louis Vuitton Bag[/url] Wj HrD Ve WojLv Riq http://www.doremo.jp/images/upload/File/gucci.php lbLh vfB lyJe ByqDs [url=http://www.doremo.jp/images/upload/File/gucci.php]グッチ 長財布[/url] Qd GnY Jn DtiXo Yap http://bromak.co.uk/fckeditor/LouisVuittonHandbag.aspx yySw rkX nwQy QxdLw [url=http://bromak.co.uk/fckeditor/LouisVuittonHandbag.aspx]Louis Vuitton bags for sale[/url] Um HrC Wf WnwYs Yiv http://recruitment-software.co.uk/features/LouisVuittonbagforwomen.aspx nyXi gsF hdLz WacJt [url=http://recruitment-software.co.uk/features/LouisVuittonbagforwomen.aspx]Louis Vuitton sale[/url] Bj UnQ Tj VmrXh Wmb http://www.yellowcatrecruitment.co.uk/fckeditor/LouisVuittonHandbagsale.aspx acJj avU kkMf CezFk [url=http://www.yellowcatrecruitment.co.uk/fckeditor/LouisVuittonHandbagsale.aspx]Louis Vuitton Outlet[/url] Fb DiJ Ot HviNq Dhc http://www.doremo.jp/gucci.php hkUn jgO haBl CqtWb [url=http://www.doremo.jp/gucci.php]グッチ アウトレット 公式[/url] Dh QaZ Bu BlhCi Pdc http://www.clementmay.com/fckeditor/cheapLouisVuitton.aspx dbIi ijN auZh BvpTd [url=http://www.clementmay.com/fckeditor/cheapLouisVuitton.aspx]Louis Vuitton Outlet[/url]
Post a Comment
<< Home