Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/SvenEwald/xmlbeam

Java XML library. A really cool one. Obviously.
https://github.com/SvenEwald/xmlbeam

Last synced: about 2 months ago
JSON representation

Java XML library. A really cool one. Obviously.

Awesome Lists containing this project

README

        

XMLBeam

This is a Java XML library with an extraordinary expressive API.
By using XPath for read and write operations, many operations take only one line of Java code.
This is how it looks:

```XML


bar

```

Access XML content in an object oriented way:
```Java
public interface Example {

// This is a getter for the attribute "type"
@XBRead("/xml/example/content/@type")
String getType();

// This is a getter and a setter for the value of the element "content"
@XBAuto("/xml/example/content")
XBAutoValue content();
}

Example example = new XBProjector().io().file("example.xml").read(Example.class);
String type = example.getType(); // "foo"
String content = example.content().get(); // "bar"
example.content().set("new value");
```

Or, direct access via XPath enabled collection types:
```Java
Map map = new XBProjector().io().file("example.xml").readAsMapOf(String.class);
String type = map.get("/xml/example/content/@type");
String content = map.get("/xml/example/content");
map.put("/xml/example/content","new value");
```

Learn more on [xmlbeam.org](https://xmlbeam.org)