XML serialization/deserialization in Cobalt Java module
I'm working on a Cobalt module that will be interfacing with some another Cobalt module that uses an XML format for its requests rather than the traditional JSON. So, we'll be deciding on which XML serializer/deserializer we'll be using for this. The workflow here is a the typical "Request POJO to request XML, and then response XML to response POJO" sequence. It's been a few years since I've done non-trivial XML-to-object-and-back-again processing on the JVM. While I do know the usual suspects for this task, I'm curious what might be new. What libraries have people had success with here? Anything particularly good or cool? We're running JDK 7 and Groovy 2.something. Simply using Groovy's XML writing/reading classes is a tempting possibility here.
Tagged:
0
Answers
-
Hi Brian. If by 'usual suspects' you mean JAXB, then it's the de-facto standard for Java XML serialisation and version 2.2.4-1 comes bundled with JDK7 -> [
https://jaxb.java.net/guide/Which_JAXB_RI_is_included_in_which_JDK_.html][1] A popular alternative is [JiBX][2] which seems to have generated a lot of traction mainly due to its simplicity. Some of its benefits are: - Export JavaDocs as schema documentation - Support both untyped and typed (Java 5) collection classes - Support both custom typesafe enumerations and Java 5 enums - Provide easy control over attribute vs. element, required vs. optional - Clean schema structure, with customizations for fine-grained control I think either would be a good fit for what you are after, it comes down to which one you're more comfortable working with. For me, the major benefit of JiXB is that it doesn't pollute your domain objects with annotations as opposed to JAXB. [1]:
https://jaxb.java.net/guide/Which_JAXB_RI_is_included_in_which_JDK_.html [2]:
http://jibx.sourceforge.net/2 -
Yes, JAXB is a usual suspect. I wasn't aware of JiBX, that looks promising.0
-
Posting some other information folks gave me offline: There's been positive experiences with [XStream][1], a BSD-licensed library. Also, [here's a reasonable comparison][2] of JAXB/JiBX focusing on performance. [1]:
http://xstream.codehaus.org/index.html [2]:
http://kentorjava.com/2012/03/07/walk-through-jaxb-and-jibx/0 -
In a past project (at another company) we used JiBX with the Spring Web Services project. The entire development staff was pleased with it. JiBX was pretty simple to use and maintain.1
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛