Why use a mapping at all, given that the source generator (or XML code
generator, as it is formerly called) generates descriptor classes in
addition to the domain classes, and it's those descriptor classes that
replace a mapping file.

Werner

Schneiders, Bernd wrote:
> Hello,
> 
> I'm using the org.exolab.castor.builder.SourceGeneratorMain of Castor to
> generate classes from an *.xsd file.
> 
> When I marshal these classes by using a mapping file it works fine
> except the class StyleTypeSequence which is generated by following
> code-snippet:
> 
> ...
> <xs:complexType name="StyleListType">
>  <xs:sequence>
>   <xs:element name="Style" type="context:StyleType" minOccurs="0"
>               maxOccurs="unbounded"/>
>  </xs:sequence>
> </xs:complexType>
> <xs:complexType name="StyleType">
>   <xs:choice>
>     <xs:sequence>
>      <xs:element name="Name" type="xs:string"/>
>      <xs:element name="Title" type="xs:string"/>
>      <xs:element name="Abstract" type="xs:string" minOccurs="0"/>
>      <xs:element name="LegendURL" type="context:URLType" minOccurs="0"/>
>     </xs:sequence>
>     <xs:element name="SLD" type="context:SLDType" minOccurs="0"/>
>   </xs:choice>
>   <xs:attribute name="current" type="xs:boolean"/>
> </xs:complexType>
> ...
> 
> This code-snippet generates a class named StyleType, StyleTypeSequence
> and SLDType. The first StyleType class has then three variables. First
> is called choiceValue which is of type Object, second styleTypeSequence
> and last SLDType.
> 
> But how to map this class?
> My approach was (for StyleTypeSequence):
> 
> <class
> name="eu.esdihumboldt.mediator.context.webmapcontext.impl.StyleList">
>    <field  name="style" type="Style" collection="array">
>         <bind-xml name="Style" node="element"/>
>    </field>
>  </class>
>  
>  <class
> name="eu.esdihumboldt.mediator.context.webmapcontext.impl.Style">
>     <field name="styleTypeSequence" type="StyleTypeSequence">
>         <bind-xml name="Style" node="element"/>
>    </field>
>  </class>
>  
> <class name="StyleTypeSequence">
>    <field name="name" type="string">
>         <bind-xml name="Name" node="element"/>
>    </field>
>     <field name="title" type="string">
>         <bind-xml name="Title" node="element"/>
>    </field>
>  </class>
> 
> But in this approach I got a wrong output, because I'm binding the tag
> 'Style' twice.
> 
> ...
> <Style>
>   <Style>
>     <Name>Hello</Name>
>     <Title>World</Title>
>   </Style>
> </Style>
> ...
> 
> Instead of:
> 
> ...
> <Style>
>   <Name>Hello</Name>
>   <Title>World</Title>
> </Style>
> ...
> 
> How to set up the mapping file correctly?
> 
> I'm using Castor 1.1.2.1
> 
> Best regards,
> Bernd
> 
> This e-mail and any attachment is for authorised use by the intended 
> recipient(s) only. It may contain proprietary material, confidential 
> information and/or be subject to legal privilege. It should not be copied, 
> disclosed to, retained or used by, any other party. If you are not an 
> intended recipient then please promptly delete this e-mail and any attachment 
> and all copies and inform the sender. Thank you.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to