I think I have wrong src code. The BeanReader that I have doesn't have the
method setBindingConfiguration and I do not have the class
BindingConfiguration. I did download the latest src code. Is there anything
I am missing.

-Sunitha

-----Original Message-----
From: Voyer Henry [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 13, 2003 3:34 PM
To: 'Jakarta Commons Users List'
Subject: RE : betwixt Beginner


Hi.

I had the same problem and it took me a while to understand how to make it
work

First download the latest cvs build. Toy a bit with it. Look the examples.
In resume it works like this.

To marshall

        StringWriter outputWriter = new StringWriter();
        BeanWriter writer = new BeanWriter(outputWriter);

      writer.getBindingConfiguration().setMapIDs(false);

        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().setAttributesForPrimitives(false);
        writer.enablePrettyPrint();
        // set a custom name mapper for attributes
        writer.getXMLIntrospector().setAttributeNameMapper(new
HyphenatedNameMapper());
        // set a custom name mapper for elements
        writer.getXMLIntrospector().setElementNameMapper(new
DecapitalizeNameMapper());

        writer.write("myobjectname", MyObject);

        String thexml = outputWriter.toString();

Unmarshall

                StringReader xmlReader = new StringReader(thexml);

                BeanReader beanReader = new BeanReader();

        
beanReader.getXMLIntrospector().setWrapCollectionsInElement(true);

                beanReader.setBindingConfiguration(configuration);

                String name = nameStrategy(classType.getName());
                beanReader.registerBeanClass("myObjectName",
MyObject.class);

                MyObject object = (MyObject) beanReader.parse(xmlReader);

Hope this help

regards


-----Message d'origine-----
De : Sunitha Muthireddy [mailto:[EMAIL PROTECTED] 
Envoy� : 13 novembre, 2003 13:34
� : '[EMAIL PROTECTED]'
Objet : betwixt Beginner


I am trying to use betwixt but I do not see any good documentation or
examples to use CreateRule. 

And also the documentation doesn't match src file. Did I do something wrong?

Ex : There is no class calledBindingConfiguration in src files. And
BasicReader doesn't have setBindingConfiguration property. 

Thank you 

-Sunitha



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to