The binding generator code can certainly use some improvement. I'm hoping to get back to this before the end of the year, but no guarantees. When I do make it back I'll extend it to use some of the nicer features added to JiBX since the initial version of the generator (about JiBX Beta 3). I'm thinking of implementing it using ASM for walking the tree of classes, generating the binding as it goes. I'm also looking into extending it to use Java 5 generics information as part of the binding, for people who are using Java 5.

 - Dennis

Niemann Alexander wrote:

I was messing around with manually _and_ automatically generated binding.xml files - that's the reason for the little confusion. The solution you described works so far. But to be honest I find it a bit disturbing to change my code (even temporarily) to match an insufficent tool. It's espacially not feasible because there will be a fair amount of (more complex) classes. Well, I guess that's the point where any Open Source guru would tell me to have a look into the source :) And that's exactly what I'm going to do tomorrow. Thank you for your quick response and the help, Mocky! I have the slight feeling that this wasn't my last issue on this list ... Alexander -----Ursprüngliche Nachricht----- *Von:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Auftrag von *Mocky Habeeb
*Gesendet:* Donnerstag, 15. September 2005 15:43
*An:* [email protected]
*Betreff:* RE: [jibx-users] Using jibx-genbinding.jar on a class containing a java.util.HashSet collection

    It appears that the binding generator tool doesn't like HashSets.
    If you change that type to an ArrayList it works fine. As it
    happens, the binding file it generates for ArrayList collection
    works unchanged with a HashSet as well, if you just go back into
    your java code and change it.
Since you say you are taking your first steps with JiBX, I just
    want to make sure you understand that the binding generator only
    generates a sample binding.xml for you. And that it's the binding
    compiler that generates the actual code and puts it into your
    class files. I mention that because you are using the binding
    generator but seem have what looks like a hand written binding.xml.
Mocky

        -----Original Message-----
        *From:* [EMAIL PROTECTED]
        [mailto:[EMAIL PROTECTED] *On Behalf Of
        *Niemann Alexander
        *Sent:* Thursday, September 15, 2005 8:01 AM
        *To:* [email protected]
        *Subject:* AW: [jibx-users] Using jibx-genbinding.jar on a
        class containing a java.util.HashSet collection

        Oh, sorry - I missed that. Here it is:
<binding>
          <mapping name="SAPDocument"
        class="de.ava.kas.model.SAPDocument">
            <value name="documentNo" field="documentNo"/>
            <collection field="sapDocumentItems"
        item-type="de.ava.kas.model.SAPDocumentItem"/>
          </mapping>
          <mapping name="SAPDocumentItem"
        class="de.ava.kas.model.SAPDocumentItem">
            <value name="documentItemNo" field="documentItemNo"/>
            <value name="documentNo" field="documentNo"/>
          </mapping>
        </binding>
Alexander

            -----Ursprüngliche Nachricht-----
            *Von:* [EMAIL PROTECTED]
            [mailto:[EMAIL PROTECTED] Auftrag
            von *Mocky Habeeb
            *Gesendet:* Donnerstag, 15. September 2005 13:20
            *An:* [email protected]
            *Betreff:* RE: [jibx-users] Using jibx-genbinding.jar on a
            class containing a java.util.HashSet collection

            Can you show what your binding file looks like?
Mocky
                -----Original Message-----
                *From:* [EMAIL PROTECTED]
                [mailto:[EMAIL PROTECTED] *On
                Behalf Of *Niemann Alexander
                *Sent:* Thursday, September 15, 2005 7:08 AM
                *To:* [email protected]
                *Subject:* [jibx-users] Using jibx-genbinding.jar on a
                class containing a java.util.HashSet collection

                Hello,

                I'm currently taking my first steps with JiBX and
                already encountered a problem while generating a
                binding. I hope someone here can give me a hint or two ...

                Everything's about two pretty simple POJOs,
                representing a document and a set of contained items:

                public class SAPDocument {
                    private String documentNo;
                    private HashSet sapDocumentItems = new HashSet();
                }

                public class SAPDocumentItem {
                    private String documentItemNo;
                    private String documentNo;
                }

                The classes have been compiled and now I want to
                generate the JiBX binding using the generator by calling

                java -jar ./jibx-genbinding.jar -v -f
                .../mappings/binding.xml SAPDocument SAPDocumentItem

                Unfortunately this doesn't work - I get the following
                output:

                Running binding generator version 0.2
                Building mapping definition for
                de.ava.kas.model.SAPDocument
                creating nested structure definition for
                java.util.HashSet
                Warning: trying to create structure for java.util.HashSet
                org.jibx.runtime.JiBXException: No content found for
                class java.util.HashSet
                at
                
org.jibx.binding.BindingGenerator.createStructure(BindingGenerator.java:699)

                at
                
org.jibx.binding.BindingGenerator.defineFields(BindingGenerator.java:404)

                at
                
org.jibx.binding.BindingGenerator.defineStructure(BindingGenerator.java:621)

                at
                
org.jibx.binding.BindingGenerator.createMapping(BindingGenerator.java:736)

                at
                
org.jibx.binding.BindingGenerator.generate(BindingGenerator.java:888)

                at
                
org.jibx.binding.BindingGenerator.main(BindingGenerator.java:1089)


                What does "No content found for class ....." mean?
                What content is the generator looking for?

                Thanks for your help and regards
                Alexander






-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to