A java library with a simple wrapper for XML Processing with a fluent interface. In contrast to other similar project the interface follows the principle of clean code and can be used for reading and writing XML documents.
<dependency>
<groupId>de.drbunsen.common</groupId>
<artifactId>fluentxmlwrapper</artifactId>
<version>0.5.0</version>
</dependency>
Add the following repository to use snapshots.
<repository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
repositories {
mavenCentral()
maven {
setUrl("https://oss.sonatype.org/content/repositories/snapshots/")
}
}
final String newXml = FluentXmlWrapper.of(new File("text.xml"))
.getElement("devices")
.addElement("device")
.setAttribute("id", "41234")
.addElement("ipaddress").setText("192.168.0.123").getParentElement()
.addElement("ipaddress").setText("192.168.0.201").getParentElement()
.toXmlWithDefaultUtf8Header(false);