List of usage examples for org.w3c.dom Comment appendData
public void appendData(String arg) throws DOMException;
From source file:org.jasig.resourceserver.utils.aggr.ResourcesElementsProviderImpl.java
/** * Convert the {@link Js} argument to an HTML script tag and append it * to the {@link DocumentFragment}./* w w w. j a va 2 s. co m*/ */ protected void appendJsNode(HttpServletRequest request, Document document, DocumentFragment head, Js js, String relativeRoot) { final String scriptPath = getElementPath(request, js, relativeRoot); if (resourcesDao.isConditional(js)) { Comment c = document.createComment(""); c.appendData(OPEN_COND_COMMENT_PRE); c.appendData(js.getConditional()); c.appendData(OPEN_COND_COMMENT_POST); c.appendData(OPEN_SCRIPT); c.appendData(scriptPath); c.appendData(CLOSE_SCRIPT); c.appendData(CLOSE_COND_COMMENT); head.appendChild(c); } else { Element element = document.createElement(SCRIPT); element.setAttribute(TYPE, "text/javascript"); element.setAttribute(SRC, scriptPath); element.appendChild(document.createTextNode(" ")); head.appendChild(element); } }
From source file:org.jasig.resourceserver.utils.aggr.ResourcesElementsProviderImpl.java
/** * Convert the {@link Css} argument to an HTML link tag and append it * to the {@link DocumentFragment}./*from w w w. jav a 2s . c o m*/ */ protected void appendCssNode(HttpServletRequest request, Document document, DocumentFragment head, Css css, String relativeRoot) { final String stylePath = getElementPath(request, css, relativeRoot); if (resourcesDao.isConditional(css)) { Comment c = document.createComment(""); c.appendData(OPEN_COND_COMMENT_PRE); c.appendData(css.getConditional()); c.appendData(OPEN_COND_COMMENT_POST); c.appendData(OPEN_STYLE); c.appendData(stylePath); if (StringUtils.isNotBlank(css.getMedia())) { c.appendData("\" media=\""); c.appendData(css.getMedia()); } c.appendData(CLOSE_STYLE); c.appendData(CLOSE_COND_COMMENT); head.appendChild(c); } else { Element element = document.createElement(LINK); element.setAttribute(REL, "stylesheet"); element.setAttribute(TYPE, "text/css"); element.setAttribute(HREF, stylePath); if (StringUtils.isNotBlank(css.getMedia())) { element.setAttribute(MEDIA, css.getMedia()); } head.appendChild(element); } }