001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.bean.html5; 018 019import org.apache.juneau.marshall.*; 020 021/** 022 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/semantics.html#the-html-element"><html></a> 023 * element. 024 * 025 * <p> 026 * The html element represents the root of an HTML document. It contains all other HTML elements 027 * and serves as the top-level container for the entire document. The lang attribute is commonly 028 * used to specify the primary language of the document for accessibility and SEO purposes. 029 * 030 * <h2 class='section'>Examples:</h2> 031 * <p class='bcode w800'> 032 * <jc>// Basic HTML document structure</jc> 033 * Html <jv>html1</jv> = <jsm>html</jsm>( 034 * <jsm>head</jsm>( 035 * <jsm>title</jsm>(<js>"My Web Page"</js>), 036 * <jsm>meta</jsm>().charset(<js>"utf-8"</js>) 037 * ), 038 * <jsm>body</jsm>(<js>"Hello, World!"</js>) 039 * ).lang(<js>"en"</js>); 040 * 041 * <jc>// HTML with manifest for offline support</jc> 042 * Html <jv>html2</jv> = <jsm>html</jsm>( 043 * <jsm>head</jsm>( 044 * <jsm>title</jsm>(<js>"Offline App"</js>) 045 * ), 046 * <jsm>body</jsm>(<js>"This app works offline!"</js>) 047 * ).lang(<js>"en"</js>).manifest(<js>"app.manifest"</js>); 048 * 049 * <jc>// HTML with custom attributes</jc> 050 * Html <jv>html3</jv> = <jsm>html</jsm>( 051 * <jsm>head</jsm>( 052 * <jsm>title</jsm>(<js>"Página en Español"</js>) 053 * ), 054 * <jsm>body</jsm>(<js>"¡Hola, Mundo!"</js>) 055 * ).lang(<js>"es"</js>).class_(<js>"no-js"</js>); 056 * </p> 057 * 058 * <p> 059 * The following convenience methods are provided for constructing instances of this bean: 060 * <ul class='javatree'> 061 * <li class='jc'>{@link HtmlBuilder} 062 * <ul class='javatree'> 063 * <li class='jm'>{@link HtmlBuilder#html() html()} 064 * <li class='jm'>{@link HtmlBuilder#html(Object...) html(Object...)} 065 * </ul> 066 * </ul> 067 * 068 * <h2 class='section'>See Also:</h2><ul> 069 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 070 * </ul> 071 */ 072@Marshalled(typeName = "html") 073public class Html extends HtmlElementContainer<Html> { 074 075 /** 076 * Creates an empty {@link Html} element. 077 */ 078 public Html() {} 079 080 /** 081 * Creates an {@link Html} element with the specified child nodes. 082 * 083 * @param children The child nodes. Must not be <jk>null</jk>. 084 */ 085 public Html(Object...children) { 086 children(children); 087 } 088 089 /** 090 * <a class="doclink" href="https://www.w3.org/TR/html5/semantics.html#attr-html-manifest">manifest</a> attribute. 091 * 092 * <p> 093 * Specifies the URL of the application cache manifest file. This enables offline functionality 094 * by allowing the browser to cache resources for offline use. 095 * 096 * <p> 097 * The manifest file should be a text file that lists resources to be cached. 098 * 099 * @param value The URL of the application cache manifest file. Can be <jk>null</jk> to unset the attribute. 100 * @return This object. 101 */ 102 public Html manifest(String value) { 103 attr("manifest", value); 104 return this; 105 } 106 107}