如何使用 ofx4j 解析格式错误的 xml (ofx)?
我拼命尝试使用以下库:ofx4j。但是与解析 ofx 文件相关的文档有点精简。它说:如果您有文件或其他流资源,您可以使用 net.sf.ofx4j.io.OFXReader 的实例来读取它,
但是我该怎么办?
它还说明了以下内容:如果要将 OFX 直接解组为 Java 对象,请使用 net.sf.ofx4j.io.AggregateUnmarshaller。
好吧,但这对我来说有点复杂。有什么明显的事情我错过了吗?当我尝试使用解组器时,它要求我实现一个接口。
有人可以向我指出一个在线资源来解释我所缺少的部分吗?或者最好的是,您从前面有关 ofxreader 和 unmarshaller 的陈述中理解了什么?
请不要攻击我,我正在使用 playframework 学习 java,我真的很高兴能够解析这些 ofx 文件。
提前致谢。
i am desperatly trying to use the following library : ofx4j. But the documentation relative to parsing an ofx file is a bit lite. It says : If you've got a file or other stream resource, you can read it using an instance of net.sf.ofx4j.io.OFXReader
Ok but how do i do ?
It also states the following: if you want to unmarshal the OFX directly to a Java object, use the net.sf.ofx4j.io.AggregateUnmarshaller.
Fine, but that's a bit complicated for me. Is there something obvious that i missed ? When i try to use the unmarshaller, it asks me to implement an interface.
Could someone point me to an online resource explaining the bits that i am missing ? Or the best, what do you understand from the previous statements relative to the ofxreader and the unmarshaller ?
Please, don't bash me, I am learning java with the playframework and i would really appreciate to be able to parse those ofx files.
thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有看到简单的旧教程,但 test 目录,用于说明
OFXReader
和AggregateUnmarshaller
。短语“
net.sf.ofx4j 的实例。 io.OFXReader
“表示已知的实现类之一”,例如NanoXMLOFXReader
,即 在这里测试。AggregateUnmarshaller
是 此处API 和 邮件 档案也是很好的资源。看起来有很多机构参与。
I don't see a plain old tutorial, but there's sample code in the test directory that illustrates
OFXReader
andAggregateUnmarshaller
.The phrase "an instance of
net.sf.ofx4j.io.OFXReader
" means one of the known implementing classes", such asNanoXMLOFXReader
, which is tested here. A test forAggregateUnmarshaller
is here.The API and mail archives are good resources, too. It looks like a lot of institutions participate.
对于那些像我一样当我无法从 AggregateUnmarshaller 获得预期结果时偶然发现这一点的人...这是一个示例。
For those that stumble on this like I did when I couldn't get the expected results from the AggregateUnmarshaller... Here is an example.