Castor is not putting HashMap 'key' information as attribute as
configured in the mapping file.

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 );

Yet Castor still has the XSI & Namespaces still generated! This gives
large marshall/unmarshall timings for Castor compared to Jibx!

XML:

<?xml version="1.0" encoding="UTF-8"?>
<AsClient>
    <Sex>M</Sex>
    <DateOfBirth>1973-09-09T00:00:00.000-04:00</DateOfBirth>
    <TypeCode>02</TypeCode>
    <TaxID>123421342</TaxID>
    <FirstName>Howard</FirstName>
    <MiddleInitial>D</MiddleInitial>
    <CompanyName/>
    <LastName>Kim</LastName>
    <Fields>
        <entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
            xsi:type="java:org.exolab.castor.mapping.MapItem">
            <key xsi:type="java:java.lang.String">AgentNumber</key>
            <value xsi:type="AsClientField">
                <FieldTypeCode>02</FieldTypeCode>

<ClientGUID>08250B8D-2F22-4834-A995-F414194EA8D4</ClientGUID>
                <FieldName>AgentNumber</FieldName>
            </value>
        </entry>
        <entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
            xsi:type="java:org.exolab.castor.mapping.MapItem">
            <key xsi:type="java:java.lang.String">MaritalStatus</key>
            <value xsi:type="AsClientField">
                <TextValue>00</TextValue>
                <FieldTypeCode>02</FieldTypeCode>

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

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


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

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

Reply via email to