Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrserverless/dropwizard-xml
Dropwizard bundle for processing and validating XMLs
https://github.com/mrserverless/dropwizard-xml
Last synced: about 2 months ago
JSON representation
Dropwizard bundle for processing and validating XMLs
- Host: GitHub
- URL: https://github.com/mrserverless/dropwizard-xml
- Owner: mrserverless
- License: apache-2.0
- Archived: true
- Created: 2014-01-07T15:13:17.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2018-12-30T11:38:26.000Z (about 6 years ago)
- Last Synced: 2024-05-19T05:39:59.293Z (8 months ago)
- Language: Java
- Homepage:
- Size: 290 KB
- Stars: 32
- Watchers: 4
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-dropwizard - dropwizard-xml - Dropwizard bundle for processing and validating XMLs (Open Source / Eclipse)
README
# Dropwizard XML Bundle
[![Build Status](https://snap-ci.com/yunspace/dropwizard-xml/branch/master/build_image)](https://snap-ci.com/yunspace/dropwizard-xml/branch/master)
[![Download](https://api.bintray.com/packages/yunspace/dropwizard/dropwizard-xml/images/download.svg)](https://bintray.com/yunspace/dropwizard/dropwizard-xml/_latestVersion)[Dropwizard](https://github.com/dropwizard/dropwizard) extension for high performance processing and validation of XML.
Uses:
* [Jackson XML Provider](https://github.com/FasterXML/jackson-jaxrs-xml-provider) Jackson XML Provider with woodstox under the hood.
* [Hibernate Validator](http://hibernate.org/validator/) same Dropwizard validation behvaiour for XML![IntelliJ IDEA Ultimate](images/icon_IntelliJIDEA.png) Coded with IntelliJ IDEA
## Status
This project is built using [Snap-CI](https://www.snap-ci.com/) to enable [Continuous Delivery](http://www.thoughtworks.com/continuous-delivery).
There are no mysterious snapshots, every time the tests pass a new release tagged and uploaded to bintray, so you know exactly what you are pulling down.Until 0.9.0, all versions are are pegged against Dropwizard's release number and try to use the same Jackson dependency to avoid conflicts.
See above badges for latest version to use. The table below give an indication of dependencies:| Dropwizard-XML | Dropwizard | Jackson | Woodstox | Stax |
| ---------------- | -------------- | --------- | -------- |------ |
| 0.7.1-X | 0.7.1 | 2.3.3 | 4.1.4 | 3.1.1 |
| 0.8.0-X | 0.8.0 | 2.5.1 | transitive |
| 0.8.1-X | 0.8.1 | 2.5.2 | transitive |
| 0.9.0-X | 0.9.0 | 2.6.3 | transitive |After 0.9.0, the Dropwizard and Jackson dependencies are no longer bundled with this library. They are specified as
gradle `compileOnly` scope (`provided` scope in Maven). It is up to you to provide the correct Dropwizard version
and Jackson version combination in your classpath:| Dropwizard-XML | Provide Dropwizard | Provide Jackson |
| ---------------- | ------------------ | ---------------- |
| 39 | 0.9.1, 0.9.2 | 2.6.3 |
| 39 | 0.9.3 | 2.6.7 |
| 41+ | 1.0.0+ | 2.7.5+ |See [dependencies](#Dependencies) below fore more details.
## Dependencies
Dropwizard XML Provider is hosted by [Bintray JCenter](https://bintray.com/bintray/jcenter).You can add the dependency to your project by Maven:
jcenter
http://jcenter.bintray.com
com.yunspace.dropwizard
dropwizard-xml
${dropwizardXmlVersion}
compile
io.dropwizard
dropwizard-core
1.0.0-rc4
compile
com.fasterxml.jackson.jaxrs
jackson-jaxrs-xml-provider
2.7.5
compile
com.fasterxml.jackson.dataformat
jackson-dataformat-xml
2.7.5
compile
Or Gradle:repositories {
jcenter()
mavenCentral()
}
dependencies {
compile "com.yunspace.dropwizard:dropwizard-xml:${dropwizardXmlVersion}"
compile "io.dropwizard:dropwizard-core:1.0.0-rc4"
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-xml-provider:2.7.5"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.7.5"
}
If you are using versions lesser than Dropwizard `1.0.0` and Jackson `2.7.5` you need to add [jackson-datatype-jdk7](https://github.com/FasterXML/jackson-datatype-jdk7)Maven:
com.fasterxml.jackson.datatype
jackson-datatype-jdk7
2.6.7
compile
Gradle:
compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk7:2.6.7"
## Usage
Add the XMLBundle
bootstrap.addBundle(new XmlBundle());
Annotate your Resources:
@Produces(MediaType.APPLICATION_XML) @Consumes(MediaType.APPLICATION_XML)
Annotate your model POJO with jackson-dataformat-xml bindings:
@JacksonXmlRootElement @JacksonXmlProperty @JacksonXmlElementWrapper @JacksonXmlText
Use validation/ignore annotations as you would normally:
@NotNull @Min @JsonIgnore
## Advanced Usage
You can further custom the behaviour of your XML Mapper by passing in a JacksonXmlModule:
bootstrap.addBundle(new XmlBundle(jacksonXmlModule));
Or enable various serialisation/deserialisation features
XmlBundle indentXmlBundle = new XmlBundle();
indentXmlBundle.getXmlMapper().enable(SerializationFeature.INDENT_OUTPUT);
bootstrap.addBundle(indentXmlBundle);##Sample project
See [dropwizard-xml-example](https://github.com/yunspace/dropwizard-xml/tree/master/dropwizard-xml-example) subproject.## TODO
Add support for [aalto](https://github.com/FasterXML/aalto-xml)