Shredzone Commons: XML

Shredzone Commons: XML parsing

License

License

GNU Lesser General Public License Version 3
GroupId

GroupId

org.shredzone.commons
ArtifactId

ArtifactId

commons-xml
Last Version

Last Version

1.2
Release Date

Release Date

Type

Type

jar
Description

Description

Shredzone Commons: XML
Shredzone Commons: XML parsing
Project URL

Project URL

http://commons.shredzone.org
Source Code Management

Source Code Management

https://github.com/shred/commons-xml/

Download commons-xml

How to add to project

<!-- https://jarcasting.com/artifacts/org.shredzone.commons/commons-xml/ -->
<dependency>
    <groupId>org.shredzone.commons</groupId>
    <artifactId>commons-xml</artifactId>
    <version>1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.shredzone.commons/commons-xml/
implementation 'org.shredzone.commons:commons-xml:1.2'
// https://jarcasting.com/artifacts/org.shredzone.commons/commons-xml/
implementation ("org.shredzone.commons:commons-xml:1.2")
'org.shredzone.commons:commons-xml:jar:1.2'
<dependency org="org.shredzone.commons" name="commons-xml" rev="1.2">
  <artifact name="commons-xml" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.shredzone.commons', module='commons-xml', version='1.2')
)
libraryDependencies += "org.shredzone.commons" % "commons-xml" % "1.2"
[org.shredzone.commons/commons-xml "1.2"]

Dependencies

provided (1)

Group / Artifact Type Version
com.google.code.findbugs : jsr305 jar 3.0.2

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest jar 2.1
org.mockito : mockito-core jar 2.23.4

Project Modules

There are no modules declared in this project.

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.

Versions

Version
1.2
1.1
1.0