// to prevent the href attribute from being omitted.
if (href == null) {
href = " ";
}
String content = "";
WapTV5_WMLVersion1_3Style style = getStyle(attributes);
if (href != null) {
String accessKey = getPlainText(attributes.getShortcut());
openFont(dom, attributes, true);
// We need to render the content of the anchor as a string.
Object contentObject = attributes.getContent();
if (contentObject instanceof DOMOutputBuffer) {
StringWriter contentWriter = new StringWriter();
DocumentOutputter outputter = new DOMDocumentOutputter(
new XMLDocumentWriter(contentWriter),
characterEncoder);
DOMOutputBuffer contentBuffer = (DOMOutputBuffer) contentObject;
Element contentRoot = contentBuffer.getRoot();
try {
outputter.output(contentRoot);
content = contentWriter.getBuffer().toString();
} catch (IOException ioe) {
logger.error("content-generation-error", ioe);
}
} else {
content = contentObject.toString();
}
// @todo 2005060816 annotate child with style information if it's not inherited from the parent
Element doElement = dom.openStyledElement("do", attributes);
if (style != null) {
style.addMarinerFocus(doElement, "focus");
}
doElement.setAttribute("label", content);
doElement.setAttribute("name", context.generateWMLActionID());
if (supportsTabindex && attributes.getTabindex() != null) {