<commit_before>camunda-spin
============

<p>
  <a href="http://camunda.org/">Home</a> |
  <a href="docs/index.md">Documentation</a> |
  <a href="http://camunda.org/community/forum.html">Forum</a> |
  <a href="https://app.camunda.com/jira/browse/CAM">Issues</a> |
  <a href="LICENSE">License</a> |
  <a href="CONTRIBUTING.md">Contribute</a>
</p>

Spin library for simple XML and JSON processing. TODO: add description

# Why Spin?

TODO: provide some snappy examples

# Documentation

The sources of the camunda spin documentation are located in the [docs folder](docs/index.md) of this repository.

# Contributing

camunda Spin is licensed under the Apache 2.0 License. Check [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines about how to contribute.<commit_msg>chore(README): add example<commit_after>camunda-spin
============

<p>
  <a href="http://camunda.org/">Home</a> |
  <a href="docs/index.md">Documentation</a> |
  <a href="http://camunda.org/community/forum.html">Forum</a> |
  <a href="https://app.camunda.com/jira/browse/CAM">Issues</a> |
  <a href="LICENSE">License</a> |
  <a href="CONTRIBUTING.md">Contribute</a>
</p>

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 and 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
<?xml version=“1.0“ encoding=“UTF-8“ ?>
<customers>
  <customer id="0001"><name><NAME></name></customer>
  <customer id="0002"><name><NAME></name></customer>
  <customer id="0003"><name><NAME></name></customer>
</customers>
```

It can directly be worked on with Spin:

```java
import 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><NAME></name>") );

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

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



# Documentation

The sources of the camunda spin documentation are located in the [docs folder](docs/index.md) 
of this repository.

# 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. At any time you can access the
underlying Dom object by unwrapping it: 

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

## How can I contribute to Spin?

Check [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines about how to contribute.

## What license is used by Spin?

camunda Spin is licensed under the Apache 2.0 License.
{'fraction_non_alphanumeric': 0.14702072538860103, 'fraction_numerical': 0.009067357512953367, 'mean_word_length': 4.555755395683454, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 1, '>': 53, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1132278', 'n_tokens_mistral': 1019, 'n_tokens_neox': 957, 'n_words': 329}