if (marshallerIndex < 0) {
((IMarshallable)dataObject).marshal(ctx);
} else {
// open namespaces from wrapper element
IXMLWriter wrtr = ctx.getXmlWriter();
wrtr.openNamespaces(openNamespaceIndexes, openNamespacePrefixes);
String name = elementName;
if (!"".equals(elementNamespacePrefix)) {
name = elementNamespacePrefix + ':' + name;
}
wrtr.startTagOpen(0, name);
// marshal object representation (may include attributes) into element
IMarshaller mrsh = ctx.getMarshaller(marshallerIndex,
bindingFactory
.getMappedClasses()[marshallerIndex]);
mrsh.marshal(dataObject, ctx);
wrtr.endTag(0, name);
}
ctx.getXmlWriter().flush();
} catch (IOException e) {
throw new JiBXException("Error marshalling XML representation", e);