*/
public void renderXML (ContentHandler out, String uid) throws PortalException
{
ChannelState channelState = (ChannelState)channelStateMap.get(uid);
ChannelStaticData staticData = channelState.getStaticData();
ChannelRuntimeData runtimeData = channelState.getRuntimeData();
// Get the static data
String sImageUri = staticData.getParameter ("img-uri");
String sImageWidth = staticData.getParameter ("img-width");
String sImageHeight = staticData.getParameter ("img-height");
String sImageBorder = staticData.getParameter ("img-border");
String sImageLink = staticData.getParameter ("img-link");
String sCaption = staticData.getParameter ("caption");
String sSubCaption = staticData.getParameter ("subcaption");
Document doc = null;
try {
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
} catch (ParserConfigurationException pce) {
log.error("Error getting a Document", pce);
throw new GeneralRenderingException(pce);
}
// Create XML doc
Element contentE = doc.createElement("content");
// Add image tag src, width, height, border, and link
Element imageE = doc.createElement("image");
imageE.setAttribute("src", sImageUri);
if (exists(sImageWidth))
imageE.setAttribute("width", sImageWidth);
if (exists(sImageWidth))
imageE.setAttribute("height", sImageHeight);
if (exists(sImageWidth))
imageE.setAttribute("border", sImageBorder);
if (exists(sImageWidth))
imageE.setAttribute("link", sImageLink);
contentE.appendChild(imageE);
// Add a caption if it is specified
if (exists(sCaption)) {
Element captionE = doc.createElement("caption");
captionE.appendChild(doc.createTextNode(sCaption));
contentE.appendChild(captionE);
}
// Add a subcaption if it is specified
if (exists(sSubCaption)) {
Element subcaptionE = doc.createElement("subcaption");
subcaptionE.appendChild(doc.createTextNode(sSubCaption));
contentE.appendChild(subcaptionE);
}
doc.appendChild(contentE);
XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
xslt.setXML(doc);
xslt.setXSL(sslLocation, runtimeData.getBrowserInfo());
xslt.setTarget(out);
xslt.setStylesheetParameter("baseActionURL", runtimeData.getBaseActionURL());
xslt.transform();
}