The binding you have below is correct (for such a simple binding,
anyway) - there's no problem including <value> elements as children of
<mapping>s.  I think you're misunderstanding this sentence in the
referenced documentation:

Children: namespace, format, mapping, followed by any combination of
value, structure, and collection elements

What that means is that there are *six* legitimate children of mapping
elements: namespace, format, mapping, value, structure & collection -
however, namespace, format & mapping children must come before value,
structure or collection children.

If you're still having problems with this binding, reply back with
exactly what you're doing and what error you're getting; I just compiled
& ran it with the following test code:

    IBindingFactory factory = BindingDirectory.getFactory( Person.class
);
    IUnmarshallingContext ctx = factory.createUnmarshallingContext( );
    Person p = ( Person ) ctx.unmarshalDocument(
      new FileReader( "sample.xml" ), "UTF-8" );
    System.out.println( p.toString( ) );

And it ran just fine.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ronald
Johnson
Sent: Wednesday, March 14, 2007 8:12 AM
To: jibx-users@lists.sourceforge.net
Subject: [jibx-users] problem with simple binding file

Hi, I am just trying out jibx and are a bit confused regarding what
the binding xml file should look like.

I want create a simple example, but jibx-compiler complains:
org.jibx.runtime.JiBXException: One or more <mapping> elements must be
defined in <binding>

By looking at the examples, I have created a binding file as below,
however, the documentation
[http://jibx.sourceforge.net/details/xml-summary.html] says that the
mapping element can NOT have a value as a child...
I am confused, can you guys help me out how to make this simple binding
work?

cheers!

binding.xml
<binding>
        <mapping name="customer" class="mock.Person" >
                <value name="firstname" field="firstName" />
                <value name="lastname" field="lastName" />
        </mapping>      
</binding>

Person.java:
package mock;

public class Person {
        
        public String firstName;
        public String lastName;

}

person1.xml:
<customer>
        <firstname>aName</firstname>
        <lastname>aLastName</lastname>
</customer>

------------------------------------------------------------------------
-
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=DEVDE
V
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

-------------------------------------------------------------------------
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
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to