The following issue has been updated:

    Updater: Martin Vachon (mailto:[EMAIL PROTECTED])
       Date: Thu, 2 Dec 2004 12:07 PM
    Comment:


First of all I am very satisfied with the JiBX binding library !

I need to know if there is a possibility to populate a collection
by using reference (ident="ref" and ident="def")

I have been able to populate a field using a reference with no problem
but the only way I found to populate a collection by reference was by 
creating a wrapper object, so I populate the only field of the wrapper 
with a reference and create a collection to this wrapper object...

Even if it works, the solution is not acceptable for our project because we do
not wish to modify the java classes.

Here I'm sending you a modified version of the tutorial no 5.
In attachement you'll see the complete code I use for testing.
By reading the previous messages I think I'm not the first one 
to encounter this problem. Maybe by sending a complete example 
someone will have a better idea of what the problem is ((-;


Our Configuration:
-------------------
jibx-beta3c (also tried cvs version)
java version "1.4.2_04"


Thanks in advance, and i'll be watching for any suggestions.

==================== binding.xml (START) ==========================
    <mapping name="timetable" class="example5b.TimeTable">
        <collection name="carriers" field="carriers"/>
        <collection name="airports" field="airports"/>
        <collection name="flights" field="flights"/>

        <structure name="route" field="route" type="example5b.Route">
            <value name="from" style="attribute" field="from" ident="ref"/>
            <value name="to" style="attribute" field="to" ident="ref"/>

            <collection name="flights" field="flights">
                <structure name="flight" type="example5b.Flight">

-------------------------------------------------------------------
- The value element with the ident attribute generates the error
- org.jibx.runtime.JiBXException: 
- No mapping defined for java.lang.Object used as IDREF target
-------------------------------------------------------------------

                    <value name="refid" style="attribute" field="id" 
ident="ref"/>
                </structure>
            </collection>

        </structure>
    </mapping>
    <mapping name="carrier" class="example5b.Carrier">
        <value style="attribute" name="code" field="code" ident="def"/>
        <value style="attribute" name="rating" field="rating"/>
        <value name="url" field="url"/>
        <value name="name" field="name"/>
    </mapping>
    <mapping name="airport" class="example5b.Airport">
        <value style="attribute" name="code" field="code" ident="def"/>
        <value name="location" field="location"/>
        <value name="name" field="name"/>
    </mapping>
    <mapping name="flight" class="example5b.Flight">
        <value name="id" style="attribute" field="id" ident="def"/>
        <value name="carrier" style="attribute" field="carrier" ident="ref"/>
        <value name="number" style="attribute" field="number"/>
        <value name="depart" style="attribute" field="departure"/>
        <value name="arrive" style="attribute" field="arrival"/>
    </mapping>
====================== binding.xml (END) ==========================


====================== data.xml (START) ==========================
    <carriers>
        <carrier code="NL" rating="4">
            <url>http://www.northleft.com</url>
            <name>Northleft Airlines</name>
        </carrier>
        <carrier code="CL" rating="9">
            <url>http://www.classyskylines.com</url>
            <name>Classy Skylines</name>
        </carrier>
    </carriers>
    <airports>
        <airport code="BOS">
            <location>Boston, MA</location>
            <name>Logan International Airport</name>
        </airport>
        <airport code="SEA">
            <location>Seattle, WA</location>
            <name>Seattle-Tacoma International Airport</name>
        </airport>
        <airport code="LAX">
            <location>Los Angeles, CA</location>
            <name>Los Angeles International Airport</name>
        </airport>
    </airports>
    <flights>
        <flight id="01" carrier="CL" number="796" depart="4:12a" 
arrive="1:26a"/>
        <flight id="02" carrier="NL" number="328" depart="2:54a" 
arrive="1:29a"/>
        <flight id="03" carrier="CL" number="401" depart="4:12a" 
arrive="1:25a"/>
        <flight id="04" carrier="CL" number="634" depart="7:43a" 
arrive="9:13a"/>
        <flight id="05" carrier="NL" number="508" depart="4:38p" 
arrive="6:12p"/>
        <flight id="06" carrier="CL" number="687" depart="1:38p" 
arrive="3:08p"/>
    </flights>
    <route from="BOS" to="SEA">
        <flights>
            <flight refid="01"/>
            <flight refid="02"/>
            <flight refid="03"/>
        </flights>
    </route>
======================= data.xml (END) ===========================
    Changes:
             Attachment changed to srcTest.zip
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://jira.codehaus.org/browse/JIBX-19?page=history

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/JIBX-19

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: JIBX-19
    Summary: NullPointerException in ident="ref" within collection
       Type: Bug

     Status: Open
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: JiBX
 Components: 
             core
   Versions:
             1.0-beta3b

   Assignee: Dennis Sosnoski
   Reporter: Falk Langhammer

    Created: Wed, 12 May 2004 11:48 AM
    Updated: Thu, 2 Dec 2004 12:07 PM
Environment: JDK 1.4.2

Description:
java.lang.NullPointerException
at org.jibx.binding.def.PropertyDefinition.getName(PropertyDefinition.java:308)
at org.jibx.binding.def.ValueChild.createBackfillClass (ValueChild.java:185)
at org.jibx.binding.def.ValueChild.genParseIdRef(ValueChild.java:282)
at org.jibx.binding.def.ValueChild.genUnmarshal(ValueChild.java:400)
at org.jibx.binding.def.ValueChild.genContentUnmarshal(ValueChild.java:587)
at 
org.jibx.binding.def.NestedCollection.genContentUnmarshal(NestedCollection.java:130)
at 
org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:611)
at 
org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:723)
...
occurs with the following binding excerpt:
<mapping name="form" class="com.livis.xforms.desc.Form">
   <collection name="constraints" field="constraints"/>
   <value name="typeref" field="typeref" usage="optional"/>
   <collection field="constraintrefs">
      <value name="constraint-ref" type="com.livis.xforms.desc.Type" 
ident="ref"/>
   </collection>
   <structure field="layout" usage="optional"/>
</mapping>
<mapping name="type" class="com.livis.xforms.desc.Type">
   <value name="name" field="name" ident="def" style="attribute"/>
</mapping>
...
This makes it impossible to unmarshall a list of pointers.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
jibx-devs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to