users@jaxb.java.net

Re: Supporting Property Aliases via a bindings file?

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Mon, 31 Mar 2014 09:57:04 +0200

Looks as if this describes the solution to your problem:

https://jaxb.java.net/tutorial/section_5_3-Overriding-Names.html#Overriding%20Names

Cheers
-W


On 28/03/2014, Eric Peters <Eric_at_peters.org> wrote:
> I have a situation where I have an XSD that has renamed an XML field
>
> <xs:element name="Foo">
>
> is now:
>
> <xs:element name="Bar">
>
> Same value/same meaning/etc.
>
> Ideally I don't want to generate two different sets of models for the two
> different XSDs/support reading the two different XML versions
>
> Is there a way to create an alias so I can still read older version of the
> XML and <Foo> will get read into the element Bar class that xjc generates?
> Unfortunately, I don't have control over the XSD that is generated, so I
> need to make any edits using a bindings file if possible.
>
> It seems like substitution group might along the lines of what I'm after,
> but not sure if I can do that with a bindings file & "inject" the old
> property into the generated code somehow.
>
> Thanks,
>
> Eric
>