Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pvdlg/enml4j
Simple utility to handle ENML (Evernote Markup Language) in Java.
https://github.com/pvdlg/enml4j
enml evernote-markup-language evernote-sdk java
Last synced: about 1 month ago
JSON representation
Simple utility to handle ENML (Evernote Markup Language) in Java.
- Host: GitHub
- URL: https://github.com/pvdlg/enml4j
- Owner: pvdlg
- Created: 2013-03-22T07:14:54.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-29T01:02:30.000Z (over 10 years ago)
- Last Synced: 2024-08-01T19:47:12.498Z (3 months ago)
- Topics: enml, evernote-markup-language, evernote-sdk, java
- Language: Java
- Size: 646 KB
- Stars: 22
- Watchers: 5
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ENML4j
======Simple utility classes to handle ENML (Evernote Markup Language) in Java.
Overview
--------
ENML4j provide a convenient way to:* Convert a `Note` ENML content to an HTML file referencing `Resource`s as configurable URL
* Convert a `Note` ENML content to an HTML file with inline `Resource`s as Data URI
* Replace `Resource` references in `Note` ENML content with new `Resources`
* Delete `Resource` references in `Note` ENML content
* Add `Resource` references in `Note` ENML contentENML4j is design to be simple, customizable and to produce valid XHTML.
ENML4j uses stAX to parse ENML and write XHTML.Getting started
-----
Converting a Notes ENML content to XHTML is as simple as:```java
ENMLProcessor = new ENMLProcessor();
FileOutputStream fos = new FileOutputStream("/path/to/file.html");
ENMLProcessor.noteToInlineHTML(note, fos);
```The best way to start is to look at [enml4j-sample](https://github.com/vanduynslagerp/enml4j-sample)
### Including the SDK in your project
The easiest way to incorporate the SDK into your Java project is to use Maven. If you're using Maven already, simply add a new dependency to your `pom.xml`:
```xml
com.syncthemall
enml4j
1.1.0```
If you'd prefer to build the jar yourself, it's as simple as running
```bash
$ mvn package
```You'll find `enml4j-1.1.0.jar` in the target directory after the build completes. This single JAR contains everything needed to use the API.
### Dependencies
You'll also need to be sure to include in your classpath a stAX implementation and [evernote-sdk-java](https://github.com/evernote/evernote-sdk-java)
User Guide
-------------
### ENMLProcessorThis is the entry point of ENML4j. This class should be instantiated and kept in reference (as a static for example) for better performances. When
converting a `Note` to HTML the Evernote DTD has to be parsed the first time, then stays in memory. Parsing the DTD the first time is time-consuming.This class rely on stAX to convert ENML to HTML. ENML4j will uses the default stAX implementation on the platform. Implementation can be easily chosen : [StAX Factory Classes]
(http://docs.oracle.com/javaee/5/tutorial/doc/bnbem.html#bnbeo)This class is thread-safe as long as the stAX implementation of `XMLInputFactory`, `XMLOutputFactory`, `XMLEventFactory` are thread-safe. Almost all implementation of this classes are thread-safe.
### Customize the conversion
ENML4j rely on `Converter`s classes to convert specifics ENML tags to an HTML equivalent. Default `Converter`s are provided and instantiated by default.
* `DefaultNoteTagConverter`
* `DefaultInlineMediaTagConverter`
* `DefaultTodoTagConverter`
* `DefaultCryptTagConverter`
* `DefaultInlineMediaTagConverter`For specifics needs `BaseConverter` and `MediaConverter` can be implemented and set with
`ENMLProcessor#setConverters(BaseConverter, MediaConverter, BaseConverter, BaseConverter)` and `ENMLProcessor#setInlineConverters(BaseConverter, MediaConverter, BaseConverter, BaseConverter)`.For more information on ENML see [Understanding the Evernote Markup Language](http://dev.evernote.com/start/core/enml.php)
Development
-----------
Any bug reported properly will be fixed.
Any features request will be taken under consideration.Potential future features:
* Convert ENML to PDF with [Flying Saucer](https://github.com/flyingsaucerproject/flyingsaucer)
* Convert ENML to Plain text
* Convert valid XHTML to ENML
* Convert "street HTML" to ENML (very unlikely considering the lack of Java HTML renderer)Change log
----------
### 1.1.0
* Bug fixes
* added method addNoteResources
* Evernote DTD and it's dependencies are now embedded in the library### 1.0.0
* Bug fixes
* Updated to Evernote SDK to version 1.25.1### 0.2.1
* New methods to update `Resource`s in `Note` ENML content, based on their hash value
* Minor code improvements### 0.2.0
* New methods to delete `Resource`s from `Note` ENML content
* Methods to update `Resource` in `No` ENML can now also delete
* Minor code improvements
### 0.1.1
* Mapping of external resources path now uses `String` instead of `URL`
* Methods returning `void` now return the variable in parameterLicense
-------
MIT*Free Software, Fuck Yeah!*
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/vanduynslagerp/enml4j/trend.png)](https://bitdeli.com/free "Bitdeli Badge")