Not sure, to be honest. Given that there's field mappings for 'error' elements within separate class mappings, I would assume that this should work.

Werner

Andy Buckley wrote:
Hi,

I've got a data model with errors (i.e. uncertainties rather than mistakes) at
several places. Each of these has a distinct Java class representing it, e.g.
PointError, AxisError etc. Up until now I've reflected this in the
corresponding XML format with tags <pointerror>, <axiserror> etc., but it would
be nice to be able to just use <error> and have the class determined by the
context in which the <error> tag occurs. For example,

<axis>
  <point>
    <pointerror ... />
  </point>
  <axiserror />
</axis>

would be nicer as

<axis>
  <point>
    <error ... />
  </point>
  <error />
</axis>

Is this possible? I imagine that a mapping file fragment like this might work:

<class name="Axis">
  <map-to xml="axis" />
  <field name="Points" type="Point" collection="sortedset">
    <bind-xml name="point" node="element" />
  </field>
  <field name="Errors" type="AxisError" collection="sortedset">
    <bind-xml name="error" node="element" />
  </field>
</class>

<class name="Point">
  <map-to xml="point" />
  ...
  <field name="Errors" type="PointError" collection="sortedset">
    <bind-xml name="error" node="element" />
  </field>
</class>

(plus the error classes' mappings) where the crucial thing is that there are
two <bind-xml name="error" .../>s. Is this sort of thing supported in Castor or
will I have to do some sort of preprocessing if I want this to work?

As usual, apologies if I've just not found the right part of the user guide!

Thanks,
Andy



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

   http://xircles.codehaus.org/manage_email

Reply via email to