← Back to team overview

tomdroid-dev team mailing list archive

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

 

On Tue, Nov 17, 2009 at 6:17 AM, Olivier Bilodeau
<olivier@xxxxxxxxxxxxxxxxx> wrote:
> 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+">";
> xmlContent.append(tag);

So do I, even though I wrote this (and I'm quite ashamed to admit it).
I'm pretty confident this will break as soon as it encounters
something not formatted like the Tomboy notes I have on my computer.
I'm saying this because I'm far from understanding the intricacies of
xml.

> 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
> biggest.

I'd be in favor of this solution, provided we do not find any blocker.
Xml is a complex beast and I'd sleep better at night knowing someone
knowledgeable about the format handles the decoding for us.

> 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 initially tried to extract the raw content between the note-content
tags with SAX and couldn't find any way to do it. But this could be
handy if we manage to do it, we get the best of both worlds: a tested
library to decode xml and parsing only what we need to show the note
content.

If I remember correctly, the regexp solution is the one used by Tomboy
in the web sync addin.

Cheers,
Benoit



Follow ups

References