StringWriter buffer = new StringWriter();
write(schema, buffer, true);
StringReader in = new StringReader(buffer.getBuffer().toString());
reader = createBeanReader();
XMLIntrospector intro = createXMLIntrospector();
DefaultXMLBeanInfoRegistry registry = new DefaultXMLBeanInfoRegistry();
intro.setRegistry(registry);
// we have written the xml file back with element collections,
// so we have to say to the reader we want to use that now
// (the default when creating in this test is not to use them)
intro.setWrapCollectionsInElement(true);
// first flush the cash, else setting other options, doesn't
// end up in rereading / mapping the object model.
registry.flush();
// set the xmlIntrospector back to the reader
reader.setXMLIntrospector(intro);
PhysicalSchema schemaSecond = (PhysicalSchema) reader.parse(in);
buffer.close();
write(schema,buffer, true);