dev@jaxb.java.net

Re: Might need to write a custom plugin

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 2 Sep 2015 14:55:59 +0200

I'd try the JAXB2 Simplify Plugin first:
https://github.com/highsource/jaxb2-basics/wiki/JAXB2-Simplify-Plugin

On Wed, Sep 2, 2015 at 1:42 PM, <pablogh_2000_at_hotmail.com> wrote:

> Hi all,
>
> I have an schema with the following element:
>
> ...
> <xsd:complexType name="AggregationNode">
> <xsd:complexContent>
> <xsd:extension base="avqsq:Item">
> <xsd:sequence>
> <xsd:maxOccurs="unbounded" minOccurs="0" name="positions"
> type="xsd:IDREF"/>
> </xsd:sequence>
> ....
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
> ...
>
> Which the jaxb code generator converts into:
>
> public class AggregationNode
> ...
> @XmlElementRef(name = "positions", type = JAXBElement.class,
> required = false)
> protected List<JAXBElement<Object>> positions;
>
> while I want this:
>
> public class AggregationNode
> ..
> @XmlIDREF
> protected List<Position> positions;
>
> I haven't found a way to do this with bindings, so I thought that maybe
> the way to go is to build a plugin.
>
> Before, I embark into this task, I thought it would be good check here
> first as suggested in the main plugin development main page.
>
> Thanks,
>
> Pablo.
>