Simple XML reader for Java
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
.gitlab-ci.yml
.project
LICENSE-LGPL.txt
README.md
pom.xml

README.md

commons-xml build status

A Java library for easy XML processing.

This software is part of the Shredzone Commons.

Features

  • Lightweight, very simple and comprehensible API
  • No bells and whistles, no namespaces, no validation, just plain XML parsing
  • Use XPath expressions for selecting the XML parts you want to read
  • Use streaming API and lambda expressions to process the XML data

Quick Start

A very simple use case is reading text from a configuration file. This is the XML file to be read:

<config>
  <foo1>Hello</foo1>
  <foo2>World</foo2>
</config>

This is the program code:

XQuery xq = XQuery.parse(new FileReader("config.xml"));
String foo1 = xq.text("/config/foo1"); // Hello
String foo2 = xq.text("/config/foo2"); // World

That's all!

But commons-xml offers a lot more possibilities. Just see the online documentation for more examples.

Contribute

License

commons-xml is open source software. The source code is distributed under the terms of GNU Lesser General Public License Version 3.