// element. So get a reference to the parent response element.
Stack elementStack = ((XDIMEContextImpl)context).getStack();
//test that the html element has been added to the element stack
if (elementStack.size() < 2) {
Object widgetResponseObject = elementStack.peek();
if (!(widgetResponseObject instanceof ResponseResponseElement)) {
logger.error("widget-response-not-found");
throw new IllegalStateException("No widget response element found");
} else {
widgetResponseElement = (ResponseResponseElement) widgetResponseObject;