HTMLParserOptions
public struct HTMLParserOptions: OptionSet
This is the set of HTML parser options that can be passed down
to the HTMLDocument initializers.
-
The corresponding value of the raw type.
A new instance initialized with
rawValuewill be equivalent to this instance. For example:enum PaperSize: String { case A4, A5, Letter, Legal } let selectedSize = PaperSize.Letter print(selectedSize.rawValue) // Prints "Letter" print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!) // Prints "true"Declaration
Swift
public var rawValue: UInt = 0 -
Creates a new option set from the given raw value.
This initializer always succeeds, even if the value passed as
rawValueexceeds the static properties declared as part of the option set. This example creates an instance ofShippingOptionswith a raw value beyond the highest element, with a bit mask that effectively contains all the declared static members.let extraOptions = ShippingOptions(rawValue: 255) print(extraOptions.isStrictSuperset(of: .all)) // Prints "true"Parameter
Parameter rawValue: The raw value of the option set to create. Each bit ofrawValuepotentially represents an element of the option set, though raw values may include bits that are not defined as distinct values of theOptionSettype.Declaration
Swift
public init(rawValue: UInt)Parameters
rawValueThe raw value of the option set to create. Each bit of
rawValuepotentially represents an element of the option set, though raw values may include bits that are not defined as distinct values of theOptionSettype. -
Creates a new instance of
XMLParserOptionsinitialized with zero raw value.Declaration
Swift
public static var allZeros: HTMLParserOptions -
Default parsing option.
Equivalent to
[.relaxedParsing, .noError, .noWarning].Declaration
Swift
public static let `default`: HTMLParserOptions = [.relaxedParsing, .noError, .noWarning] -
Relaxed parsing.
Corresponding libxml2 enum case:
HTML_PARSE_RECOVERDeclaration
Swift
public static let relaxedParsing = HTMLParserOptions(HTML_PARSE_RECOVER) -
Do not default a doctype if not found.
Corresponding libxml2 enum case:
HTML_PARSE_NODEFDTDDeclaration
Swift
public static let noDefaultDTD = HTMLParserOptions(HTML_PARSE_NODEFDTD) -
Suppress error reports.
Corresponding libxml2 enum case:
HTML_PARSE_NOERRORDeclaration
Swift
public static let noError = HTMLParserOptions(HTML_PARSE_NOERROR) -
Suppress warning reports.
Corresponding libxml2 enum case:
HTML_PARSE_NOWARNINGDeclaration
Swift
public static let noWarning = HTMLParserOptions(HTML_PARSE_NOWARNING) -
Pedantic error reporting.
Corresponding libxml2 enum case:
HTML_PARSE_PEDANTICDeclaration
Swift
public static let pedantic = HTMLParserOptions(HTML_PARSE_PEDANTIC) -
Remove blank nodes.
Corresponding libxml2 enum case:
HTML_PARSE_NOBLANKSDeclaration
Swift
public static let noBlankNodes = HTMLParserOptions(HTML_PARSE_NOBLANKS) -
Forbid network access.
Corresponding libxml2 enum case:
HTML_PARSE_NONETDeclaration
Swift
public static let forbidNetworkAccess = HTMLParserOptions(HTML_PARSE_NONET) -
Do not add implied html/body… elements.
Corresponding libxml2 enum case:
HTML_PARSE_NOIMPLIEDDeclaration
Swift
public static let noImpliedElements = HTMLParserOptions(HTML_PARSE_NOIMPLIED) -
Compact small text nodes.
Corresponding libxml2 enum case:
HTML_PARSE_COMPACTDeclaration
Swift
public static let compact = HTMLParserOptions(HTML_PARSE_COMPACT) -
Ignore internal document encoding hint.
Corresponding libxml2 enum case:
HTML_PARSE_IGNORE_ENCDeclaration
Swift
public static let ignoreEncoding = HTMLParserOptions(HTML_PARSE_IGNORE_ENC)
HTMLParserOptions Struct Reference