← Back to team overview

tomdroid-dev team mailing list archive

tomdroid's storage-redesign && what do we want to keep in the database as a note?


hi guys,

Just working on reviewing some code for tomdroid and it got me thinking
about something I would like to ask people with tomboy experience.

Let me explain quickly.

There is this hack we do right now in the storage-redesign branch[1] to
re-create XML tags after we parse them in a note. The deal is we want to
parse the xml tags except the ones in <note-content>..</note-content> so we
store XML in our sqlite database for the note-content portion and parse it
again on the fly when a Note is viewed.

I _really_ find it disgusting, it looks like:

String tag = "<";

if (uri != null) {
    if (uri.equals(NS_LINK)) {
        tag += PREFIX_LINK+":";
    } else if (uri.equals(NS_SIZE)) {
        tag += PREFIX_SIZE+":";

tag += localName+">";

for open tags and close ones inside of a focused xml class.

Now, (and here is where I need your experience), I was thinking about 2
potentials solutions here (aside from the fact that we might just be
misusing Java's XML parsing lib):

1- store the whole note instead of just note-content in the database
This way we won't lose addins metatags, full note encryption support will be
possible, etc. Also, parsing the few lines of metadata on each load won't be
that big of a penalty since its the note's content that is always the

2- Forget about xml parsing just regexp out the note-content portion then
parse the rest of the note. Or just use an xml lib that allows to extract
part of the raw xml structure (or find the way to do it in Sax).

I prefer #1 but I'm thinking maybe there are major roadblocks to this
solution that I don't foresee.

What does the tomboy people think?

If I'm not clear enough, ask questions i'll readjust.

Thanks for your time.
Olivier Bilodeau <olivier@xxxxxxxxxxxxxxxxx>

Follow ups