Hi Pablo,
there is an error in your XSD syntax…
I’m sure you mean
<xsd:element maxOccurs….
Plus, if you are using the JAXB reference implementation, you should be able to force XJC into generating the property with the correct type by adding an annotation (binding cutomization):
<xsd:element maxOccurs='unbounded' minOccurs="0“ name="positions“ type="xsd:IDREF“>
<xsd:annotation>
<xsd:appInfo>
<jaxb:property>
<jaxb:baseType name="AuthorBio "/>
</jaxb:property>
</xsd:appInfo>
<xsd:annotation>
<xsd:element>
You need to make sure that the JAXB namespace xmlns:jaxb="
http://java.sun.com/xml/ns/jaxb“ is properly imported and that the jaxb:version and extensionElementPrefixes=„jaxb“ properties are present.
Regards, Mirko
> Am 2015-09-02 um 13:42 schrieb <pablogh_2000_at_hotmail.com> <pablogh_2000_at_hotmail.com>:
>
> 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.
- application/pkcs7-signature attachment: smime.p7s