Fork me on GitHub

Welcome to XMLBeam

An XML library for Java, but a really cool one.

If you are new here, please read the introduction. Are you in a hurry? Read the the tutorials!

This is how it looks

<xml>
   <example>
      <content>bar</content>
   </example>
</xml>

Use XPath based collection types to directly read and change the XML DOM tree:

{  
    // Read xml file
    CloseableMap<String> map = new XBProjector().io().file("example.xml").bindAsMapOf(String.class);
     
    // Get content via XPath
    String content = map.get("/xml/example/content"); // "bar"
     
    // Create new attribute "type"
    map.put("/xml/example/content/@type", "foo");
     
    // Apply changes to the file
    map.close();
}

The result looks like this:

<xml>
   <example>
      <content type="foo"> bar </content>
   </example>
</xml>

Learn more.

Project status

Codeship Status

2017-10-31

  • Bugfix release 1.4.14. Fixed support for return type Optional (Java 8).

2017-07-27

2017-06-17

2017-05-20

2017-02-18

2016-10-28

2016-03-13

  • New release 1.4.8 with a small error message enhancement. See the release notes.

2015-05-03

  • New release 1.4.7 with some bugfixes and enhanced Java 8 support. See the release notes.

2015-01-13

  • New release 1.4.6 with additional evaluation API. See the release notes.

2015-01-03

2014-12-14

2014-12-08

  • New release 1.4.3. XMLBeam jars are now OSGI Bundles. See the release notes.

2014-11-25

2014-11-06

  • New release 1.4.1 with cool error handling feature: Let projection methods throw exceptions. See the release notes.

2014-10-13

2014-09-12

  • New release 1.3.0 with enhancements on Java 8 support and changes in type conversion defaults. See the release notes.

2014-05-17

  • New release 1.2.1 with new full XPath gaining update mode. See the release notes.

2014-04-28

  • New release 1.2.0 to ease handling of single quotes in XPaths. See the release notes.

2014-04-15

2014-04-14

2014-04-01

  • New release 1.1.2 with supercool automatic type conversion (see here).

2014-03-27

  • New release 1.1.1 with Java 8 support for projection behaviour.

2014-03-26

2014-03-06

  • Added section to the FAQ to explain how to use a different XPath implementation. (The same way can be be used to change the XML-Parser or DocumentBuilder.)

2014-02-21

2013-10-26

Over 6 months without a change, several productive usages without bug reports. Stable version 1.0 released in maven central repository.

2013-01-17

Snapshots are available in the sonatype snapshot repository. The I/O API has become more stable now. Preparing to have first release candidate soon.

2013-01-04

The project started in the end of 2012 and is currently still in the early publishing phase. Sources are hosted at Github, continuous integration is done by Jenkins at a private location. Snapshot and pre-release artifacts will be located at Sonatype soon. Until release of version 1.0, the XMLBeam API could keep changing. So the first deployment version to central repository will be 1.0.