Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML serialization in Java? [closed]

What is the Java analogue of .NET's XML serialization?

like image 601
Dmitry Shechtman Avatar asked Aug 30 '08 08:08

Dmitry Shechtman


People also ask

What is XML serialization in Java?

Serialization of Java Objects to XML can be done using XMLEncoder, XMLDecoder. Java Object Serialization feature was introduced in JDK 1.1. Serialization transforms a Java object or graph of Java object into an array of bytes which can be stored in a file or transmitted over a network.

Is serialization removed in Java?

The former reference link to the "Java Object Serialization" (JDK 8) document will be removed from java.io 's package documentation. In addition to the java.io package documentation that is being updated in JDK 11 related to the dangers of Java deserialization, the java. io.

Can Jackson parse XML?

Jackson is a library for handling JSON in Java systems and now has support for XML from version 2. DOM4J is a memory-efficient library for parsing XML, XPath, and XSLT (eXtensible Stylesheet Language).

What is wrong with Java serialization?

For almost all other uses, the drawbacks you (and the article) mentions are too big: the exact format is hard to keep stable, class changes can easily make your serialized data unreadable, reading/writing the data in non-Java code is almost impossible (or at least a lot harder than necessary).


1 Answers

2008 Answer The "Official" Java API for this is now JAXB - Java API for XML Binding. See Tutorial by Oracle. The reference implementation lives at http://jaxb.java.net/

2018 Update Note that the Java EE and CORBA Modules are deprecated in SE in JDK9 and to be removed from SE in JDK11. Therefore, to use JAXB it will either need to be in your existing enterprise class environment bundled by your e.g. app server, or you will need to bring it in manually.

like image 164
Cheekysoft Avatar answered Oct 03 '22 07:10

Cheekysoft