Hi!

I just downloaded and tried Castor XML. It seems to be exactly the thing I was looking for, thanks a lot!

I'd like to read in an XML file which has got two lists of the same elements. I tried the following in my mapping file, but Castor appended all elements to the first list and made an empty second list. Please note my use of the location attribute in order to read in elements with the same name, but in different lists.

<mapping>
<class name="teuto.trails.trail.Trail">

<field name="inputParameters" collection="arraylist" type="teuto.trails.trail.ParameterDeclaration">
<bind-xml location="input-parameters" name="declare-parameter"/>
</field>

<field name="returnParameters" collection="arraylist" type="teuto.trails.trail.ParameterDeclaration">
<bind-xml location="return-parameters" name="declare-parameter"/>
</field>


..

Here is an excerpt of the XML file:

<trail>

<input-parameters>
<declare-parameter name="object-class" type="java.lang.String" required="true"/>
<declare-parameter name="form-name" type="java.lang.String" required="true"/>
</input-parameters>


<return-parameters>
<declare-parameter name="object" type="java.lang.Object" required="false"/>
</return-parameters>


..

And finally an excerpt from Trail.java:

public class Trail {

  protected List inputParameters;
  protected List returnParameters;

..

Can I use the "location" feature in this way? How can I map such lists without using different classes for "input-parameters" and "return-parameters"?

Any help is greatly appreciated, thanks a lot!

Matthias

--
Matthias Wuttke
[EMAIL PROTECTED]



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

Reply via email to