}
}
private void marshal(Map objectModel, String name, String scope, String mappingpath) {
try {
Marshaller marshaller = new Marshaller(new IncludeXMLConsumer(super.contentHandler));
try {
Mapping mapping = null;
if (mappingpath != null) {
mapping = loadMapping(mappingpath);
} else {
mapping = defaultMapping;
}
marshaller.setMapping(mapping);
} catch (Exception e) {
getLogger().warn("Unable to load mapping " + mappingpath, e);
}
Object bean = this.searchBean(objectModel, name, scope);
if (bean instanceof Collection) {
Iterator i = ((Collection)bean).iterator();
while (i.hasNext()) {
marshaller.marshal(i.next());
}
} else {
marshaller.marshal(bean);
}
} catch (Exception e) {
getLogger().warn("Failed to marshal bean " + name, e);
}
}