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