// // Td.swift // HTMLStandard // // Generated on 09/23/2025. // THIS FILE IS GENERATED. DO NOT EDIT. // import Foundation /// Table cell public class Td : HTMLNode, ISectioningRoot { /// Number of columns that the cell is to span. Valid non-negative integer greater than zero. public var colspan:UInt? = nil /// The header cells for this cell. Unordered set of unique space-separated tokens, case-sensitive, consisting of IDs. The actual rules are more complicated than indicated. public var headers:[String] = [] /// Number of rows that the cell is to span. Valid non-negative integer. public var rowspan:UInt? = nil public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws { var globalAttr = GlobalAttributesBuilder() for (key, attValue) in attributes { switch (key) { case "colspan": colspan = UInt(attValue) continue case "headers": headers = try String.parseList(attValue, " ") continue case "rowspan": rowspan = 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: "td", 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 colspan = colspan { result += " colspan='\(colspan)'" } result += " headers='\(headers.toStringList(" "))'" if let rowspan = rowspan { result += " rowspan='\(rowspan)'" } return result } override var nodeName: String { return "td" } override var isVoidElement: Bool { return false } }