A Java library for easy XML processing.
This software is part of the Shredzone Commons.
- 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
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.
- Fork the Source code at GitHub. Feel free to send pull requests.
- Found a bug? File a bug report!
commons-xml is open source software. The source code is distributed under the terms of GNU Lesser General Public License Version 3.