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.

2022-09-04

  • New bugfix relaese 1.4.24: Fix tutorial after discontinued MSN weather service.

2022-04-17

  • New bugfix relaese 1.4.23: Thanks to Adrien Zaffran who found a bug in the packaging can result to a NPE.

2022-01-18

  • New release 1.4.22: Fix compatibility with Xalan when using Java 8. Support for Java 17. See the release notes

2022-01-15

  • New release 1.4.21: Bugfix for handling elements containing whitespace only. Enhanced support for Android JVMs. See the release notes
  • Java 17 breaks unit tests that depend on refelection in jdk classes.

2021-04-12

2021-03-31

  • New release 1.4.19: Support for more data types and new JDKs. See the release notes

2020-12-11

  • Bugfix release 1.4.18: Fixed exported packages for OSGI. See the release notes

2020-08-11

2018-06-07

  • Bugfix release 1.4.16: Fixed reading CDATA nodes and text nodes from XPath function text().

2018-04-15

  • Security bugfix release 1.4.15. Suppress unwanted entity expansion by default.

2017-10-31

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

2018-04-11

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.