Rama-

I believe elements are created in the order in which they are in the
mapping file.  So if you order the mapping file <field> elements
correctly (firstName, lastName, address, email), the XML should be
correct.

Stephen


On 2/15/06, Rama Konjeti <[EMAIL PROTECTED]> wrote:
> Does anybody know an answer to this?  If you need more explanation, I
> can provide more explanation on what the situation is.  I appreciate
> help on this issue.
>
> -----Original Message-----
> From: Rama Konjeti
> Sent: Tuesday, February 14, 2006 11:09 AM
> To: '[email protected]'
> Subject: When mapping is used for existing java code, is there a way to
> specify the order of xml elements being written out as part of
> marshalling?
>
> I have existing java code and I want to serialize them into xml using
> castor and mapping files.  But, xml that is being written out need to
> confirm to a given schema that has an order defined with <xsd:sequence>.
> Is there a way to specify that particular order in either mapping file
> or a separate file or provide a schema to use?
>
> For example, I have an existing java class Employee with 'FirstName',
> 'LastName', 'Address', 'Email'.
>
> Is there a way, I can specify that when Employee object is written out,
> use the following order?
>
> <xsd:sequence>
>         <xsd:element name="firstName" type="xsd:string"/>
>         <xsd:element name="lastName" type="xsd:string"/>
>         <xsd:element name="address" type="addressType"/>
>         <xsd:element name="email" type="xsd:string"/>
> </xsd:sequence>
>
> -------------------------------------------------
> If you wish to unsubscribe from this list, please
> send an empty message to the following address:
>
> [EMAIL PROTECTED]
> -------------------------------------------------
>
>

Reply via email to