Java Code Examples for org.jsoup.nodes.DocumentType
The following examples show how to use
org.jsoup.nodes.DocumentType.
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: compiler Author: boalang File: HtmlVisitor.java License: Apache License 2.0 | 5 votes |
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()); }
Example #2
Source Project: astor Author: SpoonLabs File: Evaluator.java License: GNU General Public License v2.0 | 5 votes |
@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; }
Example #3
Source Project: astor Author: SpoonLabs File: Evaluator.java License: GNU General Public License v2.0 | 5 votes |
@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; }
Example #4
Source Project: astor Author: SpoonLabs File: Evaluator.java License: GNU General Public License v2.0 | 5 votes |
@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; }
Example #5
Source Project: jsoup-learning Author: code4craft File: Evaluator.java License: MIT License | 5 votes |
@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; }
Example #6
Source Project: flow Author: vaadin File: BootstrapHandler.java License: Apache License 2.0 | 4 votes |
/** * 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; }