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]