Hi,

I am experiencing strange behavior of the container attribute (yes, I have read the 
FAQ ;-), when the field is a collection="array". Can you please suggest a solution?

I understand from the FAQ, that if I don't specify the "container" attribute, then:
1. The collection field will be treated like a container (not marshaled into XML) AND
2. The collection elements will not be treated like containers (will be marshaled).

My field which is a collection="array" is marshaled into XML even when I don't specify 
the container attribute.

Can you please help out?

Gory details follow (the problem is the "value" tag which according to my 
understanding of documentation shouldn't be there:

Mapping:
<?xml version="1.0" encoding="UTF-8"?>
<mapping>
    <class name="PRMSG.PricingMessage" auto-complete="false">
        <description>Default mapping for class PRMSG.PricingMessage</description>
        <map-to xml="outputMessage"/>
        (...) here go the following fields: msgType, msgNumber, msgText, msgAirlineCode
    </class>
    <class name="PRMSG.PricingMessageSeqHolder" auto-complete="true">
        <description>Default mapping for class 
PRMSG.PricingMessageSeqHolder</description>
        <map-to xml="PricingMessageSeqHolder"/>
        <field  name="value" 
                        type="PRMSG.PricingMessage" 
                        direct="true" 
                        collection="array">
                <bind-xml name="value"/>
        </field>
    </class>    
</mapping>

The classes look like this:

public final class PricingMessageSeqHolder implements org.omg.CORBA.portable.Streamable
{
  public PRMSG.PricingMessage value[] = null;
(...)
}

public final class PricingMessage implements org.omg.CORBA.portable.IDLEntity
{
  public char msgType = (char)0;
  public short msgNumber = (short)0;
  public char msgAirlineCode[] = null;
  public String msgText = null;
} 

CASTOR generates the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<PricingMessageSeqHolder>
        <value>
                <msgType>A</msgType>
                <msgNumber>12</msgNumber>
                <msgText>msgText content</msgText>
                <msg-airline-code> KRK</msg-airline-code>
        </value>
        <value>
                <msgType>B</msgType>
                <msgNumber>23</msgNumber>
                <msgText>msgText content1</msgText>
                <msg-airline-code> LHW</msg-airline-code>
        </value>
</PricingMessageSeqHolder>

Thanks,

Michal

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to