[英]Does anyone know where I can find a good example of using the OFX wsdl file with C#?
[英]OFX File parser in C#
我在C#中尋找一個OFX文件解析器庫。 我在網上搜索但似乎沒有。 有誰知道任何高質量的C#OFX文件解析器。 我需要處理一些OFX格式的銀行對賬單文件。
更新我已經設法找到一個C#庫來解析OFX解析器。
這是x sharp的鏈接。 這個代碼庫似乎是啟動我的解決方案的最佳案例。
我試圖使用ofx sharp庫,但意識到它不起作用的是文件是無效的XML ...它似乎解析但是有空值...
我在OFXDocumentParser.cs中進行了更改,我首先將文件修復為有效的XML,然后讓解析器繼續。 不確定您是否遇到過同樣的問題?
方法內部:
private string SGMLToXML(string file)
我首先添加了幾行將文件帶到newfile然后讓SqmlReader處理以下代碼:
string newfile = ParseHeader(file);
newfile = SGMLToXMLFixer.Fix_SONRS(newfile);
newfile = SGMLToXMLFixer.Fix_STMTTRNRS(newfile);
newfile = SGMLToXMLFixer.Fix_CCSTMTTRNRS(newfile);
//reader.InputStream = new StringReader(ParseHeader(file));
reader.InputStream = new StringReader(newfile);
SGMLToXMLFixer是我添加到OFXSharp庫中的新類。 它基本上掃描所有打開的標簽,並驗證它是否也有結束標簽。
namespace OFXSharp
{
public static class SGMLToXMLFixer
{
public static string Fix_SONRS(string original)
{ .... }
public static string Fix_STMTTRNRS(string original)
{ .... }
public static string Fix_CCSTMTTRNRS(string original)
{ .... }
private static string Fix_Transactions(string file, string transactionTag, int lastIdx, out int lastIdx_new)
{ .... }
private static string Fix_Transactions_Recursive(string file_modified, int lastIdx, out int lastIdx_new)
{ .... }
}
}
試試http://www.codeproject.com/KB/aspnet/Ofx_to_DataSet.aspx 。 該代碼使用Framework 3.5並將ofx轉換為數據集,這可能有助於您嘗試執行的操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.