vidal-community / atom-jaxb

Compliant Atom feeds with JAXB
MIT License
2 stars 2 forks source link
atom java jaxb xml

Atom JAXB

Atom JAXB is Java library focused on Atom 1.0 feed marshalling/unmarshalling.

Build Status Coverage Status Maven Central

What it does

Atom JAXB provides the standard Atom 1.0 JAXB beans you need as well as a simple extension mechanism, leveraging namespaces.

Indeed, the recommended approach is to extend standard Atom element with your own elements in your own namespaces (or other standard ones).

This can be done as follows:

    Feed feed = new Feed();
    // [...]
    Entry entry = new Entry();
    entry.addAdditionalElement(new SimpleElement(
        new Namespace("http://my.own.namespace", "my"),
        "custom",
        "42",
        Collections.emptyList()
    ));
    feed.addEntry(entry);

which roughly corresponds to:

    <?xml version="1.0" encoding="UTF-8"?>
    <feed xmlns="http://www.w3.org/2005/Atom">
        <entry>
            <!-- [...] -->
            <my:custom xmlns:my="http://my.own.namespace">42</my:custom>
        </entry>
    </feed>

What it does not (and will never do)

Atom JAXB is not designed with complex XML tree in mind. Instead, it emphasizes:

Benchmark

$> mvn package
$> java -jar benchmark/target/benchmarks.jar Marshaller