DOMUtils.readXml(new StringReader((String) this.onBehalfOf));
tokenElement = acAsDoc.getDocumentElement();
} else if (isElement) {
tokenElement = (Element)this.onBehalfOf;
} else {
DelegationCallback callback = new DelegationCallback(message);
((CallbackHandler)onBehalfOf).handle(new Callback[]{callback});
tokenElement = callback.getToken();
}
if (tokenElement != null) {
writer.writeStartElement("wst", "OnBehalfOf", namespace);
StaxUtils.copy(tokenElement, writer);