* @param document
* to be updated
*/
public void updateDocument(Document document)
{
Element root = document.getRootElement();
// If the document failed to render at all, that's a different problem and is reported elsewhere.
if (root == null)
{
return;
}
// TAP5-2200: Generating XML from pages and templates is not possible anymore
// only add JavaScript and CSS if we're actually generating
final String mimeType = document.getMimeType();
if (mimeType != null && !HTML_MIME_TYPES.contains(mimeType))
{
return;
}
addStylesheetsToHead(root, includedStylesheets);
// only add the generator meta only to html documents
boolean isHtmlRoot = root.getName().equals("html");
if (!omitGeneratorMetaTag && isHtmlRoot)
{
Element head = findOrCreateElement(root, "head", true);
Element existingMeta = head.find("meta");
addElementBefore(head, existingMeta, "meta", "name", "generator", "content", tapestryBanner);
}
addScriptElements(root);