Adam,

Thank you for your prompt reply.

Kindly read inline comments.

On Fri, 2006-01-13 at 02:02 -0500, Adam Kramer wrote:
> Hi Sandeep,
> 
> Read Below...
> 
> Sandeep Khanna wrote:
> 
> > Castor is not putting HashMap 'key' information as attribute as
> > configured in the mapping file.
> >
> I'm not positive this will work, but try taking the type attribute off 
> the Map collection field. For instance, without the type attribute in 
> the 'fields' field:
> <field name="fields" collection="map">

This is what I have now:

<Fields>
    <entry>
        <key>AgentNumber</key>
        <value>
            <FieldTypeCode>02</FieldTypeCode>

<ClientGUID>08250B8D-2F22-4834-A995-F414194EA8D4</ClientGUID>
            <FieldName>AgentNumber</FieldName>
        </value>
    </entry>
    <entry>
        <key>MaritalStatus</key>
        <value>
            <TextValue>00</TextValue>
            <FieldTypeCode>02</FieldTypeCode>

<ClientGUID>08250B8D-2F22-4834-A995-F414194EA8D4</ClientGUID>
            <FieldName>MaritalStatus</FieldName>
        </value>
    </entry>
</Fields>


And, this is what I want it to be:

<Fields size="2">
    <entry key="AgentNumber">
        <AsClientField>

<ClientGUID>08250B8D-2F22-4834-A995-F414194EA8D4</ClientGUID>
            <FieldName>AgentNumber</FieldName>
            <FieldTypeCode>02</FieldTypeCode>
        </AsClientField>
    </entry>
    <entry key="MaritalStatus">
        <AsClientField>

<ClientGUID>08250B8D-2F22-4834-A995-F414194EA8D4</ClientGUID>
            <FieldName>MaritalStatus</FieldName>
            <TextValue>00</TextValue>
            <FieldTypeCode>02</FieldTypeCode>
        </AsClientField>
    </entry>
</Fields>

> 
> > In order for the generated XML to be Jibx compliant (this is for
> > comparing Castor & Jibx marshall/unmarshall similar documents)
> >
> > Also, the following code was generated with:
> > Marshaller marshaller = new Marshaller( new
> > FileWriter( "AsXml-Castor.xml", false ) );
> > marshaller.setMapping( mapping );
> > marshaller.setSuppressNamespaces( false );
> > marshaller.setSuppressXSIType( false );
> > marshaller.marshal( clientDcl );
> 
> If you are trying to suppress XSI types and namespaces, you should be 
> setting those to true, not false, so:
> marshaller.setSuppressNamespaces( true );
> marshaller.setSuppressXSIType( true );

I haven't tried that yet. But, it makes more sense than what I had.

All that staring at the screen all day just got to me.

> 
> >
> > Mapping file:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <mapping>
> > <!--
> > =================================================================== -->
> > <!-- Mapping for class com.adminserver.dcl.ClientDcl
> > -->
> > <!--
> > =================================================================== -->
> > <class name="com.adminserver.dcl.ClientDcl" identity="clientGuid"
> > access="shared"
> > auto-complete="false">
> > <field name="lastName" type="string" get-method="getLastName"
> > set-method="setLastName">
> > <bind-xml name="LastName" node="element"/>
> > </field>
> > <field name="fields" type="com.adminserver.dcl.ClientFieldDcl"
> > get-method="getFields"
> > set-method="setFields" collection="map">
> > <bind-xml name="entry" node="element" location="Fields">
> > <class name="org.exolab.castor.mapping.MapItem">
> > <field name="key" type="java.lang.String">
> > <bind-xml name="key" node="attribute"/>
> > </field>
> > <field name="value"
> > type="com.adminserver.dcl.ClientFieldDcl">
> > <bind-xml name="value"/>
> > </field>
> > </class>
> > </bind-xml>
> > </field>
> > </class>
> > <!--
> > =================================================================== -->
> > <!-- Mapping for class com.adminserver.dcl.ClientFieldDcl
> > -->
> > <!--
> > =================================================================== -->
> > <class name="com.adminserver.dcl.ClientFieldDcl"
> > identity="clientGuid fieldName" access="shared"
> > auto-complete="false">
> > <description>AsClientField</description>
> > <cache-type type="count-limited"/>
> > <map-to table="AsClientField" xml="AsClientField"/>
> > <field name="clientGuid" type="string"
> > get-method="getClientGuid" set-method="setClientGuid">
> > <bind-xml name="ClientGUID" node="element"/>
> > </field>
> > <field name="fieldName" type="string" get-method="getFieldName"
> > set-method="setFieldName">
> > <bind-xml name="FieldName" node="element"/>
> > </field>
> > <field name="textValue" type="string" get-method="getTextValue"
> > set-method="setTextValue">
> > <bind-xml name="TextValue" node="element"/>
> > </field>
> > <field name="fieldTypeCode" type="string"
> > get-method="getFieldTypeCode"
> > set-method="setFieldTypeCode">
> > <bind-xml name="FieldTypeCode" node="element"/>
> > </field>
> > </class>
> > </mapping>
> >
> > Any ideas?
> >
> > --Sandeep Khanna
> >
> Best,
> Adam

--Sandeep Khanna

> 
> -------------------------------------------------
> If you wish to unsubscribe from this list, please 
> send an empty message to the following address:
> 
> [EMAIL PROTECTED]
> -------------------------------------------------
> 


-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to