Giter VIP home page Giter VIP logo

FluentXML4J - a fluent API for XML in Java

Build Status Code Coverage Maven Central License

XML parsing, serialization XPath querying and transformation without boilerplate code

Features

  • Simple, fluent API but full flexibility
  • Parse from java.io inputs to org.w3c.dom.Document
  • Serialize org.w3c.dom.Document to any java.io output
  • Transform from java.io, SAX, StAX, JAXB input to any of them with XSLT and custom filters support
  • Query org.w3c.dom.Document via XPath for String, Boolean, Number, org.w3c.dom.Element or Node, get the results as collections or process with the Java 8 Streaming API
  • Validate document against schemas
  • No (required) dependencies

Requirements

FluentXML4J uses the builtin JDK XML parser and XPath API, but Java 8 is required because of streaming API and Optional support.

Maven Dependency

<dependency>
  <groupId>com.github.fluentxml4j</groupId>
  <artifactId>fluentxml4j-core</artifactId>
  <version>2.2.1</version>
</dependency>

Examples

Parsing

Document doc = parse(getClass().getResourceAsStream("example.xml"))
    .document();

More parsing examples...

Serialization

serialize(document).to(System.err);

More serialization examples...

Transformation

Document resultDoc = transform(inputDoc)
        .withStylesheet(xsltInputStream)
        .toDocument();

More transformation examples...

XPath Querying

List<Element> elements = from(doc)
    .selectElements("//*")
    .asList();

More xpath examples...

Similar and related Projects

  • xmltool - another fluent API for XML
  • dom4j - alternative DOM implementation
  • jdom - alternative DOM implementation
  • XMLDog - a XML stream sniffer

Contributing

FluentXML4J is an open source project, and contributions are welcome! Feel free to raise an issue or submit a pull request.

License

Copyright (c) 2017 by Cornelius Buschka.

Apache License, Version 2.0

fluentxml4j's Projects

fluentxml4j icon fluentxml4j

A fluent API for XML parsing, serialization, XPath querying and transformation in Java.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.