OFC parsing fixes
Mauro Carvalho Chehab <[email protected]> Sun, 21 May 2006 10:37:35 +0100 (BST)
| Newsgroups | gmane.comp.finance.libofx.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, I'm starting to use libofx for parsing my bank-generated OFC files. However, it seems that OFC parsing doesn't cover some fields used by brazilian banks. OFC parsing is missing some relevant fields: Check number and ledger balance. Enclosed is a patch that makes it parse both. It is working fine, and according with dtd/ofc.dtd. There are still some parsing errors generated due lack of support for charsets on different code pages: LibOFX ERROR: WRITEME: DTD (2) is not supported by the container (Above message occured on Line 3, Column 2) LibOFX ERROR: WRITEME: CPAGE (1252) is not supported by the container (Above message occured on Line 4, Column 2) LibOFX ERROR: OpenSP parser: otherError (misc parse error): /tmp/libofxtmpna1cON:36:24:E: non SGML character number 227 (Above message occured on Line 36, Column 25) LibOFX ERROR: OpenSP parser: otherError (misc parse error): /tmp/libofxtmpna1cON:204:13:E: non SGML character number 243 (Above message occured on Line 204, Column 14) LibOFX ERROR: OpenSP parser: otherError (misc parse error): /tmp/libofxtmpna1cON:284:22:E: non SGML character number 233 (Above message occured on Line 284, Column 23) LibOFX ERROR: OpenSP parser: otherError (misc parse error): /tmp/libofxtmpna1cON:364:24:E: non SGML character number 227 Cheers, Mauro
fix_ofc_parse_libofx.patch
(text/plain, 1.4 KB)
This patch fixes parser for Ledger and Check Number on OFC
OFC DTD describes both types, but they were not processed.
This patch is important to make OFC parsing usable for generated
files from major Brazil's bank.
ofx_container_statement.cpp | 4 ++++
ofx_container_transaction.cpp | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff -r 4b541016c644 lib/ofx_container_statement.cpp
--- a/lib/ofx_container_statement.cpp Sat May 20 17:42:29 2006 -0300
+++ b/lib/ofx_container_statement.cpp Sun May 21 06:13:02 2006 -0300
@@ -65,6 +65,10 @@ void OfxStatementContainer::add_attribut
data.date_end = ofxdate_to_time_t(value);
data.date_end_valid = true;
}
+ else if(identifier=="LEDGER"){
+ data.ledger_balance=ofxamount_to_double(value);
+ data.ledger_balance_valid=true;
+ }
else{
OfxGenericContainer::add_attribute(identifier, value);
}
diff -r 4b541016c644 lib/ofx_container_transaction.cpp
--- a/lib/ofx_container_transaction.cpp Sat May 20 17:42:29 2006 -0300
+++ b/lib/ofx_container_transaction.cpp Sun May 21 06:13:02 2006 -0300
@@ -225,7 +225,7 @@ void OfxBankTransactionContainer::add_at
data.unitprice = 1,00;
data.unitprice_valid=true;
}
- else if(identifier=="CHECKNUM"){
+ else if(identifier=="CHECKNUM" || identifier=="CHKNUM"){
strncpy(data.check_number,value.c_str(), sizeof(data.check_number));
data.check_number_valid = true;
}