Hi,

I'm having trouble working with ids.  I've read the doc and browsed a bit through the newsgroups but don't understand how I'm supposed to do my binding to reference an object by its id that is defined in the xml document.

I get the following error when trying to compile my mapping:

[jibx-binding] org.jibx.runtime.JiBXException: No mapping defined for java.lang.String used as IDREF target
[jibx-binding]  at org.jibx.binding.def.ValueChild.setLinkages(ValueChild.java:638)
[jibx-binding]  at org.jibx.binding.def.NestedStructure.setLinkages(NestedStructure.java:241)
[jibx-binding]  at org.jibx.binding.def.ElementWrapper.setLinkages(ElementWrapper.java:439)
[jibx-binding]  at org.jibx.binding.def.NestedStructure.setLinkages(NestedStructure.java:241)
[jibx-binding]  at org.jibx.binding.def.ElementWrapper.setLinkages(ElementWrapper.java:439)
[jibx-binding]  at org.jibx.binding.def.NestedStructure.setLinkages(NestedStructure.java:241)
[jibx-binding]  at org.jibx.binding.def.ElementWrapper.setLinkages(ElementWrapper.java:439)
[jibx-binding]  at org.jibx.binding.def.NestedStructure.setLinkages(NestedStructure.java:241)
[jibx-binding]  at org.jibx.binding.def.PassThroughComponent.setLinkages(PassThroughComponent.java:140)
[jibx-binding]  at org.jibx.binding.def.ObjectBinding.setLinkages(ObjectBinding.java:752)
[jibx-binding]  at org.jibx.binding.def.PassThroughComponent.setLinkages(PassThroughComponent.java:140)
...

My mapping is the following:

************************************
...
                <structure name="delivery" get-method="getDelivery" set-method="setDelivery" type="Delivery" usage="optional">
                    <structure name="Delivery" usage="optional">
                        <value style="attribute" name="id" get-method="getId" set-method="setId"/>
                        <value name="nbrCopies" get-method="getNbrCopies" set-method="setNbrCopies" usage="optional"/>
                        <value name="deliveryTo" get-method="getDeliveryTo" set-method="setDeliveryTo" usage="optional"/>
                        <structure name="deliveryType" type="DeliveryType">
                            <structure name="DeliveryType">
                                <value style="attribute" name="refid" field="id" ident="ref"/>
                            </structure>
                        </structure>
                    </structure>
                </structure>
....

    <mapping name="DeliveryType" class="DeliveryType">
        <value style="attribute" name="id" field="id" ident="def"/>
        <value name="name" get-method="getName" set-method="setName"/>
    </mapping>
*************************************

Here is the necessary information of my classes:

public class Delivery {
...
    private DeliveryType deliveryType;
    public DeliveryType getDeliveryType() {
        return this.deliveryType;
    }

    public void setDeliveryType(DeliveryType value) {
        this.deliveryType = value;
    }
...
}

public class DeliveryType {
    private java.lang.String id;

    public java.lang.String getId() {
        return this.id;
    }
    public void setId(java.lang.String value) {
        this.id = value;
    }

    private java.lang.String name;
    public java.lang.String getName() {
        return this.name;
    }
    public void setName(java.lang.String value) {
        this.name = value;
    }
}
------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to