Jump to content

Please read the Forum Rules before posting.

Photo

Accessing .TOPX and .NOTX Content


  • Please log in to reply
8 replies to this topic

#1 TommyJSmithJr

TommyJSmithJr

    New to Bible Support

  • Members
  • Pip
  • 14 posts
  • LocationGeorgia, United States
Offline

Posted 04 February 2014 - 03:09 PM

All,

 

I am in the process of both creating tools to make Modules and creating Modules.  I have only been at this a few days, and hoped I could save a little time.  I have been able to connect, extract and Edit RTF content from a bbxl file with a C# application I wrote, but I am not able to connect to a Topics .topx or Study Notes .notx file.  Since both of these file type are created by the User, there should be no copyright issue, or reasons for Rick Meyers to prevent access.

 

I am getting is the following ERROR:

 

 An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

 
Additional information: 'The invocation of the constructor on type 'WpfApplication2.MainWindow' that matches the specified binding constraints threw an exception.' Line number '3' and line position '9'.

 

But this little 2 minute video:

 

 

Is much more helpful in understanding the problem.  The error happens when the file is opened for reading.  Encryption, password, or other formatting appears to have occurred so the parsing of the file causes an error. 

 

Any and All Assistance is appreciated.

Attached Files


Edited by TommyJSmithJr, 04 February 2014 - 04:04 PM.


#2 Josh Bond

Josh Bond

    Administrator

  • Administrators
  • PipPipPipPipPip
  • 2,891 posts
  • LocationGallatin, TN
Offline

Posted 04 February 2014 - 04:37 PM

Five suggestions or guesses:

 

1. Make sure no other program has the topx/notx files open. Close e-Sword and ToolTip NT if they are open, just to be sure.

 

2. Open the topx/notx files with a Sqlite Database Editor. Several free options exist. This makes sure it's really a sqlite database. And you can browse the records to confirm there's no encryption. Also browse the records to make sure there are records (and the database isn't empty).

 

3. Make sure your source code has no schema specific information (i.e. looking for Bible schema but not finding it in a topx/notx file).

 

4. If the above checks out, figure out what part of the topx/notx schema or encoding type is tripping your program.

 

It could be the module that isn't opening has a different UTF encoding (UTF 8 vs 16, for example?)

 

I know of several ways to create a sqlite database with sql statements that will prevent a sqlite utility program (for another Bible software) from opening the database. It involves splitting some statements across multiple lines. I reported it so the author could fix it. Just shows how the schema or the original sql statements used to construct the database could be affecting something...? This theory may prove true especially if your program cannot open the topx/notx files, but a sqlite database editor can. 

 

5. The xmal error seems odd to me, not really knowing what, why, and how you're doing it. Is there XML code somewhere? What does it say...? Often choosing the path of least resistance, this is where I might try some other library for opening sqlite databases.



#3 TommyJSmithJr

TommyJSmithJr

    New to Bible Support

  • Members
  • Pip
  • 14 posts
  • LocationGeorgia, United States
Offline

Posted 04 February 2014 - 04:59 PM

Josh,

 

Thanks for the suggestions, and sorry I did not include that relevant information.  

1.  No other application was connected.

2.  I was able to open all test .topx and .notx files and see content with the FireFox SQLite Manager extension.

3.  The error occurs when the connection.open statement is executed and before any schema access is done (the C# exception caught is "File Format Not Supported.")

 

Based on that information I am guessing that a open parameter specifying encryption, or block formatting is the issue.  Looking at the first 100 bytes in hex starts off the same (Sqlite3, etc.), but then both .topx and .notx changes.  I started looking at the DB setting options specified by SQLite.org and soon realized it would take some time to test options, so I though someone else might have experienced the same problem already and solved it.  

 

Let me know if you have more suggestions.

THX



#4 BH.

BH.

    Utility Developer

  • Contributors
  • PipPipPipPipPip
  • 1,244 posts
  • LocationCalifornia
Offline

Posted 04 February 2014 - 09:29 PM

There should be no difference in opening a BBLX file and a TOPX file.  I do nothing special in opening or creating either of these file types.  There are premium TOPX file from e-Sword which are encrypted.  But if you are not accessing one of those, but a user created module, then that should not be an issue. 

 

I am curious why Compress=True; is needed, not knowing the .Net way your SQLite library works.



#5 TommyJSmithJr

TommyJSmithJr

    New to Bible Support

  • Members
  • Pip
  • 14 posts
  • LocationGeorgia, United States
Offline

Posted 04 February 2014 - 10:40 PM

Brent,

 

I very much appreciate your response because I know your tool works.  In the initial connection string I set when opening AKJV-Red Letter.bblx used Compress=True (a required parameter [True/False]) was successful, so I never changed it.  I did try setting it to False, without success.  

 

VB/C# - 

After looking through the registry, I found the setting for e-Sword in the "VB and VBA Program Settings" section, so I now know for certain that Rick Meyers use Visual Basic to program e-Sword.  Would you mind telling me what you used to write Tooltip NT and which SQLite library?

 

There seems to be some incompatibility between the SQLite library I am using and files created by e-Sword.  I can write in VB easier the C#, so I might switch.  From looking in some of the files of e-Sword it looks like Rick might be using the SQLitePlus library.  I was attempting to use all Open Source for my application, but I may change.

 

Any comments or ideas are most welcome.



#6 BH.

BH.

    Utility Developer

  • Contributors
  • PipPipPipPipPip
  • 1,244 posts
  • LocationCalifornia
Offline

Posted 04 February 2014 - 11:19 PM

I write in APL, specifically, APL+Win.  The SQLite "interface" I use is, < drum roll >, the SQLite3 Command Line Shell, http://www.sqlite.com/download.html

 

I have also used EzTools SQLitePlus which is an ActiveX control, and have had no problem with it.  I have some hooks in ToolTip Tool which allows for "by record" editing of a database which I have not released into the wild. 

 

Do note, I am not a professional programmer.



#7 TommyJSmithJr

TommyJSmithJr

    New to Bible Support

  • Members
  • Pip
  • 14 posts
  • LocationGeorgia, United States
Offline

Posted 05 February 2014 - 07:25 PM

Brent,

 

I will have to learn more about APL and interfacing with command line shell.  

 

HERE IS WHAT I HAVE LEARNED THE HARD WAY TODAY.

 

I REALLY wanted to know what was going on, I downloaded the source code for both the SQLite virtual database engine, and the client. 

https://code.google..../source/browse/

 

I successfully compiled and produce two DLLs, after more than a couple of Build errors.  I duplicated my test app I used when I got the errors before and used the newly created DLLS.  I was able to open and read the same .BBLX bible I did before, after a few syntax errors calling the new object models, but it worked JUST FINE!

 

Then when I tried to open a .Topx file I got a very specific error (at least one benefit of building from the ground up) -->

The error was "File Type UTF-16le not supported."  So I learned that e-Sword creates UTF-16-LE encoded databases.

 

I am now fighting between wrapping the Command Line you use [IF YOU WILL PLEASE SHARE ANY PARAMETERS FOR READING/WRITING SUCCESSFULLY TO .TOPX FILES] and seeing if the UTF-16le error is from incorrect connection string parameters.

 

While I can share all the info on getting the source code compiled, the code is a couple of years old and I did find out that more work had been done after the Google guys ported the older library from SQLite.com.

 

I REALLY wished I had known this before building Sqlite from source.  Hopefully the next person will read this before diving in.

 

Thanks for Sharing about APL though!

 

p.s. - It is confirmed the Google source code does not support UTF-16 per the website.

Attached Files

  • Attached File  lib.png   43.05K   7 downloads

Edited by TommyJSmithJr, 05 February 2014 - 07:55 PM.


#8 BH.

BH.

    Utility Developer

  • Contributors
  • PipPipPipPipPip
  • 1,244 posts
  • LocationCalifornia
Offline

Posted 05 February 2014 - 07:55 PM

Here is a code snippet out of T4 for getting the data out of and putting data into an SQLite3 database:

 

[39]  :case 'Dump'
[40]      (cmd file)←2↑rarg
[41]      temp_path←DATAPATH
[42]      ∆path←(↑temp_path) ⎕chdir temp_path ⍝ save current path
[43] 
[44]      :try
[45]          ext←⌽'.Before ⌽ file
[46]          tmpTmpFile ext
[47]          rc←0 NCopy file tmp
[48]          :if 0=rc
[49]              rc←'Copy Error' 'xWMsg 'Unable to create temporary SQL dump file' 'Quit'
[50]              →0
[51]          :end
[52] 
[53]          DeleteFile 'dump.sql'
[54]          script←'.output dump.sql',⎕tcnl,⎕tclf,'.dump',⎕tcnl,⎕tclf,'.quit',⎕tcnl,⎕tclf
[55]          script NSave 'script'
[56]          cmdlinesqlite3,' ',tmp,' < script'
[57]          3 ⎕cmd ⎕←cmdline
[58]  ⍝        ret←ReadHyperlink NRead 'dump.sql'
[59]          retNRead 'dump.sql'
[60]      :catchall
[61]          'Error' 'xWMsg ⎕dm 'Quit'
[62]          ret←''
[63]      :finally
[64]          DeleteFile ¨ 'script' 'dump.sqltmp
[65]          (↑∆path) ⎕chdir ∆path
[66]      :end
[67]  :case 'CreateDB'
[68]      :try
[69]          (cmd path file sql)←4↑rarg
[70]          ∆path←(↑DATAPATH) ⎕chdir DATAPATH
[71] 
[72]          name←⌽'.After ⌽file
[73] 
[74]          sql NSave name,'.sql'
[75] 
[76]          :if ~IsFile 'sqlite3.exe⍝ should be there if setup correctly.
[77]              NCopy (ExePath,'\sqlite3.exe') ('sqlite3.exe')
[78]          :end
[79] 
[80]          sqlDLTB name,'.sql'
[81]          file←'"',file,'"'
[82]          sql←'"',sql,'"'
[83]          cmdline←'sqlite3 ',file,' < ',sql
[84]          :if 20000<⍴cmdline
[85]              'Command Line Too Long' '!WMsg ('Length: ',⍕⍴cmdline) 'Quit'
[86]          :else
[87]              DeleteFile filefile~'"'
[88]              3 ⎕cmd cmdline
[89]              :if IsFile file
[90]                  rc←0 NCopy file (path,'\',file)
[91]                  :if 0=rc
[92]                      'Unable to move file' 'xWMsg ('From:' ,(DATAPATH,'\',file),⎕tcnl,⎕tcnl,'To: ',(path,'\',file)) 'Quit'
[93]                  :else
[94]                      :if BATCHMODE=0
[95]                         'File Created' 'iWMsg (path,⎕tcnl,file) 'OK'
[96]                      :end
[97]                      DeleteFile file
[98]                  :end
[99]              :else
[100]                 'Failed to Create File' 'xWMsg file 'Quit'
[101]             :end
[102]         :end
[103]     :catchall
[104]         'ErrorWMsg ⎕dm 'Quit'
[105]     :finally
[106]         DeleteFile sql~'"'
[107]         (↑∆path) ⎕chdir ∆path
[108]     :end
[109]
[110]     BUILD←path,'\',file
[111]
[112]     :if INSTALL
[113]     :andif 'X'=CharUpper ¯1↑BUILD
[114]         1 Shell BUILD
[115]     :end
[116] 

 

Note - the BBCode is generated by T4! :-)



#9 TommyJSmithJr

TommyJSmithJr

    New to Bible Support

  • Members
  • Pip
  • 14 posts
  • LocationGeorgia, United States
Offline

Posted 06 February 2014 - 07:22 AM

Problem SOLVED!

 

I appreciate all the help from everyone, particularly Brent!  I am writing a wrapper for the sqlite3 command shell, as I am able to access the test files now!!

 

Let me know if anyone is writing in C# and I will share the wrapper I am writing.

 

Tom






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users




Similar Topics



Latest Blogs