Thanks for the response.
Based on your feedback, I tried the following:
<?xml version="1.0" encoding="UTF-8"?>
<binding>
<mapping name="ClaimSearchReply"
class="com.bcbsma.seebeyond.chs008reply.elements.ClaimSearchReply">
<structure name="Claims" field="_Claims">
<collection field="_ClaimSummary"
item-type="com.bcbsma.seebeyond.chs008reply.elements.ClaimSearchReply$Cl
aims$ClaimSummary">
<structure
map-as="com.bcbsma.seebeyond.chs008reply.elements.ClaimSearchReply$Claim
s$ClaimSummary"/>
</collection>
</structure>
</mapping>
<mapping name="ClaimSummary"
class="com.bcbsma.seebeyond.chs008reply.elements.ClaimSearchReply$Claims
$ClaimSummary">
<value name="InternalControlNumber"
field="_InternalControlNumber"/>
</mapping>
</binding>
However, this also results in:
*** Error during code generation for file 'testBinding2.xml' - please
enter a bu
g report for this error in Jira if the problem is not listed as fixed on
the onl
ine status page ***
org.jibx.runtime.JiBXException: One or more <mapping> elements for
modifiable cl
asses must be defined in <binding>
at org.jibx.binding.Utility.loadBinding(Utility.java:317)
at org.jibx.binding.Utility.loadFileBinding(Utility.java:408)
at org.jibx.binding.Loader.loadFileBinding(Loader.java:201)
at org.jibx.binding.Run.main(Run.java:163)
I'm new to JibX and I'm struggling to come with alternatives....thanks
for the feedback!
-----Original Message-----
From: Serkan Camurcuoglu [mailto:[EMAIL PROTECTED]
Sent: Friday, October 31, 2008 7:06 PM
To: [email protected]
Subject: Re: [jibx-users] Collections question
you can try to define the inner classes as separate mappings, and then
refer
to them using <structure map-as="..."/> .. also I think you should use
item-type instead of type in your collection definitions..
Hatfield, Dan wrote:
>
> Collections are giving me a bit of a fit and I'm looking for some
help!
> I have a bit of problem with some pre-defined Java classes (I don't
> control the source code) and JibX collections.
> I'm trying to get a mapping to work against the structure of these
Java
> classes (i.e. let's assume I can't change the Java source code).
>
>
> private class ClaimSearchReply {
> private Claim _Claims;
>
> private class Claims {
> private ArrayList _ClaimSummary;
>
> private class ClaimSummary {
> private String _InternalControlNumber;
> }
>
> }
>
>
> <binding>
> <mapping name="ClaimSearchReply"
> class="com.bcbsma.seebeyond.chs008reply.elements.ClaimSearchReply">
> <structure name="Claims" field="_Claims">
> <collection field="_ClaimSummary" >
> <structure name="ClaimSummary"
>
type="com.bcbsma.seebeyond.chs008reply.elements.ClaimSearchReply$Claims$
> ClaimSummary">
> <value name="InternalControlNumber"
> field="_InternalControlNumber"/>
> </structure>
> </collection>
> </structure>
> </mapping>
> </binding>
>
>
> <ClaimSearchReply>
> <Claims>
> <ClaimSummary order="1">
>
> <InternalControlNumber>01070403120000</InternalControlNumber>
> </ClaimSummary>
> <ClaimSummary order="2">
>
> <InternalControlNumber>01070168000100</InternalControlNumber>
> </ClaimSummary>
> <ClaimSummary order="3">
>
> <InternalControlNumber>01070168000000</InternalControlNumber>
> </ClaimSummary>
> </Claims>
> </ClaimSearchReply>
>
>
> This setup yields me the following error during runtime:
>
> *** Error during code generation for file 'testBinding2.xml' - please
> enter a bu
> g report for this error in Jira if the problem is not listed as fixed
on
> the onl
> ine status page ***
>
> org.jibx.runtime.JiBXException: One or more <mapping> elements for
> modifiable cl
> asses must be defined in <binding>
> at org.jibx.binding.Utility.loadBinding(Utility.java:317)
> at org.jibx.binding.Utility.loadFileBinding(Utility.java:408)
> at org.jibx.binding.Loader.loadFileBinding(Loader.java:201)
> at org.jibx.binding.Run.main(Run.java:163)
>
>
>
> I also tried:
> <binding>
> <mapping name="ClaimSearchReply"
> class="com.bcbsma.seebeyond.chs008reply.elements.ClaimSearchReply">
> <structure name="Claims" field="_Claims">
> <collection field="_ClaimSummary"
>
type="com.bcbsma.seebeyond.chs008reply.elements.ClaimSearchReply$Claims$
> ClaimSummary">
> <structure name="ClaimSummary">
> <value
> name="InternalControlNumber" field="_InternalControlNumber"/>
> </structure>
> </collection>
> </structure>
> </mapping>
> </binding>
>
>
> which gives me this validation error:
> Error: Incompatible types used in property definition; on collection
> element at (line 5, col 125, in testBinding2.xml)
> Error: Need store-method or add-method for input binding; on
collection
> element at (line 5, col 125, in testBinding2.xml)
> Error: Need load-method and size-method, or iter-method, for output
> binding; on collection element at (line 5, col 125, in
testBinding2.xml)
> Error: Nonstatic field _InternalControlNumber not found in class
> java.lang.Object; on value element at (line 7, col 74, in
> testBinding2.xml)
>
>
>
> Any thoughts? I realize the class structure is hoping. I'm hoping
JibX's
> extreme flexibility in mappings will allow me to overcome. :)
> Any help is appreciated.
> Dan
>
>
>
------------------------------------------------------------------------
-
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
--
View this message in context:
http://www.nabble.com/Collections-question-tp20274004p20275341.html
Sent from the jibx-users mailing list archive at Nabble.com.
------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users