This document attempts to answer some of the more frequently asked questions regarding various aspects of Betwixt. These questions are typically asked over and over again on the mailing lists, as a courtesy to the developers, we ask that you read this document before posting to the mailing lists.
General
Writing Beans
BeanWriter
produce xml that's easy (for a human ;) to read?
ID
attribute values for my beans?
Reading Beans
.betwixt
file without also adding default propertes?
Building Betwixt
XMLBeanInfoRegistry
implementation. One simple way to improve performance is to
share a single, threadsafe implementation (DefaultXMLBeanInfoRegistry
, for example)
between all readers and writers.
BeanWriter
produce xml that's easy (for a human ;) to read?
beanWriter.enablePrettyPrint();
ID
-IDREF
mechanism
(described in the xml specification). Betwixt will automatically assign ID
values to beans as it write out the graph. If it comes to a bean that it's written
before, it will write an IDREF
value matching the original.
ID
attribute values for my beans?
BeanWriter
. Call
beanWriter.setWriteIDs(false);
ID
attributes.
Once this property is set (to false), when a cycle reference is encountered
in the bean graph, a CyclicReferenceException
will be thrown.
beanWriter.setWriteEmptyElements(false);
registerBeanRegister(String path, Class beanClass)
to register the class at a particular path..betwixt
file without also adding default propertes?
<addDefaults>
and to it add an attribute
add-properties="false"
.