Skip to content

askeron/fluentxmlwrapper

Repository files navigation

CI License Maven Central Required Java 8.0

fluentxmlwrapper

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.

Maven dependency

<dependency>
    <groupId>de.drbunsen.common</groupId>
    <artifactId>fluentxmlwrapper</artifactId>
    <version>0.5.0</version>
</dependency>

Snapshots

Add the following repository to use snapshots.

Maven

<repository>
    <id>sonatype-snapshots</id>
    <name>Sonatype Snapshots</name>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</repository>

Gradle (Groovy)

repositories {
    mavenCentral()
    maven {
        url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
}

Gradle (Kotlin)

repositories {
    mavenCentral()
    maven {
        setUrl("https://oss.sonatype.org/content/repositories/snapshots/")
    }
}

Example

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);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages