I'm working with a set of XML documents that are nested and at each level
they have the same element name (ERROR). The way the documents are set up
there is an outer envelope (ENVELOPE), a payload (PAYLOAD) and an inner
payload that could be any one of a number of different specific formats.
Using a mapping like the one below I am able to bind and generate output.
I'm having trouble parsing the return. The return is the same XML document
with additional elements, so ENVELOPE and all it's children, goes out and
comes back with new fields.
If I have an ERROR returned in the ENVELOPE all is well. However each level
can generate an ERROR. If the ERROR is returned in the PAYLOAD I receive an
exception when parsing the return. The exception text is :
Original Error : Element "PAYLOAD" has no mapping that extends
com.myclass.impl.InnerPayloadImpl.
EnvelopeImpl, PayloadImpl and InnerPayloadImpl are all defined with the
correct fields and the bind works.
Any ideas?
Example:
<mapping name="ENVELOPE" class="com.myclass.impl.EnvelopeImpl"
value-style="attribute">
<value name="KEY" get-method="getKey" set-method="setKey" />
<value name="USERID" get-method="getUid" set-method="setUid"
usage="optional" />
<value name="PASSWORD" get-method="getPw" set-method="setPw"
usage="optional" />
<value name="ENVIRONMENT" get-method="getEnv" set-method="setEnv"
usage="optional" />
<structure name="ERROR" usage="optional" ordered="false" >
<value name="_RC" field="rc" usage="optional" />
<value name="_MQQ" field="mqq" usage="optional" />
<value name="_MSGNO" field="msgNo" usage="optional" />
<value name="_MSGTEXT" field="msgText" usage="optional" />
</structure>
<structure field="payload" usage="optional" style="element" /> <!--
defined as com.myclass.Payload -->
</mapping>
<mapping name="PAYLOAD" class="com.myclass.impl.PayloadImpl"
value-style="attribute">
<value name="ACNTNMBR" field="accountNumber" usage="optional" />
<structure name="ERROR" usage="optional" style="element"
ordered="false" >
<value name="_RC" field="rc" usage="optional" />
<value name="_MQQ" field="mqq" usage="optional" />
<value name="_MSGNO" field="msgNo" usage="optional" />
<value name="_MSGTEXT" field="msgText" usage="optional" />
</structure>
<structure field="requestData" /> <!-- defined as
com.myclass.InnerPayload -->
</mapping>
<mapping class="com.myclass.impl.InnerPayloadImpl " abstract="true" >
<structure name="ERROR" usage="optional" style="element"
ordered="false" >
<value name="_RC" field="rc" usage="optional" />
<value name="_MQQ" field="mqq" usage="optional" />
<value name="_MSGNO" field="msgNo" usage="optional" />
<value name="_MSGTEXT" field="msgText" usage="optional" />
</structure>
<value name="INNERACNTNMBR" field="innerAccountNumber" />
</mapping>
<mapping name="INNERPAYLOAD1"
class="com.myclass.impl.InnerPayload1Impl" value-style="attribute"
extends=""
com.myclass.impl.InnerPayloadImpl">
<structure map-as="com.myclass.impl.InnerPayloadImpl" />
<value name="ATTRIBUTE1" field="attribute1" usage="optional" />
<value name="ATTRIBUTE2" field="attribute2" usage="optional" />
<value name="RTNATTRIBUTE44" field="return44" usage="optional" />
</mapping>
<mapping name="INNERPAYLOAD2" class="com.myclass.impl.InnerPayload2Impl"
value-style="attribute" extends=""com.myclass.impl.InnerPayloadImpl">
<structure map-as="com.myclass.impl.InnerPayloadImpl" />
<value name="ATTRIBUTE10" field="attribute10" usage="optional" />
<value name="ATTRIBUTE22" field="attribute22" usage="optional" />
<value name="RTNATTRIBUTE33" field="return33" usage="optional" />
</mapping>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users