Home

JAXB

JAXB stands for Java Architecture for XML Binding. It is a Java API that provides a convenient framework for mapping between XML documents and Java objects. JAXB enables developers to define how Java classes correspond to XML schemas and to perform marshalling (converting Java objects to XML) and unmarshalling (converting XML to Java objects).

The API supports schema-derived binding, Java-to-XML binding, and XML-to-Java binding, along with a runtime library to

Historical context and current status: JAXB was part of the Java SE platform up to Java 8

perform
the
actual
marshalling
and
unmarshalling.
A
typical
workflow
involves
generating
Java
classes
from
an
XML
Schema
using
the
binding
compiler,
known
as
xjc,
and
then
using
a
JAXBContext
to
create
a
Marshaller
or
Unmarshaller
to
serialize
or
parse
XML.
JAXB
also
emphasizes
annotation-based
binding,
allowing
metadata
to
be
placed
directly
on
Java
classes
to
control
the
mapping.
Common
annotations
include
@XmlRootElement
to
designate
the
root
element,
@XmlType
and
@XmlAccessorType
to
control
how
fields
or
properties
are
bound,
and
@XmlElement
and
@XmlAttribute
to
map
members
to
XML
content
and
attributes.
and
Java
EE.
It
was
deprecated
in
Java
9
and
removed
from
the
standard
JDK
in
Java
11.
The
technology
continues
in
Jakarta
EE
as
Jakarta
XML
Bind
(jakarta.xml.bind),
under
the
Eclipse
Foundation,
with
the
API
and
runtime
namespaces
migrated
from
javax.xml.bind
to
jakarta.xml.bind.
Developers
using
newer
runtimes
typically
include
the
JAXB
API
and
implementation
from
the
Jakarta
namespace
as
dependencies.