}
}
}
}
// Copy the content into the XmlAttributeType
XmlCursor loginCursor = lcDoc.newCursor();
loginCursor.toFirstContentToken();
XmlCursor destination = config.newCursor();
destination.toNextToken();
loginCursor.moveXml(destination);
loginCursor.dispose();
destination.dispose();
config.setName("LoginModuleConfiguration");
root.setServiceArray(new AbstractServiceType[]{realm});
//Above code inserts gbean using xsi:type=dep:GBeanType. We also need to account for the substitution group
//by changing the qname:
XmlCursor gbeanCursor = root.newCursor();
try {
if (!gbeanCursor.toChild(ServiceDocument.type.getDocumentElementName())) {
throw new RuntimeException("Could not find service element");
}
gbeanCursor.setName(GBEAN_QNAME);
} finally {
gbeanCursor.dispose();
}
return doc;
}