} else {
throw new IllegalStateException("Object of class " + dataObject.getClass().getName() +
" needs a JiBX <mapping> to be marshalled");
}
} else {
IXMLWriter wrtr = ctx.getXmlWriter();
String name = elementName;
int nsidx = 0;
if (full) {
// declare all namespaces on start tag
nsidx = elementNamespaceIndex;
wrtr.startTagNamespaces(nsidx, name, openNamespaceIndexes, openNamespacePrefixes);
} else {
// configure writer with namespace declared in enclosing scope
wrtr.openNamespaces(openNamespaceIndexes, openNamespacePrefixes);
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(nsidx, name);
}
ctx.getXmlWriter().flush();
} catch (IOException e) {
throw new JiBXException("Error marshalling XML representation: " + e.getMessage(), e);