Reputation: 18597
I have a Java class for which I want to create an XML schema -
class Person {
String name;
Locale locale;
}
The name element can be defined as xsd:string
type and mapping using JAXB is straightforward.
What is the good approach to represent the Locale
class and how do I map it using JAXB?
Upvotes: 1
Views: 739
Reputation: 149017
You can use a JAXB XmlAdapter
To convert an unmappable class into a mappable one for the purposes of marshalling/unmarshalling.
For More Information
Upvotes: 2
Reputation: 12398
The only state that you need to persist from Locale
are the language, country and variant.
<locale>
<language>en</language>
<country>US</country>
<variant/>
</locale>
Upvotes: 1