下面列出了org.jsoup.nodes.Comment#org.jsoup.nodes.DocumentType 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void visit(DocumentType node) {
Ast.Element.Builder b = Ast.Element.newBuilder();
b.setKind(ElementKind.DOC_TYPE);
b.setTag("!DOCTYPE");
for (Attribute n : node.attributes()) {
visit(n);
b.addAttributes(attributes.pop());
}
elements.peek().add(b.build());
}
@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 (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 (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;
}
/**
* Returns the bootstrap page for the given context.
*
* @param context
* Context to generate bootstrap page for.
* @return A document with the corresponding HTML page.
*/
@Override
public Document getBootstrapPage(BootstrapContext context) {
DeploymentConfiguration config = context.getSession()
.getConfiguration();
Document document = new Document("");
DocumentType doctype = new DocumentType("html", "", "");
document.appendChild(doctype);
Element html = document.appendElement("html");
html.attr("lang", context.getUI().getLocale().getLanguage());
Element head = html.appendElement("head");
html.appendElement("body");
List<Element> dependenciesToInlineInBody = setupDocumentHead(head,
context);
dependenciesToInlineInBody.forEach(
dependency -> document.body().appendChild(dependency));
setupDocumentBody(document);
document.outputSettings().prettyPrint(false);
BootstrapUtils.getInlineTargets(context)
.ifPresent(targets -> handleInlineTargets(context, head,
document.body(), targets));
BootstrapUtils.getInitialPageSettings(context).ifPresent(
initialPageSettings -> handleInitialPageSettings(context,
head, initialPageSettings));
if (!config.isProductionMode()) {
UsageStatisticsExporter
.exportUsageStatisticsToDocument(document);
}
setupPwa(document, context);
if (!config.isProductionMode()) {
showWebpackErrors(document);
}
BootstrapPageResponse response = new BootstrapPageResponse(
context.getRequest(), context.getSession(),
context.getResponse(), document, context.getUI(),
context.getUriResolver());
context.getSession().getService().modifyBootstrapPage(response);
return document;
}