<commit_before>---
layout: post
title: Test
---
Information on the root XML element is required when **marshalling to** or **unmarshalling from** a Java object. JAXB provides this information via the `@XmlRootElement` annotation which contains the name and namespace of the root XML element.

When trying to marshal a class which does not have a `@XMLRootElement` annotation defined, following error will be thrown: "*unable to marshal as an element because it is missing an @XmlRootElement annotation*". Alternatively when trying to unmarshal, the Java runtime will report that an "*unsuspected element*" is found.

For this example let's use following class representing a car with a basic structure. Note that a `XmlRootElement` is not defined!

~~~ java
package com.codenotfound.jaxb.model;
<commit_msg>Changed title<commit_after>---
layout: post
title: JAXB - Marshal Element Missing @XmlRootElement Annotation
---
Information on the root XML element is required when **marshalling to** or **unmarshalling from** a Java object. JAXB provides this information via the `@XmlRootElement` annotation which contains the name and namespace of the root XML element.

When trying to marshal a class which does not have a `@XMLRootElement` annotation defined, following error will be thrown: "*unable to marshal as an element because it is missing an @XmlRootElement annotation*". Alternatively when trying to unmarshal, the Java runtime will report that an "*unsuspected element*" is found.

For this example let's use following class representing a car with a basic structure. Note that a `XmlRootElement` is not defined!

~~~ java
package com.codenotfound.jaxb.model;

{'fraction_non_alphanumeric': 0.0647870425914817, 'fraction_numerical': 0.0, 'mean_word_length': 5.1098901098901095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2406967', 'n_tokens_mistral': 421, 'n_tokens_neox': 405, 'n_words': 232}