net.markenwerk:utils-json-handler-xml

XML handler for JSON processing libraries for Java

License

License

Categories

Categories

Net JSON Data
GroupId

GroupId

net.markenwerk
ArtifactId

ArtifactId

utils-json-handler-xml
Last Version

Last Version

2.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

net.markenwerk:utils-json-handler-xml
XML handler for JSON processing libraries for Java
Project URL

Project URL

https://github.com/markenwerk/java-utils-json-handler-xml
Project Organization

Project Organization

Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH
Source Code Management

Source Code Management

https://github.com/markenwerk/java-utils-json-handler-xml

Download utils-json-handler-xml

How to add to project

<!-- https://jarcasting.com/artifacts/net.markenwerk/utils-json-handler-xml/ -->
<dependency>
    <groupId>net.markenwerk</groupId>
    <artifactId>utils-json-handler-xml</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/net.markenwerk/utils-json-handler-xml/
implementation 'net.markenwerk:utils-json-handler-xml:2.0.1'
// https://jarcasting.com/artifacts/net.markenwerk/utils-json-handler-xml/
implementation ("net.markenwerk:utils-json-handler-xml:2.0.1")
'net.markenwerk:utils-json-handler-xml:jar:2.0.1'
<dependency org="net.markenwerk" name="utils-json-handler-xml" rev="2.0.1">
  <artifact name="utils-json-handler-xml" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.markenwerk', module='utils-json-handler-xml', version='2.0.1')
)
libraryDependencies += "net.markenwerk" % "utils-json-handler-xml" % "2.0.1"
[net.markenwerk/utils-json-handler-xml "2.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
net.markenwerk : utils-json-handler jar 2.0.1

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.xmlunit : xmlunit-core jar 2.3.0

Project Modules

There are no modules declared in this project.

XML handler for JSON libraries

Build Status Coverage Status Dependency Status Maven Central Issues MIT License

Overview

This library provides XML related JSON handlers for other JSON processing libraries.

Consult the documentation and the usage description for further information:

Maven

This library is hosted in the Maven Central Repository. You can use it with the following coordinates:

<dependency>
	<groupId>net.markenwerk</groupId>
	<artifactId>utils-json-handler-xml</artifactId>
	<version>2.0.1</version>
</dependency>

Usage

XML document handler

A XmlDocumentJsonHandler is a JsonHandler that creates a XML Document, that represents the described JSON document, using the following rules:

  • A JSON array is represented as a tag with name array.
  • A JSON object is represented as a tag with name object.
  • A JSON object entry is represented as a tag with name entry.
  • The name of a JSON object entry is represented as an attribute of the entry tag with name name.
  • A JSON null is represented as a tag with name null.
  • A JSON boolean is represented as a tag with name boolean.
  • The value of the JSON boolean represented as an attribute of the boolean tag with name value.
  • A JSON number is represented as a tag with name number.
  • The value of the JSON boolean represented as an attribute of the number tag with name value.
  • A JSON string is represented as a tag with name string.
  • The value of the JSON boolean represented as an attribute of the string tag with name value.
// a JsonDocument
JsonDocument document = ...

// returns a xml document  
Document xmlDocument = document.handle(new XmlDocumentJsonHandler());

The returned XML Document for the example.json has the following content:

<?xml version="1.0" encoding="UTF-8"?>
<object>
   <entry name="null">
      <null />
   </entry>
   <entry name="boolean">
      <boolean value="true" />
   </entry>
   <entry name="longValue">
      <number value="-42" />
   </entry>
   <entry name="double">
      <number value="-23.42" />
   </entry>
   <entry name="array">
      <array>
         <string value="foo" />
         <string value="bar" />
      </array>
   </entry>
</object>
net.markenwerk

Markenwerk

Versions

Version
2.0.1
2.0.0
1.0.0