[ http://jira.codehaus.org/browse/JIBX-89?page=all ]
     
Dennis Sosnoski resolved JIBX-89:
---------------------------------

     Assign To: Dennis Sosnoski
    Resolution: Won't Fix

You just need to add a <structure> child to the collection, so that you can 
give a name to the component HexIDs:

        <collection field="hexes">
          <structure type="com.softstart.stellar.data.HexID" name="location"/>
        </collection>

I did find a couple of other issues in the binding. One was that you were 
(unintentionally, I'm sure) using the default char handling (which treats it as 
an unsigned short value). To make your AccessXML test code work I had to first 
add:

      <format type="char"
        serializer="org.jibx.runtime.Utility.serializeCharString"
        deserializer="org.jibx.runtime.Utility.deserializeCharString"/>

as a child of the <binding> element, in order to force handling of char values 
as single character strings rather than unsigned shorts. I also changed your 
StarSystem.deserializeMaybeEmptyZone() method to just return a char value:

    public static char deserializeMaybeEmptyZone(String text) throws 
JiBXException

    {

        if (text.length() == 0)

        {   

            return ' ';

        } 

        else 

        {

            return text.charAt(0);

        }    

    }


After these changes the test seemed to run okay.

> Trying to use a mapping as both a structure and a collection does not work. 
> ----------------------------------------------------------------------------
>
>          Key: JIBX-89
>          URL: http://jira.codehaus.org/browse/JIBX-89
>      Project: JiBX
>         Type: Bug

>   Components: Generator Tools
>  Environment: Windows 2K,  Oracle JDeveloper
>     Reporter: Thomas Jones-Low
>     Assignee: Dennis Sosnoski
>  Attachments: src.zip
>
>
> This affect RC2, I've attached the binding file, the source data files and 
> the example xml file. 
> I have a mapping (short version): 
>     <mapping class="com.softstart.stellar.data.HexID" 
> post-set="convertHextoID" abstract="true">
>         <value style="attribute" name="type" field="hexType" />
>         <value style="attribute" name="group" field="hexGroup" />
>         <value style="text" field="hex" />
>     </mapping> 
> I would like to use this mapping in two ways, as a structure in one mapping: 
>     <mapping name="system" class="com.softstart.stellar.data.StarSystem" 
> post-set="update">
>         <value style="attribute" name="id" field="key" />
>         <value style="attribute" name="provider" field="providerName" 
> usage="optional" />
>         <value name="name" field="name" />
>         <structure field="location" name="location"/>
>    </mapping>
> and as a collection of locations in another mapping: 
>     <mapping name="link" class="com.softstart.stellar.data.Links">
>         <structure map-as="com.softstart.stellar.data.Record" />
>         <collection field="hexes" 
> item-type="com.softstart.stellar.data.HexID"/>
>         <value style="attribute" name="linkType" field="linkTypeName" 
> usage="optional"/>
>     </mapping>
> In order for the second mapping to work (the links collection) I need to give 
> the HexID mapping a name attribute. But if I do so the system mapping fails 
> on reading, because it's now looking for a nested <location><location> tag. 

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to