Giter VIP home page Giter VIP logo

camunda-spin's Introduction

camunda-spin

Home | Documentation | Forum | Issues | License | Contribute

Library for simple XML and JSON processing on the JVM (Java Virtual Machine), targeting Java and JVM-based scripting languages such as Groovy, JRuby, Jython, Javascript and Java Expression Language.

Why Spin?

Spin is useful when you need to work with complex, text-based data formats (such as XML or JSON) without mapping to Java Objects.

Spin provides a comprehensible fluent API for working with different data formats through lightweight wrapper objects:

Given the following XML document as String or InputStream:

<?xml version=“1.0“ encoding=“UTF-8“ ?>
<customers>
  <customer id="0001"><name>Jonny P</name></customer>
  <customer id="0002"><name>Bobby G</name></customer>
  <customer id="0003"><name>Mary T</name></customer>
</customers>

It can directly be worked on with Spin:

import static org.camunda.spin.Spin.*;

// get id of first customer
XML( xmlInput ).childElements("customer")
  .get(0)
  .attr("id")
  .value();

// create new customer
SpinXmlTreeElement  kate = XML( "<customer />" )
  .attr("id", "0004")
  .append( XML("<name>Kate S</name>") );

// append to existing list
XML( xmlInput ).append(kate);

// query by Id:
XML( xmlInput ).xPath("/customers/customer[@id='0002']").element();

FAQ

Why should I use Spin instead of the Java DOM API?

Java provides a built-in Dom API along with a Parser. Spin provides a lightweight Wrapper around the Dom API which makes it easier to work with than the Dom API. You can access the underlying Dom object at any time by unwrapping it:

Element e = XML( xmlSource ).childElement("customer").unwrap();

Contributing

Have a look at our contribution guide for how to contribute to this repository.

License:

The source files in this repository are made available under the Apache License Version 2.0.

camunda-spin's People

Contributors

attoken avatar berndruecker avatar cmur2 avatar dependabot-preview[bot] avatar dependabot-support avatar hawky-4s- avatar ingorichtsmeier avatar koevskinikola avatar marstamm avatar mboskamp avatar mburke84 avatar menski avatar meyerdan avatar rbraeunlich avatar romansmirnov avatar sdorokhova avatar shannoncolavita avatar stefanzilske avatar tasso94 avatar thorbenlindhauer avatar tmetzke avatar yanavasileva avatar zambrovski avatar

Watchers

 avatar

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.