Initial Commit

This commit is contained in:
2025-09-23 20:22:59 -04:00
commit 743fc51873
135 changed files with 12240 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
.DS_Store
/.build
/.swiftpm
/*.xcodeproj
Sources/Old

145
LICENSE Normal file
View File

@@ -0,0 +1,145 @@
# Custom license
## Acceptance
In order to get any license under these terms, you must agree
to them as both strict obligations and conditions to all
your licenses.
## Copyright License
The licensor grants you a copyright license for the
software to do everything you might do with the software
that would otherwise infringe the licensor's copyright
in it for any permitted purpose. However, you may
only distribute the software according to [Distribution
License](#distribution-license) and make changes or new works
based on the software according to [Changes and New Works
License](#changes-and-new-works-license).
## Distribution License
The licensor grants you an additional copyright license
to distribute copies of the software. Your license
to distribute covers distributing the software with
changes and new works permitted by [Changes and New Works
License](#changes-and-new-works-license).
## Notices
You must ensure that anyone who gets a copy of any part of
the software from you also gets a copy of these terms or the
URL for them above, as well as copies of any plain-text lines
beginning with `Required Notice:` that the licensor provided
with the software. For example:
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
## Changes and New Works License
The licensor grants you an additional copyright license to
make changes and new works based on the software for any
permitted purpose.
## Patent License
The licensor grants you a patent license for the software that
covers patent claims the licensor can license, or becomes able
to license, that you would infringe by using the software.
## Noncommercial Purposes
Any noncommercial purpose is a permitted purpose excluding anything
involving training or improving machine learning algorithms
## Personal Uses
Personal use for research, experiment, and testing for
the benefit of public knowledge, personal study, private
entertainment, hobby projects, amateur pursuits, or religious
observance, without any anticipated commercial application,
is use for a permitted purpose.
## Noncommercial Organizations
Use by any charitable organization, educational institution,
public research organization, public safety or health
organization, environmental protection organization,
or government institution are not exempt and is not a permitted
purpose.
## Fair Use
You may have "fair use" rights for the software under the
law. These terms do not limit them.
## AI
Training or improving machine learning algorithms, including
but not limited to artificial intelligence, natural language
processing, or data mining is not a permitted purpose. This
condition applies to any derivatives, modifications, or updates
based on the Software code.
Any usage of the Software in an AI-training dataset is considered
a breach of this License.
The Software may not be included in any dataset used for training
or improving machine learning algorithms, including but not limited
to artificial intelligence, natural language processing, or data mining.
## No Other Rights
These terms do not allow you to sublicense or transfer any of
your licenses to anyone else, or prevent the licensor from
granting licenses to anyone else. These terms do not imply
any other licenses.
## Patent Defense
If you make any written claim that the software infringes or
contributes to infringement of any patent, your patent license
for the software granted under these terms ends immediately. If
your company makes such a claim, your patent license ends
immediately for work on behalf of your company.
## Violations
The first time you are notified in writing that you have
violated any of these terms, or done anything with the software
not covered by your licenses, your licenses can nonetheless
continue if you come into full compliance with these terms,
and take practical steps to correct past violations, within
32 days of receiving notice. Otherwise, all your licenses
end immediately.
## No Liability
***As far as the law allows, the software comes as is, without
any warranty or condition, and the licensor will not be liable
to you for any damages arising out of these terms or the use
or nature of the software, under any kind of legal claim.***
## Definitions
The **licensor** is the individual or entity offering these
terms, and the **software** is the software the licensor makes
available under these terms.
**You** refers to the individual or entity agreeing to these
terms.
**Your company** is any legal entity, sole proprietorship,
or other kind of organization that you work for, plus all
organizations that have control over, are under the control of,
or are under common control with that organization. **Control**
means ownership of substantially all the assets of an entity,
or the power to direct its management and policies by vote,
contract, or otherwise. Control can be direct or indirect.
**Your licenses** are all the licenses granted to you for the
software under these terms.
**Use** means anything you do with the software requiring one
of your licenses.

34
Package.swift Normal file
View File

@@ -0,0 +1,34 @@
// swift-tools-version:5.9
//
// Package.swift
// HRW
//
// Created by Isaac Paul on 10/15/24
// Non-commercial license, see LICENSE.MD in the project root for details
//
import PackageDescription
let package = Package(
name: "HRW",
products: [
.library(
name: "HRW",
targets: ["HRW"]
)
],
dependencies: [
],
targets: [
.target(
name: "HRW",
dependencies: [
]
),
.testTarget(
name: "HRWTests",
dependencies: ["HRW"]
)
]
)

22
README.txt Normal file
View File

@@ -0,0 +1,22 @@
## HTML Reader Writer (H-RW)
The goal is to be able to load html into swift from a file, manipulate it, then spit out html while retaining the benefits of a type safe language which serves as an alternative to templating.
#### Thoughts
I suppose I wanted to be able to use plain html as is. In hindsight, it was too much effort for the payoff. This is mostly so I can build multipage websites with swift without the use of JS as a silly experiement.
There is also a HTML library called Plot that also lets you manipulate html, but it doesn't let you load it in from a file and treats HTML generations similarly to SwiftUI.
Perhaps this project can be repurposed as an LSP for html, but that's not much of an interest to me. It could also possibly be used to implement a renderer or translate html into a different UI format. However, I did not really take security into consideration when building this.
There is also an HTML parser in LadyBird thats partially written in Swift. It seems to call into c++ for a handful of things, so it doesn't seem to be reusable without that.
## License
The license is a modified version of the PolyForm Noncommercial License (1.0.0) to add more non-commerical and non-ai use stipulations. I am open relicensing.
## Contributions
All contributors must sign an CLA as I do not wish to restrict myself in the use of the code or future relicensing endevors.

View File

@@ -0,0 +1,358 @@
//
// BaseComponents.swift
// HRW
//
// Created by Isaac Paul on 10/15/24.
// Non-commercial license, see LICENSE.MD in the project root for details
//
public protocol IFlowContent : HTMLNode {}
public protocol IGlobalContainer {
var globalAttributes:Dictionary<GlobalAttributeKey, String> { get set }
var globalEvents:Dictionary<GlobalEventKey, String> { get set }
var dataAttributes:Dictionary<String, String> { get set }
}
extension IGlobalContainer {
mutating func trySetGlobalAttribute(_ key:String, _ value:String) -> Bool {
if let attr = GlobalAttributeKey(rawValue: key) {
globalAttributes.updateValue(value, forKey: attr)
return true
}
if let attr = GlobalEventKey(rawValue: key.asSubstring()) {
globalEvents[attr] = value
return true
}
if key[..<key.index(key.startIndex, offsetBy: 5)] == "data-" {
dataAttributes[key] = value
return true
}
return false
}
}
public class NParent : NRenderable {
public var children:[NRenderable] = []
public override init() {
super.init()
children = []
}
}
public class NRenderable {
public var parent:NParent? = nil
}
public class NNone: NRenderable { }
public struct GlobalAttributesBuilder : IGlobalContainer{
public var globalAttributes:Dictionary<GlobalAttributeKey, String> = [:]
public var globalEvents:Dictionary<GlobalEventKey, String> = [:]
public var dataAttributes:Dictionary<String, String> = [:]
public init(globalAttributes: Dictionary<GlobalAttributeKey, String>, globalEvents: Dictionary<GlobalEventKey, String>, dataAttributes: Dictionary<String, String>) {
self.globalAttributes = globalAttributes
self.globalEvents = globalEvents
self.dataAttributes = dataAttributes
}
public init() {
self.globalAttributes = [:]
self.globalEvents = [:]
self.dataAttributes = [:]
}
public init(_ attributes: [String: String]) throws {
self.globalAttributes = [:]
self.globalEvents = [:]
self.dataAttributes = [:]
for (key, value) in attributes {
if self.trySetGlobalAttribute(key, value) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
}
}
// The problem is pausing and resuming so this is a n-squared search, but is it faster than make allocations? do we even need this?
/*
public struct HtmlIterator : IteratorProtocol {
public init(src: NHTMLRenderable) {
self._src = src
}
public typealias Element = NHTMLRenderable
private let _src:NHTMLRenderable
private var _index:Int = 0
public mutating func next() -> NHTMLRenderable? {
let (index, result) = _src.renderableAtIndex(_index)
_index += 1
return result
}
}*/
public class HTMLNode : XMLNode, IGlobalContainer {
public var globalAttributes:Dictionary<GlobalAttributeKey, String> = [:]
public var globalEvents:Dictionary<GlobalEventKey, String> = [:]
public var children:[HTMLNode] = []
public init(expectedAttributes:[String:String]) throws {
super.init()
for (key, value) in expectedAttributes {
if let attr = GlobalAttributeKey(rawValue: key) {
globalAttributes.updateValue(value, forKey: attr)
continue
}
if let attr = GlobalEventKey(rawValue: key.asSubstring()) {
globalEvents[attr] = value
continue
}
if key[..<key.index(key.startIndex, offsetBy: 5)] == "data-" {
dataAttributes[key] = value
continue
}
throw AppError("Unexpected attribute: \(key)")
}
}
public init(globalAttributes:Dictionary<GlobalAttributeKey, String>, globalEvents:Dictionary<GlobalEventKey, String>, dataAttributes:Dictionary<String, String>) {
self.globalAttributes = globalAttributes
self.globalEvents = globalEvents
super.init(dataAttributes: dataAttributes)
}
public init(_ builder:GlobalAttributesBuilder, _ children:[HTMLNode] = []) {
self.globalAttributes = builder.globalAttributes
self.globalEvents = builder.globalEvents
self.children = children
super.init(dataAttributes: builder.dataAttributes)
}
public func findById(_ id:String) -> HTMLNode? {
if (globalAttributes[.id] == id) {
return self
}
for eachChild in children {
if let result = eachChild.findById(id) {
return result
}
}
return nil
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
var first = result.count == 0
for eachAttr in globalAttributes {
if (!first) {
result += " "
}
first = false
if (eachAttr.value.count > 0) {
result += "\(eachAttr.key)='\(eachAttr.value)'"
} else {
result += "\(eachAttr.key)"
}
}
for eachAttr in globalEvents {
if (!first) {
result += " "
}
first = false
if (eachAttr.value.count > 0) {
result += "\(eachAttr.key) = \(eachAttr.value)"
} else {
result += "\(eachAttr.key)"
}
}
return result
}
override var nodeName: String {
return "HTML"
}
override var isVoidElement: Bool {
return false
}
override public func toString(_ depth:Int = 0, spacingStrat:SpacingStrat = .tabs) -> (Int, String) {
var newDepth = depth
var result = renderTag()
if (!isVoidElement) {
for eachChild in children {
let (nextDepth, renderedChild) = eachChild.toString(newDepth, spacingStrat: spacingStrat)
newDepth = nextDepth
result += renderedChild
}
result += "<\(nodeName)/>"
}
return (newDepth, result)
}
}
public enum SpacingStrat {
case tabs
case spaces(num:Int)
}
public class GenericXMLNode : XMLNode {
public var attributes:Dictionary<String, String> = [:]
public var children:[XMLNode] = []
public var name:String
public init(_ name:String, _ attributes:[String:String], _ children:[XMLNode] = []) {
self.attributes = attributes
self.children = children
self.name = name
super.init(attributes)
}
public init(_ name:String, _ attributes:[String:String], _ parser:XMLParser? = nil) throws {
self.attributes = attributes
self.name = name
super.init(attributes)
var allItems:[XMLNode] = []
while let obj = try parser?.readObjectXml(endTag: "a") {
allItems.append(obj)
}
children = allItems
}
}
public class XMLNode { //Not sure if should be a parent class or just protocol
public var dataAttributes:Dictionary<String, String> = [:]
public var parent:XMLNode? = nil
var nodeName: String {
return ""
}
var isVoidElement: Bool {
return true
}
/*
public func it() -> HtmlIterator {
return HtmlIterator(src: self)
}*/
public init() {
}
public init(_ attributes:[String:String]) {
for (key, value) in attributes {
if key[..<key.index(key.startIndex, offsetBy: 5)] == "data-" {
dataAttributes[key] = value
continue
}
}
}
public init(dataAttributes:[String:String]) {
self.dataAttributes = dataAttributes
}
public func renderAttributes() -> String {
var result = ""
var first = true
for eachAttr in dataAttributes {
if (!first) {
result += " "
}
first = false
if (eachAttr.value.count > 0) {
result += "\(eachAttr.key) = \(eachAttr.value)"
} else {
result += "\(eachAttr.key)"
}
}
return result
}
/*
public func renderableAtIndex(_ index:Int) -> (Int, NHTMLRenderable?) {
if (index == 0) {
return (-1, self)
}
var nextIndex = index - 1
for eachChild in children {
let (index, result) = eachChild.renderableAtIndex(nextIndex)
if let result = result {
return (-1, result)
}
nextIndex = index
}
return (nextIndex, nil)
}*/
public func toString(_ depth:Int = 0, spacingStrat:SpacingStrat = .tabs) -> (Int, String) {
var newDepth = depth
var result = "<\(nodeName) \(renderAttributes())"
if (isVoidElement) {
result += "/>"
} else {
result += ">"
}
return (newDepth, result)
}
public func renderTag() -> String {
let closing = isVoidElement ? "/" : ""
let attributes = renderAttributes()
if (attributes.isEmpty) {
let result = "<\(nodeName)\(closing)>"
return result
} else {
let result = "<\(nodeName) \(renderAttributes()) \(closing)>"
return result
}
}
}
func isGlobalHTMLAttribute(_ key:String) -> Bool {
if let _ = GlobalAttributeKey(rawValue: key) {
return true
}
if let _ = GlobalEventKey(rawValue: key.asSubstring()) {
return true
}
if key[..<key.index(key.startIndex, offsetBy: 5)] == "data-" {
return true
}
return false
}
public protocol IHTMLParent : HTMLNode {
var childrenAny:[HTMLNode] { get set }
}
/*
public class NHTMLParent : NHTMLRenderable {
public var children:[NHTMLRenderable] { get {} set {} }
override open func findById(_ id:String) -> NHTMLRenderable? {
if let result = super.findById(id) {
return result
}
for eachChild in children {
if let result = eachChild.findById(id) {
return result
}
}
return nil
}
}*/

View File

@@ -0,0 +1,116 @@
//
// A.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <a> Hyperlink
public class A : HTMLNode, IFlow, IInteractive, IPalpable, IPhrasing {
/// Whether to download the resource instead of navigating to it, and its file name if so.
public var download:String? = nil
/// Address of the hyperlink. Valid URL potentially surrounded by spaces.
public var href:URL? = nil
/// Language of the linked resource. Valid BCP 47 language tag.
public var hreflang:String? = nil
/// URLs to ping. Set of space-separated tokens consisting of valid non-empty URLs.
public var ping:[URL] = []
/// Referrer policy for fetches initiated by the element. Referrer policy.
public var referrerpolicy:ReferrerPolicy? = nil
/// Relationship between the location in the document containing the hyperlink and the destination resource. Unordered set of unique space-separated tokens. The actual rules are more complicated than indicated.
public var rel:[String] = []
/// Browsing context for hyperlink navigation. Valid browsing context name or keyword.
public var target:String? = nil
/// Hint for the type of the referenced resource. Valid MIME type string.
public var type:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "download":
download = attValue
continue
case "href":
href = try URL(expect: attValue)
continue
case "hreflang":
hreflang = attValue
continue
case "ping":
ping = try URL.parseList(attValue, " ")
continue
case "referrerpolicy":
referrerpolicy = try ReferrerPolicy(expect: attValue)
continue
case "rel":
rel = try String.parseList(attValue, " ")
continue
case "target":
target = attValue
continue
case "type":
type = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "a", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let download = download {
result += " download='\(download)'"
}
if let href = href {
result += " href='\(href.absoluteString)'"
}
if let hreflang = hreflang {
result += " hreflang='\(hreflang)'"
}
result += " ping='\(ping.toStringList(" "))'"
if let referrerpolicy = referrerpolicy {
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
}
result += " rel='\(rel.toStringList(" "))'"
if let target = target {
result += " target='\(target)'"
}
if let type = type {
result += " type='\(type)'"
}
return result
}
override var nodeName: String {
return "a"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,56 @@
//
// Abbr.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <abbr> Abbreviation
public class Abbr : HTMLNode, IFlow, IPalpable, IPhrasing {
/// Full term or expansion of abbreviation.
public var title:String? {
get { return globalAttributes[.title] }
set { globalAttributes[.title] = newValue }
}
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "abbr", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "abbr"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Address.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <address> Contact information for a page or article element
public class Address : HTMLNode, IFlow, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "address", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "address"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,161 @@
//
// Area.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <area> Hyperlink or dead area on an image map
public class Area : HTMLNode, IFlow, IPhrasing {
public enum Shape : String, CaseIterable {
case circle
case default_ = "default"
case poly
case rect
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Shape: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Shape(rawValue: expect) else {
throw AppError("Unexpected value for Shape: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Shape] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Shape(rawValue: input), "unexpected value for Shape: \(input)")
}
return result
}
}
/// Replacement text for use when images are not available. Text. The actual rules are more complicated than indicated.
public var alt:String? = nil
/// Coordinates for the shape to be created in an image map. Valid list of floating-point numbers. The actual rules are more complicated than indicated.
public var coords:[Float] = []
/// Whether to download the resource instead of navigating to it, and its file name if so.
public var download:String? = nil
/// Address of the hyperlink. Valid URL potentially surrounded by spaces.
public var href:URL? = nil
/// URLs to ping. Set of space-separated tokens consisting of valid non-empty URLs.
public var ping:[URL] = []
/// Referrer policy for fetches initiated by the element. Referrer policy.
public var referrerpolicy:ReferrerPolicy? = nil
/// Relationship between the location in the document containing the hyperlink and the destination resource. Unordered set of unique space-separated tokens. The actual rules are more complicated than indicated.
public var rel:[String] = []
/// The kind of shape to be created in an image map.
public var shape:Shape? = nil
/// Browsing context for hyperlink navigation. Valid browsing context name or keyword.
public var target:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "alt":
alt = attValue
continue
case "coords":
coords = try Float.parseList(attValue, ",")
continue
case "download":
download = attValue
continue
case "href":
href = try URL(expect: attValue)
continue
case "ping":
ping = try URL.parseList(attValue, " ")
continue
case "referrerpolicy":
referrerpolicy = try ReferrerPolicy(expect: attValue)
continue
case "rel":
rel = try String.parseList(attValue, " ")
continue
case "shape":
shape = try Shape(expect: attValue)
continue
case "target":
target = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let alt = alt {
result += " alt='\(alt)'"
}
result += " coords='\(coords.toStringList(","))'"
if let download = download {
result += " download='\(download)'"
}
if let href = href {
result += " href='\(href.absoluteString)'"
}
result += " ping='\(ping.toStringList(" "))'"
if let referrerpolicy = referrerpolicy {
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
}
result += " rel='\(rel.toStringList(" "))'"
if let shape = shape {
result += " shape='\(shape.rawValue)'"
}
if let target = target {
result += " target='\(target)'"
}
return result
}
override var nodeName: String {
return "area"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,49 @@
//
// Article.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <article> Self-contained syndicatable or reusable composition
public class Article : HTMLNode, IFlow, IPalpable, ISectioning {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "article", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "article"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Aside.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <aside> Sidebar for tangentially related content
public class Aside : HTMLNode, IFlow, IPalpable, ISectioning {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "aside", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "aside"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,192 @@
//
// Audio.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <audio> Audio player
public class Audio : HTMLNode, IEmbedded, IFlow, IInteractive, IPalpable, IPhrasing {
public enum Crossorigin : String, CaseIterable {
case anonymous
case useCredentials = "use-credentials"
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Crossorigin: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Crossorigin(rawValue: expect) else {
throw AppError("Unexpected value for Crossorigin: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Crossorigin] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Crossorigin(rawValue: input), "unexpected value for Crossorigin: \(input)")
}
return result
}
}
public enum Preload : String, CaseIterable {
case auto
case metadata
case none
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Preload: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Preload(rawValue: expect) else {
throw AppError("Unexpected value for Preload: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Preload] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Preload(rawValue: input), "unexpected value for Preload: \(input)")
}
return result
}
}
/// Hint that the media resource can be started automatically when the page is loaded.
public var autoplay:Bool = false
/// Show user agent controls.
public var controls:Bool = false
/// How the element handles crossorigin requests.
public var crossorigin:Crossorigin? = nil
/// Whether to loop the media resource.
public var loop:Bool = false
/// Whether to mute the media resource by default.
public var muted:Bool = false
/// Hints how much buffering the media resource will likely need.
public var preload:Preload? = nil
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
public var src:URL? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "autoplay":
autoplay = true
continue
case "controls":
controls = true
continue
case "crossorigin":
crossorigin = try Crossorigin(expect: attValue)
continue
case "loop":
loop = true
continue
case "muted":
muted = true
continue
case "preload":
preload = try Preload(expect: attValue)
continue
case "src":
src = try URL(expect: attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "audio", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if autoplay {
result += " autoplay"
}
if controls {
result += " controls"
}
if let crossorigin = crossorigin {
result += " crossorigin='\(crossorigin.rawValue)'"
}
if loop {
result += " loop"
}
if muted {
result += " muted"
}
if let preload = preload {
result += " preload='\(preload.rawValue)'"
}
if let src = src {
result += " src='\(src.absoluteString)'"
}
return result
}
override var nodeName: String {
return "audio"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// B.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <b> Keywords
public class B : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "b", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "b"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,62 @@
//
// Base.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <base> Base URL and default target browsing context for hyperlinks and forms
public class Base : HTMLNode, IMetaData {
/// Document base URL. Valid URL potentially surrounded by spaces.
public var href:URL? = nil
/// Default browsing context for hyperlink navigation and form submission. Valid browsing context name or keyword.
public var target:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "href":
href = try URL(expect: attValue)
continue
case "target":
target = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let href = href {
result += " href='\(href.absoluteString)'"
}
if let target = target {
result += " target='\(target)'"
}
return result
}
override var nodeName: String {
return "base"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,49 @@
//
// Bdi.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <bdi> Text directionality isolation
public class Bdi : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "bdi", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "bdi"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,55 @@
//
// Bdo.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <bdo> Text directionality formatting
public class Bdo : HTMLNode, IFlow, IPalpable, IPhrasing {
/// The text directionality of the element.
public var dir:Dir {
get { return try! Dir(expect: globalAttributes[.dir]!) }
set { globalAttributes[.dir] = newValue.rawValue }
}
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "bdo", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "bdo"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,61 @@
//
// Blockquote.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <blockquote> A section quoted from another source
public class Blockquote : HTMLNode, IFlow, IPalpable, ISectioningRoot {
/// Link to the source of the quotation or more information about the edit. Valid URL potentially surrounded by spaces.
public var cite:URL? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "cite":
cite = try URL(expect: attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "blockquote", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let cite = cite {
result += " cite='\(cite.absoluteString)'"
}
return result
}
override var nodeName: String {
return "blockquote"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,196 @@
//
// Body.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <body> Document body
public class Body : HTMLNode, ISectioningRoot {
/// event handler.
public var onafterprint:String? = nil
/// event handler.
public var onbeforeprint:String? = nil
/// event handler.
public var onbeforeunload:String? = nil
/// event handler.
public var onhashchange:String? = nil
/// event handler.
public var onlanguagechange:String? = nil
/// event handler.
public var onmessage:String? = nil
/// event handler.
public var onmessageerror:String? = nil
/// event handler.
public var onoffline:String? = nil
/// event handler.
public var ononline:String? = nil
/// event handler.
public var onpagehide:String? = nil
/// event handler.
public var onpageshow:String? = nil
/// event handler.
public var onpopstate:String? = nil
/// event handler.
public var onrejectionhandled:String? = nil
/// event handler.
public var onstorage:String? = nil
/// event handler.
public var onunhandledrejection:String? = nil
/// event handler.
public var onunload:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "onafterprint":
onafterprint = attValue
continue
case "onbeforeprint":
onbeforeprint = attValue
continue
case "onbeforeunload":
onbeforeunload = attValue
continue
case "onhashchange":
onhashchange = attValue
continue
case "onlanguagechange":
onlanguagechange = attValue
continue
case "onmessage":
onmessage = attValue
continue
case "onmessageerror":
onmessageerror = attValue
continue
case "onoffline":
onoffline = attValue
continue
case "ononline":
ononline = attValue
continue
case "onpagehide":
onpagehide = attValue
continue
case "onpageshow":
onpageshow = attValue
continue
case "onpopstate":
onpopstate = attValue
continue
case "onrejectionhandled":
onrejectionhandled = attValue
continue
case "onstorage":
onstorage = attValue
continue
case "onunhandledrejection":
onunhandledrejection = attValue
continue
case "onunload":
onunload = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "body", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let onafterprint = onafterprint {
result += " onafterprint='\(onafterprint)'"
}
if let onbeforeprint = onbeforeprint {
result += " onbeforeprint='\(onbeforeprint)'"
}
if let onbeforeunload = onbeforeunload {
result += " onbeforeunload='\(onbeforeunload)'"
}
if let onhashchange = onhashchange {
result += " onhashchange='\(onhashchange)'"
}
if let onlanguagechange = onlanguagechange {
result += " onlanguagechange='\(onlanguagechange)'"
}
if let onmessage = onmessage {
result += " onmessage='\(onmessage)'"
}
if let onmessageerror = onmessageerror {
result += " onmessageerror='\(onmessageerror)'"
}
if let onoffline = onoffline {
result += " onoffline='\(onoffline)'"
}
if let ononline = ononline {
result += " ononline='\(ononline)'"
}
if let onpagehide = onpagehide {
result += " onpagehide='\(onpagehide)'"
}
if let onpageshow = onpageshow {
result += " onpageshow='\(onpageshow)'"
}
if let onpopstate = onpopstate {
result += " onpopstate='\(onpopstate)'"
}
if let onrejectionhandled = onrejectionhandled {
result += " onrejectionhandled='\(onrejectionhandled)'"
}
if let onstorage = onstorage {
result += " onstorage='\(onstorage)'"
}
if let onunhandledrejection = onunhandledrejection {
result += " onunhandledrejection='\(onunhandledrejection)'"
}
if let onunload = onunload {
result += " onunload='\(onunload)'"
}
return result
}
override var nodeName: String {
return "body"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,41 @@
//
// Br.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <br> Line break, e.g. in poem or postal address
public class Br : HTMLNode, IFlow, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "br"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,265 @@
//
// Button.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <button> Button control
public class Button : HTMLNode, IFlow, IFormAssociated, IInteractive, ILabelable, IListed, IPalpable, IPhrasing, ISubmittable {
public enum Formenctype : String, CaseIterable {
case application_xWwwFormUrlencoded = "application/x-www-form-urlencoded"
case multipart_formData = "multipart/form-data"
case text_plain = "text/plain"
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Formenctype: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Formenctype(rawValue: expect) else {
throw AppError("Unexpected value for Formenctype: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Formenctype] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Formenctype(rawValue: input), "unexpected value for Formenctype: \(input)")
}
return result
}
}
public enum Formmethod : String, CaseIterable {
case GET
case POST
case dialog
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Formmethod: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Formmethod(rawValue: expect) else {
throw AppError("Unexpected value for Formmethod: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Formmethod] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Formmethod(rawValue: input), "unexpected value for Formmethod: \(input)")
}
return result
}
}
public enum AttrType : String, CaseIterable {
case button
case reset
case submit
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for AttrType: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = AttrType(rawValue: expect) else {
throw AppError("Unexpected value for AttrType: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [AttrType] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(AttrType(rawValue: input), "unexpected value for AttrType: \(input)")
}
return result
}
}
/// Whether the form control is disabled.
public var disabled:Bool = false
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
public var form:String? = nil
/// URL to use for form submission. Valid non-empty URL potentially surrounded by spaces.
public var formaction:URL? = nil
/// Entry list encoding type to use for form submission.
public var formenctype:Formenctype? = nil
/// Variant to use for form submission.
public var formmethod:Formmethod? = nil
/// Bypass form control validation for form submission.
public var formnovalidate:Bool = false
/// Browsing context for form submission. Valid browsing context name or keyword.
public var formtarget:String? = nil
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
public var name:String? = nil
/// Type of button.
public var type:AttrType? = nil
/// Value to be used for form submission.
public var value:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "disabled":
disabled = true
continue
case "form":
form = attValue
continue
case "formaction":
formaction = try URL(expect: attValue)
continue
case "formenctype":
formenctype = try Formenctype(expect: attValue)
continue
case "formmethod":
formmethod = try Formmethod(expect: attValue)
continue
case "formnovalidate":
formnovalidate = true
continue
case "formtarget":
formtarget = attValue
continue
case "name":
name = attValue
continue
case "type":
type = try AttrType(expect: attValue)
continue
case "value":
value = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "button", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if disabled {
result += " disabled"
}
if let form = form {
result += " form='\(form)'"
}
if let formaction = formaction {
result += " formaction='\(formaction.absoluteString)'"
}
if let formenctype = formenctype {
result += " formenctype='\(formenctype.rawValue)'"
}
if let formmethod = formmethod {
result += " formmethod='\(formmethod.rawValue)'"
}
if formnovalidate {
result += " formnovalidate"
}
if let formtarget = formtarget {
result += " formtarget='\(formtarget)'"
}
if let name = name {
result += " name='\(name)'"
}
if let type = type {
result += " type='\(type.rawValue)'"
}
if let value = value {
result += " value='\(value)'"
}
return result
}
override var nodeName: String {
return "button"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,66 @@
//
// Canvas.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <canvas> Scriptable bitmap canvas
public class Canvas : HTMLNode, IEmbedded, IFlow, IPalpable, IPhrasing {
/// Vertical dimension. Valid non-negative integer.
public var height:UInt? = nil
/// Horizontal dimension. Valid non-negative integer.
public var width:UInt? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "height":
height = UInt(attValue)
continue
case "width":
width = UInt(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "canvas", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let height = height {
result += " height='\(height)'"
}
if let width = width {
result += " width='\(width)'"
}
return result
}
override var nodeName: String {
return "canvas"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Caption.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <caption> Table caption
public class Caption : HTMLNode {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "caption", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "caption"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Cite.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <cite> Title of a work
public class Cite : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "cite", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "cite"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Code.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <code> Computer code
public class Code : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "code", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "code"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,53 @@
//
// Col.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <col> Table column
public class Col : HTMLNode {
/// Number of columns spanned by the element. Valid non-negative integer greater than zero.
public var span:UInt? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "span":
span = UInt(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let span = span {
result += " span='\(span)'"
}
return result
}
override var nodeName: String {
return "col"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,57 @@
//
// Colgroup.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <colgroup> Group of columns in a table
public class Colgroup : HTMLNode {
/// Number of columns spanned by the element. Valid non-negative integer greater than zero.
public var span:UInt? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "span":
span = UInt(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "colgroup", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let span = span {
result += " span='\(span)'"
}
return result
}
override var nodeName: String {
return "colgroup"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,61 @@
//
// Data.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <data> Machine-readable equivalent
public class Data : HTMLNode, IFlow, IPalpable, IPhrasing {
/// Machine-readable value. Text. The actual rules are more complicated than indicated.
public var value:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "value":
value = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "data", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let value = value {
result += " value='\(value)'"
}
return result
}
override var nodeName: String {
return "data"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,53 @@
//
// Datalist.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <datalist> Container for options for combo box control
public class Datalist : HTMLNode, IFlow, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "datalist", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public func addChild(_ someElement:IScriptSupporting) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "datalist"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Dd.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <dd> Content for corresponding dt element(s)
public class Dd : HTMLNode {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "dd", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "dd"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,66 @@
//
// Del.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <del> A removal from the document
public class Del : HTMLNode, IFlow, IPhrasing {
/// Link to the source of the quotation or more information about the edit. Valid URL potentially surrounded by spaces.
public var cite:URL? = nil
/// Date and (optionally) time of the change. Valid date string with optional time.
public var datetime:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "cite":
cite = try URL(expect: attValue)
continue
case "datetime":
datetime = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "del", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let cite = cite {
result += " cite='\(cite.absoluteString)'"
}
if let datetime = datetime {
result += " datetime='\(datetime)'"
}
return result
}
override var nodeName: String {
return "del"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,61 @@
//
// Details.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <details> Disclosure control for hiding details
public class Details : HTMLNode, IFlow, IInteractive, IPalpable, ISectioningRoot {
/// Whether the details are visible.
public var open:Bool = false
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "open":
open = true
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "details", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if open {
result += " open"
}
return result
}
override var nodeName: String {
return "details"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,56 @@
//
// Dfn.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <dfn> Defining instance
public class Dfn : HTMLNode, IFlow, IPalpable, IPhrasing {
/// Full term or expansion of abbreviation.
public var title:String? {
get { return globalAttributes[.title] }
set { globalAttributes[.title] = newValue }
}
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "dfn", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "dfn"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,61 @@
//
// Dialog.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <dialog> Dialog box or window
public class Dialog : HTMLNode, IFlow, ISectioningRoot {
/// Whether the dialog box is showing.
public var open:Bool = false
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "open":
open = true
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "dialog", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if open {
result += " open"
}
return result
}
override var nodeName: String {
return "dialog"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Div.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <div> Generic flow container, or container for name-value groups in dl elements
public class Div : HTMLNode, IFlow, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "div", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "div"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Dl.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <dl> Association list consisting of zero or more name-value groups
public class Dl : HTMLNode, IFlow, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "dl", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IScriptSupporting) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "dl"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Dt.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <dt> Legend for corresponding dd element(s)
public class Dt : HTMLNode {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "dt", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "dt"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Em.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <em> Stress emphasis
public class Em : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "em", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "em"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,80 @@
//
// Embed.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <embed> Plugin
public class Embed : HTMLNode, IEmbedded, IFlow, IInteractive, IPalpable, IPhrasing {
/// Vertical dimension. Valid non-negative integer.
public var height:UInt? = nil
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
public var src:URL? = nil
/// Type of embedded resource. Valid MIME type string.
public var type:String? = nil
/// Horizontal dimension. Valid non-negative integer.
public var width:UInt? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "height":
height = UInt(attValue)
continue
case "src":
src = try URL(expect: attValue)
continue
case "type":
type = attValue
continue
case "width":
width = UInt(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let height = height {
result += " height='\(height)'"
}
if let src = src {
result += " src='\(src.absoluteString)'"
}
if let type = type {
result += " type='\(type)'"
}
if let width = width {
result += " width='\(width)'"
}
return result
}
override var nodeName: String {
return "embed"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,79 @@
//
// Fieldset.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <fieldset> Group of form controls
public class Fieldset : HTMLNode, IFlow, IFormAssociated, IListed, IPalpable, ISectioningRoot {
/// Whether the descendant form controls, except any inside legend, are disabled.
public var disabled:Bool = false
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
public var form:String? = nil
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
public var name:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "disabled":
disabled = true
continue
case "form":
form = attValue
continue
case "name":
name = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "fieldset", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if disabled {
result += " disabled"
}
if let form = form {
result += " form='\(form)'"
}
if let name = name {
result += " name='\(name)'"
}
return result
}
override var nodeName: String {
return "fieldset"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Figcaption.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <figcaption> Caption for figure
public class Figcaption : HTMLNode {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "figcaption", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "figcaption"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Figure.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <figure> Figure with optional caption
public class Figure : HTMLNode, IFlow, IPalpable, ISectioningRoot {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "figure", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "figure"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Footer.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <footer> Footer for a page or section
public class Footer : HTMLNode, IFlow, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "footer", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "footer"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,246 @@
//
// Form.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <form> User-submittable form
public class Form : HTMLNode, IFlow, IPalpable {
public enum Autocomplete : String, CaseIterable {
case off
case on
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Autocomplete: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Autocomplete(rawValue: expect) else {
throw AppError("Unexpected value for Autocomplete: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Autocomplete] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Autocomplete(rawValue: input), "unexpected value for Autocomplete: \(input)")
}
return result
}
}
public enum Enctype : String, CaseIterable {
case application_xWwwFormUrlencoded = "application/x-www-form-urlencoded"
case multipart_formData = "multipart/form-data"
case text_plain = "text/plain"
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Enctype: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Enctype(rawValue: expect) else {
throw AppError("Unexpected value for Enctype: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Enctype] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Enctype(rawValue: input), "unexpected value for Enctype: \(input)")
}
return result
}
}
public enum Method : String, CaseIterable {
case GET
case POST
case dialog
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Method: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Method(rawValue: expect) else {
throw AppError("Unexpected value for Method: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Method] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Method(rawValue: input), "unexpected value for Method: \(input)")
}
return result
}
}
/// Character encodings to use for form submission. ASCII case-insensitive match for "UTF-8".
public var accept_charset:String? = nil
/// URL to use for form submission. Valid non-empty URL potentially surrounded by spaces.
public var action:URL? = nil
/// Default setting for autofill feature for controls in the form.
public var autocomplete:Autocomplete? = nil
/// Entry list encoding type to use for form submission.
public var enctype:Enctype? = nil
/// Variant to use for form submission.
public var method:Method? = nil
/// Name of form to use in the document.forms API. Text. The actual rules are more complicated than indicated.
public var name:String? = nil
/// Bypass form control validation for form submission.
public var novalidate:Bool = false
/// Browsing context for form submission. Valid browsing context name or keyword.
public var target:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "accept-charset":
accept_charset = attValue
continue
case "action":
action = try URL(expect: attValue)
continue
case "autocomplete":
autocomplete = try Autocomplete(expect: attValue)
continue
case "enctype":
enctype = try Enctype(expect: attValue)
continue
case "method":
method = try Method(expect: attValue)
continue
case "name":
name = attValue
continue
case "novalidate":
novalidate = true
continue
case "target":
target = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "form", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let accept_charset = accept_charset {
result += " accept-charset='\(accept_charset)'"
}
if let action = action {
result += " action='\(action.absoluteString)'"
}
if let autocomplete = autocomplete {
result += " autocomplete='\(autocomplete.rawValue)'"
}
if let enctype = enctype {
result += " enctype='\(enctype.rawValue)'"
}
if let method = method {
result += " method='\(method.rawValue)'"
}
if let name = name {
result += " name='\(name)'"
}
if novalidate {
result += " novalidate"
}
if let target = target {
result += " target='\(target)'"
}
return result
}
override var nodeName: String {
return "form"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// H1.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <h1> Section heading
public class H1 : HTMLNode, IFlow, IHeading, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "h1", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "h1"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// H2.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <h2> Section heading
public class H2 : HTMLNode, IFlow, IHeading, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "h2", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "h2"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// H3.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <h3> Section heading
public class H3 : HTMLNode, IFlow, IHeading, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "h3", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "h3"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// H4.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <h4> Section heading
public class H4 : HTMLNode, IFlow, IHeading, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "h4", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "h4"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// H5.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <h5> Section heading
public class H5 : HTMLNode, IFlow, IHeading, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "h5", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "h5"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// H6.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <h6> Section heading
public class H6 : HTMLNode, IFlow, IHeading, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "h6", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "h6"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Head.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <head> Container for document metadata
public class Head : HTMLNode {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "head", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IMetaData) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "head"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Header.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <header> Introductory or navigational aids for a page or section
public class Header : HTMLNode, IFlow, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "header", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "header"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Hgroup.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <hgroup> heading group
public class Hgroup : HTMLNode, IFlow, IHeading, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "hgroup", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IScriptSupporting) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "hgroup"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,41 @@
//
// Hr.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <hr> Thematic break
public class Hr : HTMLNode, IFlow {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "hr"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,57 @@
//
// Html.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <html> Root element
public class Html : HTMLNode {
/// Application cache manifest. Valid non-empty URL potentially surrounded by spaces.
public var manifest:URL? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "manifest":
manifest = try URL(expect: attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "html", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let manifest = manifest {
result += " manifest='\(manifest.absoluteString)'"
}
return result
}
override var nodeName: String {
return "html"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// I.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <i> Alternate voice
public class I : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "i", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "i"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,136 @@
//
// Iframe.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <iframe> Nested browsing context
public class Iframe : HTMLNode, IEmbedded, IFlow, IInteractive, IPalpable, IPhrasing {
/// Feature policy to be applied to the iframe's contents. Serialized feature policy.
public var allow:String? = nil
/// Whether to allow the iframe's contents to use requestFullscreen().
public var allowfullscreen:Bool = false
/// Whether the iframe's contents are allowed to use the PaymentRequest interface to make payment requests.
public var allowpaymentrequest:Bool = false
/// Vertical dimension. Valid non-negative integer.
public var height:UInt? = nil
/// Name of nested browsing context. Valid browsing context name or keyword.
public var name:String? = nil
/// Referrer policy for fetches initiated by the element. Referrer policy.
public var referrerpolicy:ReferrerPolicy? = nil
/// Security rules for nested content. Unordered set of unique space-separated tokens, ASCII case-insensitive, consisting of "allow-forms", "allow-modals", "allow-orientation-lock", "allow-pointer-lock", "allow-popups", "allow-popups-to-escape-sandbox", "allow-presentation", "allow-same-origin", "allow-scripts" and "allow-top-navigation".
public var sandbox:Set<SandboxAttribute> = Set()
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
public var src:URL? = nil
/// A document to render in the iframe. The source of an iframe srcdoc document. The actual rules are more complicated than indicated.
public var srcdoc:String? = nil
/// Horizontal dimension. Valid non-negative integer.
public var width:UInt? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "allow":
allow = attValue
continue
case "allowfullscreen":
allowfullscreen = true
continue
case "allowpaymentrequest":
allowpaymentrequest = true
continue
case "height":
height = UInt(attValue)
continue
case "name":
name = attValue
continue
case "referrerpolicy":
referrerpolicy = try ReferrerPolicy(expect: attValue)
continue
case "sandbox":
sandbox = Set()
continue
case "src":
src = try URL(expect: attValue)
continue
case "srcdoc":
srcdoc = attValue
continue
case "width":
width = UInt(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "iframe", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let allow = allow {
result += " allow='\(allow)'"
}
if allowfullscreen {
result += " allowfullscreen"
}
if allowpaymentrequest {
result += " allowpaymentrequest"
}
if let height = height {
result += " height='\(height)'"
}
if let name = name {
result += " name='\(name)'"
}
if let referrerpolicy = referrerpolicy {
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
}
result += " sandbox='\(sandbox.toStringList(" "))'"
if let src = src {
result += " src='\(src.absoluteString)'"
}
if let srcdoc = srcdoc {
result += " srcdoc='\(srcdoc)'"
}
if let width = width {
result += " width='\(width)'"
}
return result
}
override var nodeName: String {
return "iframe"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,269 @@
//
// Img.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <img> Image
public class Img : HTMLNode, IEmbedded, IFlow, IFormAssociated, IInteractive, IPalpable, IPhrasing {
public enum Crossorigin : String, CaseIterable {
case anonymous
case useCredentials = "use-credentials"
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Crossorigin: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Crossorigin(rawValue: expect) else {
throw AppError("Unexpected value for Crossorigin: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Crossorigin] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Crossorigin(rawValue: input), "unexpected value for Crossorigin: \(input)")
}
return result
}
}
public enum Decoding : String, CaseIterable {
case async
case auto
case sync
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Decoding: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Decoding(rawValue: expect) else {
throw AppError("Unexpected value for Decoding: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Decoding] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Decoding(rawValue: input), "unexpected value for Decoding: \(input)")
}
return result
}
}
public enum Loading : String, CaseIterable {
case eager
case lazy
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Loading: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Loading(rawValue: expect) else {
throw AppError("Unexpected value for Loading: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Loading] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Loading(rawValue: input), "unexpected value for Loading: \(input)")
}
return result
}
}
/// Replacement text for use when images are not available. Text. The actual rules are more complicated than indicated.
public var alt:String? = nil
/// How the element handles crossorigin requests.
public var crossorigin:Crossorigin? = nil
/// Decoding hint to use when processing this image for presentation.
public var decoding:Decoding? = nil
/// Vertical dimension. Valid non-negative integer.
public var height:UInt? = nil
/// Whether the image is a server-side image map.
public var ismap:Bool = false
/// Used when determining loading deferral.
public var loading:Loading? = nil
/// Referrer policy for fetches initiated by the element. Referrer policy.
public var referrerpolicy:ReferrerPolicy? = nil
/// Image sizes for different page layouts. Valid source size list.
public var sizes:[String] = []
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
public var src:URL? = nil
/// Images to use in different situations (e.g., high-resolution displays, small monitors, etc.). Comma-separated list of image candidate strings.
public var srcset:[String] = []
/// Name of image map to use. Valid hash-name reference. The actual rules are more complicated than indicated.
public var usemap:String? = nil
/// Horizontal dimension. Valid non-negative integer.
public var width:UInt? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "alt":
alt = attValue
continue
case "crossorigin":
crossorigin = try Crossorigin(expect: attValue)
continue
case "decoding":
decoding = try Decoding(expect: attValue)
continue
case "height":
height = UInt(attValue)
continue
case "ismap":
ismap = true
continue
case "loading":
loading = try Loading(expect: attValue)
continue
case "referrerpolicy":
referrerpolicy = try ReferrerPolicy(expect: attValue)
continue
case "sizes":
sizes = try String.parseList(attValue, ",")
continue
case "src":
src = try URL(expect: attValue)
continue
case "srcset":
srcset = try String.parseList(attValue, ",")
continue
case "usemap":
usemap = attValue
continue
case "width":
width = UInt(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let alt = alt {
result += " alt='\(alt)'"
}
if let crossorigin = crossorigin {
result += " crossorigin='\(crossorigin.rawValue)'"
}
if let decoding = decoding {
result += " decoding='\(decoding.rawValue)'"
}
if let height = height {
result += " height='\(height)'"
}
if ismap {
result += " ismap"
}
if let loading = loading {
result += " loading='\(loading.rawValue)'"
}
if let referrerpolicy = referrerpolicy {
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
}
result += " sizes='\(sizes.toStringList(","))'"
if let src = src {
result += " src='\(src.absoluteString)'"
}
result += " srcset='\(srcset.toStringList(","))'"
if let usemap = usemap {
result += " usemap='\(usemap)'"
}
if let width = width {
result += " width='\(width)'"
}
return result
}
override var nodeName: String {
return "img"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,401 @@
//
// Input.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <input> Form control
public class Input : HTMLNode, IFlow, IFormAssociated, IInteractive, ILabelable, IListed, IPalpable, IPhrasing, IResettable, ISubmittable {
public enum Formenctype : String, CaseIterable {
case application_xWwwFormUrlencoded = "application/x-www-form-urlencoded"
case multipart_formData = "multipart/form-data"
case text_plain = "text/plain"
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Formenctype: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Formenctype(rawValue: expect) else {
throw AppError("Unexpected value for Formenctype: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Formenctype] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Formenctype(rawValue: input), "unexpected value for Formenctype: \(input)")
}
return result
}
}
public enum Formmethod : String, CaseIterable {
case GET
case POST
case dialog
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Formmethod: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Formmethod(rawValue: expect) else {
throw AppError("Unexpected value for Formmethod: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Formmethod] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Formmethod(rawValue: input), "unexpected value for Formmethod: \(input)")
}
return result
}
}
/// Hint for expected file type in file upload controls. Set of comma-separated tokens* consisting of valid MIME type strings with no parameters or audio/*, video/*, or image/. The actual rules are more complicated than indicated.
public var accept:[String] = []
/// Replacement text for use when images are not available. Text. The actual rules are more complicated than indicated.
public var alt:String? = nil
/// Hint for form autofill feature. Autofill field name and related tokens. The actual rules are more complicated than indicated.
public var autocomplete:String? = nil
/// Whether the control is checked.
public var checked:Bool = false
/// Name of form control to use for sending the element's directionality in form submission. Text. The actual rules are more complicated than indicated.
public var dirname:String? = nil
/// Whether the form control is disabled.
public var disabled:Bool = false
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
public var form:String? = nil
/// URL to use for form submission. Valid non-empty URL potentially surrounded by spaces.
public var formaction:URL? = nil
/// Entry list encoding type to use for form submission.
public var formenctype:Formenctype? = nil
/// Variant to use for form submission.
public var formmethod:Formmethod? = nil
/// Bypass form control validation for form submission.
public var formnovalidate:Bool = false
/// Browsing context for form submission. Valid browsing context name or keyword.
public var formtarget:String? = nil
/// Vertical dimension. Valid non-negative integer.
public var height:UInt? = nil
/// List of autocomplete options. ID. The actual rules are more complicated than indicated.
public var list:String? = nil
/// Maximum value. Varies. The actual rules are more complicated than indicated.
public var max:String? = nil
/// Maximum length of value. Valid non-negative integer.
public var maxlength:UInt? = nil
/// Minimum value. Varies. The actual rules are more complicated than indicated.
public var min:String? = nil
/// Minimum length of value. Valid non-negative integer.
public var minlength:UInt? = nil
/// Whether to allow multiple values.
public var multiple:Bool = false
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
public var name:String? = nil
/// Pattern to be matched by the form control's value. Regular expression matching the JavaScript Pattern production.
public var pattern:String? = nil
/// User-visible label to be placed within the form control. Text. The actual rules are more complicated than indicated.
public var placeholder:String? = nil
/// Whether to allow the value to be edited by the user.
public var readonly:Bool = false
/// Whether the control is required for form submission.
public var required:Bool = false
/// Size of the control. Valid non-negative integer greater than zero.
public var size:UInt? = nil
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
public var src:URL? = nil
/// Granularity to be matched by the form control's value. Valid floating-point number greater than zero, or "any".
public var step:Float? = nil
/// Description of pattern (when used with pattern attribute).
public var title:String? {
get { return globalAttributes[.title] }
set { globalAttributes[.title] = newValue }
}
/// Type of form control or Type of form control. input type keyword or An input type e.g. "text"
public var type:String? = nil
/// Value of the form control. Varies. The actual rules are more complicated than indicated.
public var value:String? = nil
/// Horizontal dimension. Valid non-negative integer.
public var width:UInt? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "accept":
accept = try String.parseList(attValue, ",")
continue
case "alt":
alt = attValue
continue
case "autocomplete":
autocomplete = attValue
continue
case "checked":
checked = true
continue
case "dirname":
dirname = attValue
continue
case "disabled":
disabled = true
continue
case "form":
form = attValue
continue
case "formaction":
formaction = try URL(expect: attValue)
continue
case "formenctype":
formenctype = try Formenctype(expect: attValue)
continue
case "formmethod":
formmethod = try Formmethod(expect: attValue)
continue
case "formnovalidate":
formnovalidate = true
continue
case "formtarget":
formtarget = attValue
continue
case "height":
height = UInt(attValue)
continue
case "list":
list = attValue
continue
case "max":
max = attValue
continue
case "maxlength":
maxlength = UInt(attValue)
continue
case "min":
min = attValue
continue
case "minlength":
minlength = UInt(attValue)
continue
case "multiple":
multiple = true
continue
case "name":
name = attValue
continue
case "pattern":
pattern = attValue
continue
case "placeholder":
placeholder = attValue
continue
case "readonly":
readonly = true
continue
case "required":
required = true
continue
case "size":
size = UInt(attValue)
continue
case "src":
src = try URL(expect: attValue)
continue
case "step":
step = Float(attValue)
continue
case "type":
type = attValue
continue
case "value":
value = attValue
continue
case "width":
width = UInt(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
result += " accept='\(accept.toStringList(","))'"
if let alt = alt {
result += " alt='\(alt)'"
}
if let autocomplete = autocomplete {
result += " autocomplete='\(autocomplete)'"
}
if checked {
result += " checked"
}
if let dirname = dirname {
result += " dirname='\(dirname)'"
}
if disabled {
result += " disabled"
}
if let form = form {
result += " form='\(form)'"
}
if let formaction = formaction {
result += " formaction='\(formaction.absoluteString)'"
}
if let formenctype = formenctype {
result += " formenctype='\(formenctype.rawValue)'"
}
if let formmethod = formmethod {
result += " formmethod='\(formmethod.rawValue)'"
}
if formnovalidate {
result += " formnovalidate"
}
if let formtarget = formtarget {
result += " formtarget='\(formtarget)'"
}
if let height = height {
result += " height='\(height)'"
}
if let list = list {
result += " list='\(list)'"
}
if let max = max {
result += " max='\(max)'"
}
if let maxlength = maxlength {
result += " maxlength='\(maxlength)'"
}
if let min = min {
result += " min='\(min)'"
}
if let minlength = minlength {
result += " minlength='\(minlength)'"
}
if multiple {
result += " multiple"
}
if let name = name {
result += " name='\(name)'"
}
if let pattern = pattern {
result += " pattern='\(pattern)'"
}
if let placeholder = placeholder {
result += " placeholder='\(placeholder)'"
}
if readonly {
result += " readonly"
}
if required {
result += " required"
}
if let size = size {
result += " size='\(size)'"
}
if let src = src {
result += " src='\(src.absoluteString)'"
}
if let step = step {
result += " step='\(step)'"
}
if let type = type {
result += " type='\(type)'"
}
if let value = value {
result += " value='\(value)'"
}
if let width = width {
result += " width='\(width)'"
}
return result
}
override var nodeName: String {
return "input"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,66 @@
//
// Ins.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <ins> An addition to the document
public class Ins : HTMLNode, IFlow, IPalpable, IPhrasing {
/// Link to the source of the quotation or more information about the edit. Valid URL potentially surrounded by spaces.
public var cite:URL? = nil
/// Date and (optionally) time of the change. Valid date string with optional time.
public var datetime:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "cite":
cite = try URL(expect: attValue)
continue
case "datetime":
datetime = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "ins", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let cite = cite {
result += " cite='\(cite.absoluteString)'"
}
if let datetime = datetime {
result += " datetime='\(datetime)'"
}
return result
}
override var nodeName: String {
return "ins"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Kbd.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <kbd> User input
public class Kbd : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "kbd", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "kbd"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,61 @@
//
// Label.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <label> Caption for a form control
public class Label : HTMLNode, IFlow, IInteractive, IPalpable, IPhrasing {
/// Associate the label with form control. ID. The actual rules are more complicated than indicated.
public var for_:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "for":
for_ = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "label", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let for_ = for_ {
result += " for='\(for_)'"
}
return result
}
override var nodeName: String {
return "label"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,53 @@
//
// Legend.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <legend> Caption for fieldset
public class Legend : HTMLNode {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "legend", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IHeading) {
children.append(someElement)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "legend"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,61 @@
//
// Li.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <li> List item
public class Li : HTMLNode {
/// Ordinal value of the list item. Valid integer.
public var value:Int? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "value":
value = Int(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "li", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let value = value {
result += " value='\(value)'"
}
return result
}
override var nodeName: String {
return "li"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,193 @@
//
// Link.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <link> Link metadata
public class Link : HTMLNode, IFlow, IMetaData, IPhrasing {
public enum Crossorigin : String, CaseIterable {
case anonymous
case useCredentials = "use-credentials"
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Crossorigin: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Crossorigin(rawValue: expect) else {
throw AppError("Unexpected value for Crossorigin: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Crossorigin] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Crossorigin(rawValue: input), "unexpected value for Crossorigin: \(input)")
}
return result
}
}
/// Potential destination for a preload request (for rel="preload" and rel="modulepreload"). Potential destination, for rel="preload"; script-like destination, for rel="modulepreload".
public var as_:String? = nil
/// How the element handles crossorigin requests.
public var crossorigin:Crossorigin? = nil
/// Address of the hyperlink. Valid non-empty URL potentially surrounded by spaces.
public var href:URL? = nil
/// Language of the linked resource. Valid BCP 47 language tag.
public var hreflang:String? = nil
/// Image sizes for different page layouts. Valid source size list.
public var imagesizes:[String] = []
/// Images to use in different situations (e.g., high-resolution displays, small monitors, etc.). Comma-separated list of image candidate strings.
public var imagesrcset:[String] = []
/// Integrity metadata used in Subresource Integrity checks [SRI].
public var integrity:String? = nil
/// Applicable media. Valid media query list.
public var media:String? = nil
/// Referrer policy for fetches initiated by the element. Referrer policy.
public var referrerpolicy:ReferrerPolicy? = nil
/// Relationship between the document containing the hyperlink and the destination resource. Unordered set of unique space-separated tokens. The actual rules are more complicated than indicated.
public var rel:[String] = []
/// Sizes of the icons (for rel="icon"). Unordered set of unique space-separated tokens, ASCII case-insensitive, consisting of sizes. The actual rules are more complicated than indicated.
public var sizes:[String] = []
/// Title of the link or CSS style sheet set name. Text or Text
public var title:String? = nil
/// Hint for the type of the referenced resource. Valid MIME type string.
public var type:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "as":
as_ = attValue
continue
case "crossorigin":
crossorigin = try Crossorigin(expect: attValue)
continue
case "href":
href = try URL(expect: attValue)
continue
case "hreflang":
hreflang = attValue
continue
case "imagesizes":
imagesizes = try String.parseList(attValue, ",")
continue
case "imagesrcset":
imagesrcset = try String.parseList(attValue, ",")
continue
case "integrity":
integrity = attValue
continue
case "media":
media = attValue
continue
case "referrerpolicy":
referrerpolicy = try ReferrerPolicy(expect: attValue)
continue
case "rel":
rel = try String.parseList(attValue, " ")
continue
case "sizes":
sizes = try String.parseList(attValue, " ")
continue
case "title":
title = attValue
continue
case "type":
type = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let as_ = as_ {
result += " as='\(as_)'"
}
if let crossorigin = crossorigin {
result += " crossorigin='\(crossorigin.rawValue)'"
}
if let href = href {
result += " href='\(href.absoluteString)'"
}
if let hreflang = hreflang {
result += " hreflang='\(hreflang)'"
}
result += " imagesizes='\(imagesizes.toStringList(","))'"
result += " imagesrcset='\(imagesrcset.toStringList(","))'"
if let integrity = integrity {
result += " integrity='\(integrity)'"
}
if let media = media {
result += " media='\(media)'"
}
if let referrerpolicy = referrerpolicy {
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
}
result += " rel='\(rel.toStringList(" "))'"
result += " sizes='\(sizes.toStringList(" "))'"
if let title = title {
result += " title='\(title)'"
}
if let type = type {
result += " type='\(type)'"
}
return result
}
override var nodeName: String {
return "link"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,49 @@
//
// Main.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <main> Container for the dominant contents of the document
public class Main : HTMLNode, IFlow, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "main", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "main"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,57 @@
//
// Map.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <map> Image map
public class Map : HTMLNode, IFlow, IPalpable, IPhrasing {
/// Name of image map to reference from the usemap attribute. Text. The actual rules are more complicated than indicated.
public var name:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "name":
name = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "map", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let name = name {
result += " name='\(name)'"
}
return result
}
override var nodeName: String {
return "map"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Mark.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <mark> Highlight
public class Mark : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "mark", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "mark"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Menu.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <menu> Menu of commands
public class Menu : HTMLNode, IFlow, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "menu", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IScriptSupporting) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "menu"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,162 @@
//
// Meta.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <meta> Text metadata
public class Meta : HTMLNode, IFlow, IMetaData, IPhrasing {
public enum Charset : String, CaseIterable {
case utf8 = "utf-8"
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Charset: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Charset(rawValue: expect) else {
throw AppError("Unexpected value for Charset: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Charset] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Charset(rawValue: input), "unexpected value for Charset: \(input)")
}
return result
}
}
public enum Http_equiv : String, CaseIterable {
case contentSecurityPolicy = "content-security-policy"
case contentType = "content-type"
case defaultStyle = "default-style"
case refresh
case xUaCompatible = "x-ua-compatible"
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Http_equiv: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Http_equiv(rawValue: expect) else {
throw AppError("Unexpected value for Http_equiv: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Http_equiv] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Http_equiv(rawValue: input), "unexpected value for Http_equiv: \(input)")
}
return result
}
}
/// Character encoding declaration.
public var charset:Charset? = nil
/// Value of the element. Text. The actual rules are more complicated than indicated.
public var content:String? = nil
/// Pragma directive.
public var http_equiv:Http_equiv? = nil
/// Metadata name. Text. The actual rules are more complicated than indicated.
public var name:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "charset":
charset = try Charset(expect: attValue)
continue
case "content":
content = attValue
continue
case "http-equiv":
http_equiv = try Http_equiv(expect: attValue)
continue
case "name":
name = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let charset = charset {
result += " charset='\(charset.rawValue)'"
}
if let content = content {
result += " content='\(content)'"
}
if let http_equiv = http_equiv {
result += " http-equiv='\(http_equiv.rawValue)'"
}
if let name = name {
result += " name='\(name)'"
}
return result
}
override var nodeName: String {
return "meta"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,106 @@
//
// Meter.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <meter> Gauge
public class Meter : HTMLNode, IFlow, ILabelable, IPalpable, IPhrasing {
/// Low limit of high range. Valid floating-point number. The actual rules are more complicated than indicated.
public var high:Float? = nil
/// High limit of low range. Valid floating-point number. The actual rules are more complicated than indicated.
public var low:Float? = nil
/// Upper bound of range. Valid floating-point number. The actual rules are more complicated than indicated.
public var max:Float? = nil
/// Lower bound of range. Valid floating-point number. The actual rules are more complicated than indicated.
public var min:Float? = nil
/// Optimum value in gauge. Valid floating-point number. The actual rules are more complicated than indicated.
public var optimum:Float? = nil
/// Current value of the element. Valid floating-point number.
public var value:Float? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "high":
high = Float(attValue)
continue
case "low":
low = Float(attValue)
continue
case "max":
max = Float(attValue)
continue
case "min":
min = Float(attValue)
continue
case "optimum":
optimum = Float(attValue)
continue
case "value":
value = Float(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "meter", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let high = high {
result += " high='\(high)'"
}
if let low = low {
result += " low='\(low)'"
}
if let max = max {
result += " max='\(max)'"
}
if let min = min {
result += " min='\(min)'"
}
if let optimum = optimum {
result += " optimum='\(optimum)'"
}
if let value = value {
result += " value='\(value)'"
}
return result
}
override var nodeName: String {
return "meter"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Nav.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <nav> Section with navigational links
public class Nav : HTMLNode, IFlow, IPalpable, ISectioning {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "nav", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "nav"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,45 @@
//
// Noscript.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <noscript> Fallback content for script
public class Noscript : HTMLNode, IFlow, IMetaData, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "noscript", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "noscript"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,111 @@
//
// Object.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <object> Image, nested browsing context, or plugin
public class Object : HTMLNode, IEmbedded, IFlow, IFormAssociated, IInteractive, IListed, IPalpable, IPhrasing, ISubmittable {
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
public var data:URL? = nil
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
public var form:String? = nil
/// Vertical dimension. Valid non-negative integer.
public var height:UInt? = nil
/// Name of nested browsing context. Valid browsing context name or keyword.
public var name:String? = nil
/// Type of embedded resource. Valid MIME type string.
public var type:String? = nil
/// Name of image map to use. Valid hash-name reference. The actual rules are more complicated than indicated.
public var usemap:String? = nil
/// Horizontal dimension. Valid non-negative integer.
public var width:UInt? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "data":
data = try URL(expect: attValue)
continue
case "form":
form = attValue
continue
case "height":
height = UInt(attValue)
continue
case "name":
name = attValue
continue
case "type":
type = attValue
continue
case "usemap":
usemap = attValue
continue
case "width":
width = UInt(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "object", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let data = data {
result += " data='\(data.absoluteString)'"
}
if let form = form {
result += " form='\(form)'"
}
if let height = height {
result += " height='\(height)'"
}
if let name = name {
result += " name='\(name)'"
}
if let type = type {
result += " type='\(type)'"
}
if let usemap = usemap {
result += " usemap='\(usemap)'"
}
if let width = width {
result += " width='\(width)'"
}
return result
}
override var nodeName: String {
return "object"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,122 @@
//
// Ol.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <ol> Ordered list
public class Ol : HTMLNode, IFlow, IPalpable {
public enum AttrType : String, CaseIterable {
case one = "1"
case A
case I
case a
case i
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for AttrType: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = AttrType(rawValue: expect) else {
throw AppError("Unexpected value for AttrType: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [AttrType] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(AttrType(rawValue: input), "unexpected value for AttrType: \(input)")
}
return result
}
}
/// Number the list backwards.
public var reversed:Bool = false
/// Starting value of the list. Valid integer.
public var start:Int? = nil
/// Kind of list marker.
public var type:AttrType? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "reversed":
reversed = true
continue
case "start":
start = Int(attValue)
continue
case "type":
type = try AttrType(expect: attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "ol", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IScriptSupporting) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if reversed {
result += " reversed"
}
if let start = start {
result += " start='\(start)'"
}
if let type = type {
result += " type='\(type.rawValue)'"
}
return result
}
override var nodeName: String {
return "ol"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,70 @@
//
// Optgroup.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <optgroup> Group of options in a list box
public class Optgroup : HTMLNode {
/// Whether the form control is disabled.
public var disabled:Bool = false
/// User-visible label.
public var label:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "disabled":
disabled = true
continue
case "label":
label = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "optgroup", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IScriptSupporting) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if disabled {
result += " disabled"
}
if let label = label {
result += " label='\(label)'"
}
return result
}
override var nodeName: String {
return "optgroup"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,84 @@
//
// Option.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <option> Option in a list box or combo box control
public class Option : HTMLNode {
/// Whether the form control is disabled.
public var disabled:Bool = false
/// User-visible label.
public var label:String? = nil
/// Whether the option is selected by default.
public var selected:Bool = false
/// Value to be used for form submission.
public var value:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "disabled":
disabled = true
continue
case "label":
label = attValue
continue
case "selected":
selected = true
continue
case "value":
value = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "option", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if disabled {
result += " disabled"
}
if let label = label {
result += " label='\(label)'"
}
if selected {
result += " selected"
}
if let value = value {
result += " value='\(value)'"
}
return result
}
override var nodeName: String {
return "option"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,77 @@
//
// Output.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <output> Calculated output value
public class Output : HTMLNode, IFlow, IFormAssociated, ILabelable, IListed, IPalpable, IPhrasing, IResettable {
/// Specifies controls from which the output was calculated. Unordered set of unique space-separated tokens, case-sensitive, consisting of IDs. The actual rules are more complicated than indicated.
public var for_:[String] = []
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
public var form:String? = nil
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
public var name:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "for":
for_ = try String.parseList(attValue, " ")
continue
case "form":
form = attValue
continue
case "name":
name = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "output", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
result += " for='\(for_.toStringList(" "))'"
if let form = form {
result += " form='\(form)'"
}
if let name = name {
result += " name='\(name)'"
}
return result
}
override var nodeName: String {
return "output"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// P.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <p> Paragraph
public class P : HTMLNode, IFlow, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "p", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "p"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,62 @@
//
// Param.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <param> Parameter for object
public class Param : HTMLNode {
/// Name of parameter.
public var name:String? = nil
/// Value of parameter.
public var value:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "name":
name = attValue
continue
case "value":
value = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let name = name {
result += " name='\(name)'"
}
if let value = value {
result += " value='\(value)'"
}
return result
}
override var nodeName: String {
return "param"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,53 @@
//
// Picture.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <picture> Image
public class Picture : HTMLNode, IEmbedded, IFlow, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "picture", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IScriptSupporting) {
children.append(someElement)
}
public func addChild(_ someElement:Img) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "picture"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Pre.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <pre> Block of preformatted text
public class Pre : HTMLNode, IFlow, IPalpable {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "pre", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "pre"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,70 @@
//
// Progress.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <progress> Progress bar
public class Progress : HTMLNode, IFlow, ILabelable, IPalpable, IPhrasing {
/// Upper bound of range. Valid floating-point number. The actual rules are more complicated than indicated.
public var max:Float? = nil
/// Current value of the element. Valid floating-point number.
public var value:Float? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "max":
max = Float(attValue)
continue
case "value":
value = Float(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "progress", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let max = max {
result += " max='\(max)'"
}
if let value = value {
result += " value='\(value)'"
}
return result
}
override var nodeName: String {
return "progress"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,61 @@
//
// Q.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <q> Quotation
public class Q : HTMLNode, IFlow, IPalpable, IPhrasing {
/// Link to the source of the quotation or more information about the edit. Valid URL potentially surrounded by spaces.
public var cite:URL? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "cite":
cite = try URL(expect: attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "q", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let cite = cite {
result += " cite='\(cite.absoluteString)'"
}
return result
}
override var nodeName: String {
return "q"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,45 @@
//
// Rp.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <rp> Parenthesis for ruby annotation text
public class Rp : HTMLNode {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "rp", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "rp"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Rt.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <rt> Ruby annotation text
public class Rt : HTMLNode {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "rt", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "rt"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Ruby.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <ruby> Ruby annotation(s)
public class Ruby : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "ruby", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "ruby"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// S.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <s> Inaccurate text
public class S : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "s", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "s"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Samp.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <samp> Computer output
public class Samp : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "samp", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "samp"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,151 @@
//
// Script.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <script> Embedded script
public class Script : HTMLNode, IFlow, IMetaData, IPhrasing, IScriptSupporting {
public enum Crossorigin : String, CaseIterable {
case anonymous
case useCredentials = "use-credentials"
public init?(rawValue: Substring) {
guard
let value = Self.allCases.first(where: { $0.rawValue == rawValue })
else
{ return nil }
self = value
}
public init(expect: Substring) throws {
guard
let value = Self.allCases.first(where: { $0.rawValue == expect })
else
{ throw AppError("Unexpected value for Crossorigin: \(expect)") }
self = value
}
public init(expect: String) throws {
guard let result = Crossorigin(rawValue: expect) else {
throw AppError("Unexpected value for Crossorigin: \(expect)")
}
self = result
}
static func parseList(_ value:String?, _ separator:String = " ") throws -> [Crossorigin] {
guard let value = value else { return [] }
var iterator = value.componentsIterator(separatedBy: separator)
let result = try iterator.map { input in
return try expect(Crossorigin(rawValue: input), "unexpected value for Crossorigin: \(input)")
}
return result
}
}
/// Execute script when available, without blocking while fetching.
public var async:Bool = false
/// How the element handles crossorigin requests.
public var crossorigin:Crossorigin? = nil
/// Defer script execution.
public var defer_:Bool = false
/// Integrity metadata used in Subresource Integrity checks [SRI].
public var integrity:String? = nil
/// Referrer policy for fetches initiated by the element. Referrer policy.
public var referrerpolicy:ReferrerPolicy? = nil
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
public var src:URL? = nil
/// Type of script. "module"; a valid MIME type string that is not a JavaScript MIME type essence match.
public var type:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "async":
async = true
continue
case "crossorigin":
crossorigin = try Crossorigin(expect: attValue)
continue
case "defer":
defer_ = true
continue
case "integrity":
integrity = attValue
continue
case "referrerpolicy":
referrerpolicy = try ReferrerPolicy(expect: attValue)
continue
case "src":
src = try URL(expect: attValue)
continue
case "type":
type = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "script", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if async {
result += " async"
}
if let crossorigin = crossorigin {
result += " crossorigin='\(crossorigin.rawValue)'"
}
if defer_ {
result += " defer"
}
if let integrity = integrity {
result += " integrity='\(integrity)'"
}
if let referrerpolicy = referrerpolicy {
result += " referrerpolicy='\(referrerpolicy.rawValue)'"
}
if let src = src {
result += " src='\(src.absoluteString)'"
}
if let type = type {
result += " type='\(type)'"
}
return result
}
override var nodeName: String {
return "script"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Section.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <section> Generic document or application section
public class Section : HTMLNode, IFlow, IPalpable, ISectioning {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "section", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IFlow) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "section"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,115 @@
//
// Select.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <select> List box control
public class Select : HTMLNode, IFlow, IFormAssociated, IInteractive, ILabelable, IListed, IPalpable, IPhrasing, IResettable, ISubmittable {
/// Hint for form autofill feature. Autofill field name and related tokens. The actual rules are more complicated than indicated.
public var autocomplete:String? = nil
/// Whether the form control is disabled.
public var disabled:Bool = false
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
public var form:String? = nil
/// Whether to allow multiple values.
public var multiple:Bool = false
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
public var name:String? = nil
/// Whether the control is required for form submission.
public var required:Bool = false
/// Size of the control. Valid non-negative integer greater than zero.
public var size:UInt? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "autocomplete":
autocomplete = attValue
continue
case "disabled":
disabled = true
continue
case "form":
form = attValue
continue
case "multiple":
multiple = true
continue
case "name":
name = attValue
continue
case "required":
required = true
continue
case "size":
size = UInt(attValue)
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "select", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IScriptSupporting) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let autocomplete = autocomplete {
result += " autocomplete='\(autocomplete)'"
}
if disabled {
result += " disabled"
}
if let form = form {
result += " form='\(form)'"
}
if multiple {
result += " multiple"
}
if let name = name {
result += " name='\(name)'"
}
if required {
result += " required"
}
if let size = size {
result += " size='\(size)'"
}
return result
}
override var nodeName: String {
return "select"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,57 @@
//
// Slot.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <slot> Shadow tree slot
public class Slot : HTMLNode, IFlow, IPhrasing {
/// Name of shadow tree slot.
public var name:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "name":
name = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "slot", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let name = name {
result += " name='\(name)'"
}
return result
}
override var nodeName: String {
return "slot"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Small.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <small> Side comment
public class Small : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "small", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "small"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,85 @@
//
// Source.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <source> Image source for img or media source for video or audio
public class Source : HTMLNode {
/// Applicable media. Valid media query list.
public var media:String? = nil
/// Image sizes for different page layouts. Valid source size list.
public var sizes:[String] = []
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
public var src:URL? = nil
/// Images to use in different situations (e.g., high-resolution displays, small monitors, etc.). Comma-separated list of image candidate strings.
public var srcset:[String] = []
/// Type of embedded resource. Valid MIME type string.
public var type:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "media":
media = attValue
continue
case "sizes":
sizes = try String.parseList(attValue, ",")
continue
case "src":
src = try URL(expect: attValue)
continue
case "srcset":
srcset = try String.parseList(attValue, ",")
continue
case "type":
type = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let media = media {
result += " media='\(media)'"
}
result += " sizes='\(sizes.toStringList(","))'"
if let src = src {
result += " src='\(src.absoluteString)'"
}
result += " srcset='\(srcset.toStringList(","))'"
if let type = type {
result += " type='\(type)'"
}
return result
}
override var nodeName: String {
return "source"
}
override var isVoidElement: Bool {
return true
}
}

View File

@@ -0,0 +1,49 @@
//
// Span.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <span> Generic phrasing container
public class Span : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "span", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "span"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Strong.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <strong> Importance
public class Strong : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "strong", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "strong"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,64 @@
//
// Style.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <style> Embedded styling information
public class Style : HTMLNode, IMetaData {
/// Applicable media. Valid media query list.
public var media:String? = nil
/// CSS style sheet set name.
public var title:String? {
get { return globalAttributes[.title] }
set { globalAttributes[.title] = newValue }
}
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "media":
media = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "style", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let media = media {
result += " media='\(media)'"
}
return result
}
override var nodeName: String {
return "style"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Sub.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <sub> Subscript
public class Sub : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "sub", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "sub"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,53 @@
//
// Summary.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <summary> Caption for details
public class Summary : HTMLNode {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "summary", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IHeading) {
children.append(someElement)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "summary"
}
override var isVoidElement: Bool {
return false
}
}

View File

@@ -0,0 +1,49 @@
//
// Sup.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <sup> Superscript
public class Sup : HTMLNode, IFlow, IPalpable, IPhrasing {
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
throw AppError("Unexpected attribute: \(key)")
}
var allItems:[HTMLNode] = []
while let obj = try parser?.readObject(endTag: "sup", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public func addChild(_ someElement:IPhrasing) {
children.append(someElement)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
return result
}
override var nodeName: String {
return "sup"
}
override var isVoidElement: Bool {
return false
}
}

Some files were not shown because too many files have changed in this diff Show More