1 HTML Document Representation
class | |||||
| |||||
| |||||
class | |||||
| |||||
| |||||
enumeration | |||||
|
The content field is normally the most interesting component.
The doctype field is a html.DocumentType to represent an HTML document that starts <!DOCTYPE…>. The name field in html.DocumentType is the name after DOCTYPE, which is normally html. The public and system fields will be values other than #false only for legacy specifications within DOCTYPE.
The quirks_mode fields of html.Document is based on the doctype field, and it indicates certain aspects of an input document was parsed.
class | ||||||||
| ||||||||
| ||||||||
class | ||||||||
|
When parsing HTML with html.read, name is case-folded, but html.write uses name verbatim; in particular, it assumes that the name is valid for an HTML element. Similarly, html.read case-folds name for an attribute, and html.write assumes that the name is valid. When no value is supplied for an attribute, html.read uses "" as the attribute’s value.
The is_template field will have #true when the element is parsed from a HTML document using element as the element name and #'html as the namespace. HTML template content is parsed specially.
The is_self_closing field is #true when the element
is—
The namespace field indicates the namespace for name. It is normally #'html, but #'svg and #'mathml are other possibilities.
Use html.Inject to create output that does not adhere to the HTML specification or to create valid HTML in a format other than the one that html.write would use.