Skip to content

shred/commons-xml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

commons-xml build status maven central

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.