Hi Dennis,
In the below example(Binding File), you can see that there is root structure
element for name field and it contains the other elements for which I have
defined the custom marshaller and unmarshaller.
If the order of the elements in the input xml changes as defined in the binding
file, JiBX fails to parse the file throwing the exception as end element Name
is expected but found XYZ element. ...
Input File : -
..
<Name>
<Change_Event_Identifier_TARGET>....few more child elements
...</Change_Event_Identifier_TARGET>
<Name_Verification_Date_TARGET>....few more child elements
...</Name_Verification_Date_TARGET>
<Information_Handling_Effective_Date_TARGET>....few more child elements
...</Information_Handling_Effective_Date_TARGET>
</Name>
...
If the input file has the structure as mentioned in above example, JiBX will
parse it successfully as the Binding file has defined it in the same sequence.
But if the order of elements changes, it fails. e.g.
..
<Name>
<Change_Event_Identifier_TARGET>....few more child elements
...</Change_Event_Identifier_TARGET>
<Information_Handling_Effective_Date_TARGET>....few more child elements
...</Information_Handling_Effective_Date_TARGET>
<Name_Verification_Date_TARGET>....few more child elements
...</Name_Verification_Date_TARGET></Name>
...
I get the error saying end element Name is expected but found
Name_Verification_Date_TARGET start tag..
Binding File :-->
..
..
<structure field="name" usage="optional" name="Name" ordered="false">
<value style="element" name="id"
field="id" usage="optional" />
<structure
field="change_event_identifier_list"
name="Change_Event_Identifier_TARGET"
marshaller="com.abc.xyz.bom.RulesMapper" usage="optional"
unmarshaller="com.abc.xyz.bom.RulesMapper" />
<structure
field="name_verification_date_list"
name="Name_Verification_Date_TARGET"
marshaller="com.abc.xyz.bom.RulesMapper" usage="optional"
unmarshaller="com.abc.xyz.bom.RulesMapper" />
<structure
field="name_prefix_text_list" name="Name_Prefix_Text_TARGET"
marshaller="com.abc.xyz.bom.RulesMapper" usage="optional"
unmarshaller="com.abc.xyz.bom.RulesMapper" />
<structure
field="information_handling_effective_date_list"
name="Information_Handling_Effective_Date_TARGET"
marshaller="com.abc.xyz.bom.RulesMapper"
usage="optional"
unmarshaller="com.abc.xyz.bom.RulesMapper" />
...
...
...
...
</structure>
..
..
Am I doing anything wrong here?
Thanks in advance.
Vikas Jadhav.
________________________________
From: Dennis Sosnoski <d...@sosnoski.com>
To: jibx-users@lists.sourceforge.net
Sent: Thursday, November 17, 2011 4:11 PM
Subject: Re: [jibx-users] Structure ordering issue with custom marshaller and
unmarshaller
Hi Vikas,
Can you provide some details of how this fails? Off hand, I'd think
it should work as you'd expect.
- Dennis
Dennis M. Sosnoski
Java SOA and Web Services Consulting
Axis2/CXF/Metro SOA and Web Services Training
Web Services Jump-Start
On 11/03/2011 09:27 PM, vikas jadhav wrote:
Hi All,
>
>
>I am using the custom binding for marshalling and unmarshalling the input xml
>file. But if the elements are not in the proper order, binding fails even
>though I use the ordered="false" tag for the enclosing structure element.
>
>
>
>I have following binding file.
>
>
><binding name="binding" package="com.abc.xyz.identity">
> <namespace uri="http://com.abc.xyz/IDENTITY" default="elements" />
> <mapping abstract="true" type-name="identityROOT"
class="com.abc.xyz.bom.identity.Identity_ROOT"
post-set="postSet" pre-set="preSet">
> <namespace uri="" default="elements" prefix=""
/>
> <collection field="identityTopicList"
usage="optional" create-type="java.util.ArrayList">
> <structure
type="com.abc.xyz.bom.identity.Identity_Topic" name="IDENTITY"
ordered="false">
> <value style="element"
name="sourceProfileId" field="sourceProfileId"
usage="optional" />
> <value style="element" name="recordId"
field="recordId" usage="optional" />
> <structure field="name" usage="optional"
name="Name" ordered="false">
> <value style="element" name="id"
field="id" usage="optional" />
> <structure
field="change_event_identifier_list"
name="Change_Event_Identifier_TARGET"
>
marshaller="com.abc.xyz.bom.RulesMapper" usage="optional"
unmarshaller="com.abc.xyz.bom.RulesMapper" />
> <structure
field="name_verification_date_list"
name="Name_Verification_Date_TARGET"
>
marshaller="com.abc.xyz.bom.RulesMapper" usage="optional"
unmarshaller="com.abc.xyz.bom.RulesMapper" />
> <structure
field="name_prefix_text_list" name="Name_Prefix_Text_TARGET"
>
marshaller="com.abc.xyz.bom.RulesMapper" usage="optional"
unmarshaller="com.abc.xyz.bom.RulesMapper" />
> <structure
field="information_handling_effective_date_list"
>
name="Information_Handling_Effective_Date_TARGET"
marshaller="com.abc.xyz.bom.RulesMapper"
> usage="optional"
unmarshaller="com.abc.xyz.bom.RulesMapper" />
> ...
> ...
> ...
> ...
> </structure>
> </structure>
> </collection>
> ...
> ...
> ...
> ...
></binding>
>
>
>
>
>
>Thanks,
>Vikas Jadhav
>
>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
>
_______________________________________________
jibx-users mailing list jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
------------------------------------------------------------------------------
Cloud Computing - Latest Buzzword or a Glimpse of the Future?
This paper surveys cloud computing today: What are the benefits?
Why are businesses embracing it? What are its payoffs and pitfalls?
http://www.accelacomm.com/jaw/sdnl/114/51425149/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users