users@jaxb.java.net

problems binding two elemenst with same name

From: Sánchez Lara, José Pablo <jpsanchez_at_indra.es>
Date: Mon, 12 May 2014 14:52:59 +0200

Hi, I not sure that this is the good place to post this issue, but after look for on the web https://java.net/projects/jaxb/, I don't have found a better place.

Well, I have an schema with two nested elements with the same name, one it is son from another.

Jvc don't show any error, but when I try to use the java object I found problems with a parent and a son with the same name.

When I try to use binding to solve the problem, jvc get a runtime error:
D:\PCBCK\Java\jaxb\jaxb-ri-2.2.7\samples\aod>xjc -nv -verbose messages.xsd -b bindingset.xml 1>resultado2.txt
Exception in thread "main" java.lang.IllegalArgumentException: Illegal class inheritance loop.
Outer class TargetSpeedElement may not subclass from inner class: TargetSpeedElement
       at com.sun.codemodel.internal.JDefinedClass._extends(JDefinedClass.java:257)
        at com.sun.tools.internal.xjc.generator.bean.ImplStructureStrategy$1._extends(ImplStructureStrategy.java:104)
        at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:197)
        at com.sun.tools.internal.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:151)
        at com.sun.tools.internal.xjc.model.Model.generateCode(Model.java:275)
        at com.sun.tools.internal.xjc.Driver.run(Driver.java:342)
        at com.sun.tools.internal.xjc.Driver.run(Driver.java:184)
        at com.sun.tools.internal.xjc.Driver._main(Driver.java:107)
        at com.sun.tools.internal.xjc.Driver.access$000(Driver.java:64)
        at com.sun.tools.internal.xjc.Driver$1.run(Driver.java:87)


As a example I show you the binding file that I try to use:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
                               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                               version="2.1" schemaLocation="sets.xsd">
    <bindings node="//xsd:schema/xsd:complexType[@name='TargetDesignationType']/xsd:complexContent/xsd:extension/xsd:sequence/xsd:element/xsd:complexType/xsd:choice/xsd:element[@name='TargetSpeed']">
        <class name="TargetSpeedElement"/>
    </bindings>
</bindings>



If I use the next bindings line in place that the previous one, I get the same runtime error:

    <bindings node="//xsd:schema/xsd:complexType[@name='TargetDesignationType']/xsd:complexContent/xsd:extension/xsd:sequence/xsd:element[@name='TargetSpeed']/xsd:complexType/xsd:choice/xsd:element[@name='TargetSpeed']">


Can anybody explain me how to deal with two elements with the same name to create a proper binding file?



Jose Pablo Sánchez Lara

MANDO Y CONTROL
C/ Joaquín Rodrigo 11
28300 - Aranjuez Madrid
España

T +34-91-894.89.99
F +34-91-892.22.17
jpsanchez_at_indra.es<mailto:jpsanchez_at_indra.es>
www.indra.es<http://www.indra.es>

[cid:image001.jpg_at_01CF6DF1.88D8CFD0]


________________________________
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Si no es vd. el destinatario indicado, queda notificado que la lectura, utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. En el caso de haber recibido este correo electrónico por error, se ruega notificar inmediatamente esta circunstancia mediante reenvío a la dirección electrónica del remitente.
Evite imprimir este mensaje si no es estrictamente necesario.

This email and any file attached to it (when applicable) contain(s) confidential information that is exclusively addressed to its recipient(s). If you are not the indicated recipient, you are informed that reading, using, disseminating and/or copying it without authorisation is forbidden in accordance with the legislation in effect. If you have received this email by mistake, please immediately notify the sender of the situation by resending it to their email address.
Avoid printing this message if it is not absolutely necessary.




image001.jpg
(image/jpeg attachment: image001.jpg)