Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/evant/fasax

The fastest way to unmarshall XML to Java on Android
https://github.com/evant/fasax

Last synced: about 1 month ago
JSON representation

The fastest way to unmarshall XML to Java on Android

Awesome Lists containing this project

README

        

fasax
=====

The fastest way to unmarshall XML to Java on Android.

Note: This project is far from complete, but can unmarshell simple xml
documments.

Unlike other implementations, this libary generates SAX parsing code at compile
time. This makes it's performace virtually the same as a handwritten SAX parser.
Annotations are inspired from [Simple XML](http://simple.sourceforge.net/).

Example
-------

```xml

Agile Analytics
Agile Analytics Software Licences™
Cloud Big Data Management
JVMXMLRPP
Addition as a Service


Vendelín Gamil
Senior Architect
2010-12-01


Huw Andrea
Junior Architect
2013-06-12


Benjy Teodors
Head Senior Architect
2011-10-24

```

```java
@Xml
pubic class Enterprise {
@Element
public String corperation;

@Element(name="software-license")
public SoftwareLicense softwareLicense;

@ElementList(entry="software", inline=true)
public List software;

@ElementList(entry="employee")
public List employees;

@Xml
public static class SoftwareLicense {
@Attribute
public String type;

@Attribute
public String year;

@Text
public String name;
}

@Xml
public static class Employee {
@Element
public String name;

@Element
public String title;

@Converter(DateConverter.class)
@Element(name="date-started")
public Date dateStarted;
}
}
```

```java
Fasax fasax = new Fasax();
InputStream in = getXmlInputStream();
Enterprise enterprise = fasax.fromXml(in, Enterprise.class);
```

TODO
----
- Allow use of setters instead of public fields
- Write XML
- Namespaces
- Split compile-time and runtime dependencies