Hey Ralf, 
Yeah I have read the how-to page, none of the examples really address what I
am trying to do.  
The example that you posted, is almost exactly what I had before and it
gives the same result that I had in my sample code.  The problem that I am
trying to get around is not having the multiple values in the same
attribute, but instead having an individual element with the attribute for
each value in my class's list.  

I am pretty sure this is a common thing in the XML world, even if it isn't
the best design.  I have tried to map this with a nested <class> element,
but with limited success.  I agree that castor should be able to handle
this, just not sure how to do it.  



Ralf Joachim wrote:
> 
> Hi,
> 
> have you had a look at the howtos at:
> 
> http://castor.codehaus.org/xml-howto.html
> 
> How about something like:
> 
> <field name="OtherName" type="java.lang.String"
>         collection="arraylist">
>    <bind-xml node="attribute" name="Name"
>              location="OtherNames/OtherName"/>
> </field>
> 
> Take care on the 's' that I omited at field name. I am quite sure that 
> castor is able to produce what you want, it's just a question to find 
> the right mapping for this.
> 
> Ralf
> 
> 
> bmg125 schrieb:
>> Unfortunately, the XML format is not under my control and I don't have a
>> schema at this point, but hopefully the company will supply one in the
>> future.  So my hands are kinda bound here on the format of the XML. 
>> Castor
>> still seems like the way to go, but it doesn't seem to like this case
>> very
>> much.  I am not familiar with how custom field handlers work, but I might
>> have to try and go that route if I can't get the Mapping to work.  
>> 
>> I am kinda surprised that nothing like this has come up before, but I
>> couldn't find anything when searching through the archives.  Any ideas?
>> 
>> 
>> 
>> Karr, David wrote:
>> 
>>>Do you have the ability to start from an XML Schema, instead of an
>>>object definition?  If you defined OtherNames as a complextype
>>>containing a sequence of OtherName objects, that would match your XML,
>>>and your generated code for OtherNames would contain a collection type
>>>for the OtherName objects.  You wouldn't even need (necessarily) a
>>>binding file. 
>>>
>>>
>>>>-----Original Message-----
>>>>From: bmg125 [mailto:[EMAIL PROTECTED] 
>>>>Sent: Saturday, March 03, 2007 2:18 PM
>>>>To: [email protected]
>>>>Subject: [castor-user] Help needed with Mapping and XML-Binding
>>>>
>>>>
>>>>I am new to Castor and its mapping capabilities.   I  am 
>>>>having a problem
>>>>getting my XML wrappers to look the way I want it to when 
>>>>using the xml-bind
>>>>location attribute on a attribute node.    Basically, what I 
>>>>have in my
>>>>object is a List of strings (Names).
>>>>
>>>>That I want represented in the XML as:
>>>>
>>>><OtherNames>
>>>>        <OtherName Name="Bob" />
>>>>        <OtherName Name="Steve" />
>>>>        <OtherName Name="Chris" />
>>>><OtherNames>
>>>>
>>>>What I am gettings is:
>>>>
>>>><OtherNames>
>>>>        <OtherName Name= " Bob Steve Chris "/> </OtherNames>
>>>>
>>>>My mapping looks something like:
>>>>
>>>><field name="OtherNames" type="java.lang.String" 
>>>>collection="arraylist" >
>>>>       <bind-xml node="attribute" name="Name"
>>>>location="OtherNames/OtherName"/>
>>>></ field >
>>>>
>>>>Is there a way to do this in the mapping file?
>>>>Thanks in advance. 
>>>>--
>>>>View this message in context: 
>>>>http://www.nabble.com/Help-needed-with-Mapping-and-XML-Binding
>>>
>>>-tf3340401.html#a9290361
>>>
>>>>Sent from the Castor - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>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
>>>
>>>
>>>
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Help-needed-with-Mapping-and-XML-Binding-tf3340401.html#a9313098
Sent from the Castor - User mailing list archive at Nabble.com.


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

    http://xircles.codehaus.org/manage_email

Reply via email to