Evernote Data Handling
Overview
Best practices for handling Evernote data including ENML content processing, attachment management, local database sync, and ENEX export/import.
Prerequisites
- Understanding of Evernote data model (Notes, Notebooks, Tags, Resources)
- Database for local storage (SQLite, PostgreSQL, etc.)
- File storage for attachments
Instructions
Step 1: Data Schema Design
Design a local database schema that mirrors Evernote's data model. Key tables: notes (guid, title, content, notebookGuid, created, updated, USN), notebooks (guid, name, stack), tags (guid, name), resources (guid, noteGuid, mime, hash, size). Track Update Sequence Numbers (USN) for incremental sync.
CREATE TABLE notes (
guid TEXT PRIMARY KEY,
title TEXT NOT NULL,
content TEXT,
notebook_guid TEXT REFERENCES notebooks(guid),
created BIGINT,
updated BIGINT,
usn INTEGER DEFAULT 0
);
Step 2: ENML Content Processing
Parse ENML to extract plain text (strip tags), convert to HTML (replace with , resolve to / tags), or convert to Markdown. Validate ENML before sending to the API by checking for required declarations and forbidden elements.