本文整理汇总了Java中org.jsoup.nodes.DocumentType类的典型用法代码示例。如果您正苦于以下问题:Java DocumentType类的具体用法?Java DocumentType怎么用?Java DocumentType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DocumentType类属于org.jsoup.nodes包,在下文中一共展示了DocumentType类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: matches
import org.jsoup.nodes.DocumentType; //导入依赖的package包/类
@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;
}
示例2: matches
import org.jsoup.nodes.DocumentType; //导入依赖的package包/类
@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;
}
示例3: main
import org.jsoup.nodes.DocumentType; //导入依赖的package包/类
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);
}
示例4: ScheduleDocument
import org.jsoup.nodes.DocumentType; //导入依赖的package包/类
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");
}
示例5: modifyBootstrapPage
import org.jsoup.nodes.DocumentType; //导入依赖的package包/类
@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);
}