Chris,


Chris Young wrote:
> Hi Werner,
> 
> Thanks for your reply. No, I don't have a schema file available. I have
> inherited the existing codebase (Castor mappings, Java class files etc.)
> from previous incumbents on the project I am working on. I will have a
> look into the XML code generator but I am reluctant to change the class
> files too much as this will have an impact on other areas of the
> project.

Which is perfectly well understandable ....

> In the meanwhile, is what I'm trying to achieve even possible? I'm not
> (yet!) overly familiar with Castor, so perhaps I'm trying to make it do
> something it's simply not designed to do? The easiest solution would be
> to avoid duplication of element names of course (if the <input> inside
> <custom> is changed to e.g. <foo> then everything is fine) but,
> unfortunately, this is not something I can guarantee.
Let me have a look at this in detail. For this to do, I'd need something
(*minimal*) to play with. Can you please create a new Jira issue and
attach all relevant files ?

Thanks
Werner
> 
> Thanks,
> Chris
> 
> -----Original Message-----
> From: Werner Guttmann [mailto:[EMAIL PROTECTED] 
> Sent: 01 July 2008 11:54
> To: [email protected]
> Subject: Re: [castor-user] Unmarshalling question
> 
> Chris,
> 
> before looking at your question, let me ask you something. Do you have
> an XML schema available that reflects your desired XML document
> structure ? If yes, why not use the XML code generator to generate Java
> classes (and descriptor classes) from your code, and let Castor handle
> everything automatically for you ?
> 
> This approach should be far easier than writing a mapping file for such
> scenarios where <xs:any> are allowed in an XML schema.
> 
> Regards
> Werner
> 
> Chris Young wrote:
>> Hi all,
>>
>> I'm new to Castor so you'll have to forgive me if this is a dumb 
>> question! :) Given the sample XML and mapping below, is there any way 
>> of preventing the <input> element which appears within the <custom> 
>> element from being unmarshalled using the Input class? The primary 
>> reason for doing this is that the contents of <custom> are arbitrary 
>> (hence the use of AnyNode). It just so happens that in this case the 
>> element happens to match a previously defined element name.
>>
>>   Sample XML:
>>
>>   <device>
>>     <input>
>>        <!-- 'input' children omitted for brevity. -->
>>     </input>
>>     <output>
>>        <!-- 'output' children omitted for brevity. -->
>>     </output>
>>     <custom name="theName" type="theType">
>>       <input>
>>         <!-- 'input' children omitted for brevity. -->
>>       </input>
>>     </custom>
>>   </device>
>>
>>
>>   Sample Mappings:
>>
>>   <class name="Input">
>>     <map-to xml="input" />
>>     <!-- Fields omitted for brevity. -->
>>   </class>
>>
>>   <class name="Custom">
>>     <map-to xml="custom" />
>>     <field name="name" direct="true" required="true">
>>        <bind-xml name="name" node="attribute"/>
>>     </field>
>>     <field name="type" direct="true" required="true">
>>        <bind-xml name="type" node="attribute"/>
>>     </field>
>>     <field name="data" direct="true" required="true"
>> type="org.exolab.castor.types.AnyNode">
>>       <bind-xml matches="*"/>
>>     </field>
>>   </class>
>>
>> Any help appreciated!
>>
>> Regards,
>> Chris
>>
>> _______________________________________________
>> This email has been scanned for Softel by Star.
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 
> _______________________________________________
> This email has been scanned for Softel by Star.
> 
> _______________________________________________
> This email has been scanned for Softel by Star.
> 
> ---------------------------------------------------------------------
> 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