@Override public boolean matches(Element root, Element element) { List<Node> family = element.childNodes(); for (Node n : family) { if (!(n instanceof Comment || n instanceof XmlDeclaration || n instanceof DocumentType)) return false; } return true; }
@Override public boolean matches(Element root, Element element) { List<Node> family = element.childNodes(); for (int i = 0; i < family.size(); i++) { Node n = family.get(i); if (!(n instanceof Comment || n instanceof XmlDeclaration || n instanceof DocumentType)) return false; } return true; }
public static void main(String args[]){ Document doc = Document.createShell(""); DocumentType type = new DocumentType("html","","",""); doc.prependChild(type); Header h = new Header(doc); h.addTitle("Yes sir!"); String[] a= {"rel", "bb", "size", "100p", "href", "kjasldlasjd"}; h.addlink(a); h.addMeta("hell", "yes"); System.out.println(doc); }
public ScheduleDocument(){ doc = Document.createShell(""); doc.outputSettings().escapeMode(EscapeMode.xhtml); DocumentType type = new DocumentType("html", "", "", ""); doc.prependChild(type); doc.select("html").attr("class", "js no-touch geolocation backgroundsize csstransforms csstransforms3d audio localstorage inlinesvg pointerevents webaudio mediaqueries getusermedia"); }
@Override public void modifyBootstrapPage(BootstrapPageResponse response) { Document document = response.getDocument(); Element html = document.getElementsByTag("html").get(0); Element head = document.getElementsByTag("head").get(0); DocumentType doctype = (DocumentType) html.previousSibling(); DocumentType html5doc = new DocumentType("html", "", "", ""); doctype.replaceWith(html5doc); Element element = document.createElement("meta"); element.attr("name", "viewport"); StringBuilder content = new StringBuilder(); boolean open = false; open = addViewPortRule(content, open, "width", getViewPortWidth()); if (!isViewPortUserScalable()) { open = addViewPortRule(content, open, "user-scalable", "no"); } open = addViewPortRule(content, open, "initial-scale", getViewPortInitialScale()); open = addViewPortRule(content, open, "maximum-scale", getViewPortMaximumScale()); open = addViewPortRule(content, open, "minimum-scale", getViewPortMaximumScale()); element.attr("content", content.toString()); head.appendChild(element); // meta tag to disable gray tap highlights in WP8 (note, for some reason // these do not appear in W8, not even RT) // <meta name="msapplication-tap-highlight" content="no" /> element = document.createElement("meta"); element.attr("name", "msapplication-tap-highlight"); element.attr("content", "no"); head.appendChild(element); }