Sorry, the second paragraph of this should say:

It's also not in the <mapping> details, but you should use the extends="" attribute for any *mapping that extends an abstract mapping* to say what the base class is...

- Dennis

Dennis Sosnoski wrote:

The current structure doesn't allow for an abstract mapping to extend another abstract mapping. Here's what the binding tutorial says (http://jibx.sourceforge.net/tutorial/binding-advanced.html#abstract): "Another feature of JiBX is the ability to define abstract base mappings that can be extended by other mappings. This feature has a significant limitation in that it currently allows only a single layer of abstract mapping, but is nonetheless very useful in working with class hierarchies." It looks like that information is missing from the <mapping> element detailed description, though. Sorry, it's sometimes hard to keep everything up to date. If I do a beta 3c release (hopefully I won't have to) I'll correct this; for beta 4 I'm hoping to remove the limitation.

It's also not in the <mapping> details, but you should use the extends="" attribute for any abstract mapping to say what the base class is, at least if you want it to work properly when unmarshalling. Take a look at the tutorial description of abstract mappings and follow the examples there for best results at present.

- Dennis

Rego-Dacal, Anibal wrote:



I want to use an abstract mapping with a value element with the attribute style,
which I extend in another mapping,
but when I marshal the class I get many attributes in the xml.


This is my mapping :


<mapping name="hawbs" class="States" ordered="false">
<value field="agent" name="agent" usage="optional"/>
<collection field="statusList" usage="optional">
<structure name="hawb_status" type="TbScan">
<value field="unique_id" name="unique_id" style="attribute"
usage="optional"/>
<structure map-as="BaseTbScan"/>
</structure>
</collection>
</mapping>
<mapping class="BaseTbScanPK" abstract="true">
<value style="attribute" field="_dfPod" name="id" get-method="getDfPod"/>
<value field="_dfPacknr" name="piece_no" usage="optional"/>
<value field="_dfScandat" name="date" usage="optional"/>
<value field="_dfScantime" name="time" usage="optional"/>
</mapping>
<mapping class="BaseTbScan" abstract="true">
<structure field="_comp_id" type="TbScanPK" >
<structure map-as="BaseTbScanPK"/>
</structure>
<structure name="status" usage="optional">
<value field="_dfScananlass" name="code" style="attribute"
usage="optional"/>
</structure>
</mapping>


And this is the result:

<?xml version="1.0"?>
<hawbs>
<agent>XXX</agent>
<hawb_status unique_id="24083" id="724604" id="724604" id="724604" id="724604">
<piece_no>1</piece_no>
<date>2004-04-10</date>
<time>12:30:00</time>
<status code="42"/>
</hawb_status>
</hawbs>



Where is the error or is it a bug?


Thanks

Anibal






-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to