Closed Carsuzan closed 2 years ago
Based on the error message, it appears that the OFX file might be malformed. Does it look like valid XML?
If you are comfortable, use a text editor to sanitize the file and post it. You probably don't want account numbers or transactions posted.
Another option would be to just send the first couple of lines (which should not contain any sensitive information). You can do this with head -2 ./HelloBank1.ofx
.
On a side note, this utility does not require elevated privileges. You may wish to reconsider the use of sudo
to run it.
Thank you Paul for your quick answer. I'm not familiar with XML so I upload my ofx file. Please remove gz extension used only for upload compatibility HelloBank2.ofx.gz
@Carsuzan I have taken a look at your OFX file and it appears to be an invalid format. Right off the bat, at the top of the file, I see
OFXHEADER:100
DATA:OFXSGML
VERSION:102
which is not valid XML. I also see that there are many tags which are not closed. XML is similar to HTML, where opening tags need a closing tag, e.g. <p>this is a paragraph</p>
I found the structure so odd, I looked up the specification: OFX Work Group - The Spec, which confirmed my suspicion. Here is a typical response from the spec document:
<!--XML declaration-->
<?xml version="1.0"?>
<!--OFX declaration-->
<?OFX OFXHEADER="200" VERSION="220" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>
<!--OFX response-->
... Open Financial Exchange responses ...
</OFX>
The spec also explicitly states
An aggregate tag begins a compound tag sequence, which must end with a matching tag; for example, \<AGGREGATE>...\</AGGREGATE>.
Your file is full of unclosed tags like <SEVERITY>
. There should be a closing tag after the data like <\SEVERITY>
Unfortunately, I don't know how to help here. The file you got is not proper OFX format, so it can't be parsed as-is. Maybe it is designed for financial software that uses a different format?
I 've opened an issue request with my bank as ofx format is wrong ..not sure i'll get a technical answer. Thank you for your kind help and time you spent . Have a good WE
Glad to help @Carsuzan. Sorry I did not have an easy answer. I hope your query is successful. Please reopen this issue if you have further problems.
Hello, I'm trying to use your tool but I'm not familiar with python to solve the error message i get. Hope you can help. Thank you
jpm@SweetHome:~/Téléchargements/Banks$ sudo python3 ofx_swapper.py -o ./HelloBank1.ofx Traceback (most recent call last): File "ofx_swapper.py", line 41, in
swapper = OFXSwapper(args.input)
File "ofx_swapper.py", line 9, in init
self._tree = ET.parse(self._inputFile)
File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1202, in parse
tree.parse(source, parser)
File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 595, in parse
self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: syntax error: line 1, column 0