exporting xml file

GaryF
Posts: 26
Joined: Fri Jun 26, 2015 10:29 am
Contact:

exporting xml file

Postby GaryF » Mon Feb 20, 2017 1:00 pm

I have been trying to export the database as an xml file to put on my phone. I can do it easily, but so far 4 xml viewer apps have failed to read it, one of them saying "Unknown format"
Is there something else I need to do prior to export, or is there a way to export all notes to one large text file?
date
Posts: 243
Joined: Sat Aug 01, 2015 5:15 am
Contact:

Re: exporting xml file

Postby date » Mon Feb 20, 2017 8:18 pm

In the export dialog there are three radio buttons down on the left side and the lowest one says 'all,' and with that you can make one large text or html file.
Perhaps it would be great to find something that can read text that is seperated, and find multiple occurences at once, perhaps CHM or EDICT, or something else for which there is a reader on mobile.
date
Posts: 243
Joined: Sat Aug 01, 2015 5:15 am
Contact:

Re: exporting xml file

Postby date » Wed Feb 22, 2017 7:02 pm

I found out the mobile program 'OmniNotes' can import from Springpad archives, and a springpad archive apparently is a JSON file in a ZIP file. JSON is the same thing as XML just a little bit different, and I found an example here: https://github.com/springpartners/sprin ... xport.json. So all you need to do is just change the CintaNotes xml into a json file like in the example, and you can browse and search notes, and the program even has sections ('categories') and some kind of tag support, so that is much better than an XML browser or even a dictionary program. Here is how to make a springpad archive and make it appear in the Omninotes program:
1) Install autohotkey from https://autohotkey.com
2) Export your Cintanotes database to C:\cintanotes.xml, include every export field (but attachments are not neccessary.)
3) Paste these few lines in a file with a text editor and make the file have the extension .ahk:

Code: Select all

FileEncoding, UTF-8
FileRead, xml, C:\cintanotes.xml
pos := 1
FileAppend, [, C:\asdf.json

while pos := RegExMatch(xml, "\<note\suid\=\""(?P<noteuid>.{36})\""\stitle\=\""(?P<title>.*?)\""\screated\=\""(?P<created>.{15})\""\smodified\=\""(?P<modified>.{15})\""\ssource\=\""(?P<source>.*?)\""\slink\=\""(?P<link>.*?)\""\sremarks\=\""(?P<remarks>.*?)\""\stags\=\""(?P<tags>.*?)\""\s.*?section\=\""(?P<section>\d*?)\""(\splainText\=\""(?P<plaintext>.*?)\"")?\>(\n\t\t)*?\<\!\[CDATA\[(?P<cdata>.*?)\]\]\>(\n\t\t\<attachments\>\n\t\t\t.*?(\n\t\t\t.*?)*?\n\t\t.*?\n\t)*?\<\/note\>", out, pos + StrLen(out))
   {
   StringReplace, outtags, outtags, %A_SPACE%, "`,", All
   StringReplace, outcdata, outcdata, `n, <br>, All
   StringReplace, outcdata, outcdata, \, \\, All
   StringReplace, outcdata, outcdata, /, \/, All
   StringReplace, outcdata, outcdata, ", \", All
   StringReplace, outcdata, outcdata, `t, \t, All
   
   StringReplace, outtitle, outtitle, \, \\, All
   StringReplace, outtitle, outtitle, /, \/, All
   StringReplace, outtitle, outtitle, ", \", All
   StringReplace, outtitle, outtitle, `t, \t, All
   
   StringReplace, outcreated, outcreated, T,, All
   StringReplace, outmodified, outmodified, T,, All
   FormatTime, created, %outcreated%, yyyy-MM-ddTHH:mm:ss+0000
   FormatTime, modified, %outmodified%, yyyy-MM-ddTHH:mm:ss+0000
   
   FileAppend, `n  {`n  "tags":["%outtags%"]`,`n  "text":"%outcdata%"`,`n  "created":"%created%"`,`n  "name":"%outtitle%"`,`n  "notebooks":["%outsection%"]`,`n  "uuid":"%outnoteuid%"`,`n  "type":"Note"`,`n  "modified":"%modified%"`n  }`,,C:\asdf.json
}

pos := 1
while pos := RegExMatch(xml, "\<section\sid\=\""(?P<sectionid>\d*?)\""\snum\=\""\d*?\""\sname\=\""(?P<name>.*?)\""\scolor", out, pos + StrLen(out))
{
FileAppend, `n  {`n  "created":"2014-05-19T13:54:09+0000"`,`n  "name":"%outname%"`,`n  "uuid":"%outsectionid%"`,`n  "type":"Notebook"`,`n  "modified":"2014-05-20T17:58:16+0000"`n  }`,,C:\asdf.json
}

FileAppend, asdf, C:\asdf.json
FileRead, asdf, C:\asdf.json
asdf2 := RegExReplace(asdf, "\n(\s\s\}),asdf", "$1]")
FileAppend, %asdf2%, C:\export.json
FileDelete, C:\asdf.json

4) Rightclick the file you just made and click 'Run Script'
5) Now find the file C:\export.json, and place it in a .zip file
6) Transfer the .zip file to your phone.
7) Install Omninote from the google play store or from somewhere else.
8) Run it, and in the program, open the hamburger menu, click settings, data, backup, import notes from springpad
9) Browse to the zip file and it will import.

Easy and works! Just one-way though. But in just one of my sections it skipped a bunch of notes, can't figure out why. But it should work. Perhaps this is more useful for you, it certainly must be more usable than XML browser apps that don't work...
GaryF
Posts: 26
Joined: Fri Jun 26, 2015 10:29 am
Contact:

Re: exporting xml file

Postby GaryF » Thu Feb 23, 2017 6:40 am

This seems like a good idea but...No such thing on my computer as right click and run script. I've spent a long time trying to fathom this out to no avail. Maybe you've got something on yours that allows you to run scripts that a standard Win10 machine doesn't have?
date
Posts: 243
Joined: Sat Aug 01, 2015 5:15 am
Contact:

Re: exporting xml file

Postby date » Thu Feb 23, 2017 1:59 pm

The option should be there after you install Autohotkey. Did you manage to save the text in the block as an .ahk file and does it have the icon with the letter H?
I'll change a few things and make the steps easier when I have some spare time, perhaps tomorrow, but it really works. I'm happy I found out about this route myself. Every note seperated, browsing, searching, even sections... perfect. Just no two-way syncing. :)
User avatar
CintaNotes Developer
Site Admin
Posts: 4740
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: exporting xml file

Postby CintaNotes Developer » Fri Feb 24, 2017 8:43 am

Hi there,

date: thanks for your great efforts!

To the original idea: why not just use the Simplenote mobile app and built-in CintaNotes-Simplenote sync?
Note that since version 3.5 it is also available in the free version.
Alex
date
Posts: 243
Joined: Sat Aug 01, 2015 5:15 am
Contact:

Re: exporting xml file

Postby date » Fri Feb 24, 2017 10:59 am

Ok, very few steps now, and the links and remarks work now, I forgot those.

1) Export from Cintanotes to XML and pay attention to the options:
2017-02-24_11-40-19.png
2017-02-24_11-40-19.png (45.56 KiB) Viewed 1911 times

You can uncheck attachments and rules, but the rest is mandatory.

2) Download the zip file here: https://yadi.sk/d/wpWYxaFT3EWBGv and extract it. (If you don't extract it and just open, the included 7-zip will not work to make a zip file.)

3) Run the cn2springpad.exe. There is a file open dialog, navigate to where you saved the XML and open it.

4) In a few seconds, there is a export.zip file in the same place as the XML. This is the file to be copied to the phone.

5) Once you have the file on the phone, refer to https://www.youtube.com/watch?v=kzIoQacEi6I .

Easy enough?

CintaNotes Developer wrote:To the original idea: why not just use the Simplenote mobile app and built-in CintaNotes-Simplenote sync?
I am not comfortable storing passwords and other kind of things on Simplenote, I assumed GaryF has the same kind of reason.
User avatar
CintaNotes Developer
Site Admin
Posts: 4740
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: exporting xml file

Postby CintaNotes Developer » Wed Mar 01, 2017 10:25 am

date wrote:I am not comfortable storing passwords and other kind of things on Simplenote, I assumed GaryF has the same kind of reason.

Well I just wanted to make sure that GaryF knows about this alternative. Otherwise, he should definitely take your advice. Huge thanks for taking the time to help him (and other CN users that will be reading this topic later)!

Just one little remark - another option would be to export to HTML which might be easier to read on the mobile than XML. For the case if GaryF needs a read-only access to notes.
Alex

Return to “CintaNotes Personal Notes Manager”