Skip to Content

Serialization in Java ?

Are there libraries in Java that could be used for serialization of binary data (variables, objests, ...) into XML ? Is it fast and generic, as ABAP id transformation ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Oct 19, 2006 at 09:30 AM


    there is a standard built-in way to serialize objects in java to a binary format - just implement the serializable interface. That could be used for example for storing/loading objects/variable in the file system. Here is more info :

    However if you are looking for mapping objects to XML, there is something standard called "Java Architecture for XML Binding" or JAXB for short. The latest version of JAXB (2.0 I think) is provided in the latest released SAP NetWeaver server as part of Java EE 5 - here are some links :

    sun home page for jaxb :

    SAP support for JEE 5 and hence JAXB 2.0

    jee" target="_blank">">jee [original link is broken] [original link is broken]



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Srdjan Boskovic


      I am not an expert on this one, but I hope some thoughts/comments could be helpful.

      The typical use of the XML is to serve as exchange format between two systems or modules - for example you are transferring data according to some schema from java to a .NET application.

      So the JAXB will hide the mapping for you and generate a java object out of the schema. So you invoke only pure java code and do not bother with the XML, parsing, validation,etc.

      The earlier JAXB-s used schema as input and generated an object only. Judging by your posts, you already have the objects and want to achieve some XML presentation. That is possible with the latest JAXB - 2.0, that I have told you already.

      However to do so you must put "hints" for the framework as annotations (something like comments the field declaration ) in your object what exactly should go as property, what as tag, etc.

      I.e. you will have to put something like :


      String myField;

      If that is not what you are looking for, you could make your object serializable by implementing the interface (check the first posting), and then manually create the XML with DOM/SAX and achieve a very basic XML of the format

      <MyObject mySerializedBinaryStream="01010008889ffff"/>

      There as well many open third party libarires, a simple google search of "java object to XML" would give you a lot, but I would go for the standards if I were you.