Java Language JAXB

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

JAXB or Java Architecture for XML Binding (JAXB) is a software framework that allows Java developers to map Java classes to XML representations. This Page will introduce readers to JAXB using detailed examples about its functions provided mainly for marshaling and un-marshaling Java Objects into xml format and vice-versa.

Syntax

  • JAXB.marshall(object, fileObjOfXML);

  • Object obj = JAXB.unmarshall(fileObjOfXML, className);

Parameters

ParameterDetails
fileObjOfXMLFile object of an XML file
classNameName of a class with .class extension

Remarks

Using the XJC tool available in the JDK, java code for a xml structure described in a xml schema (.xsd file) can be automatically generated, see XJC topic.



Got any Java Language Question?