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 rawValue will 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 rawValue exceeds the static properties declared as part of the option set. This example creates an instance of ShippingOptions with 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 of rawValue potentially represents an element of the option set, though raw values may include bits that are not defined as distinct values of the OptionSet type.

    Declaration

    Swift

    public init(rawValue: UInt)

    Parameters

    rawValue

    The raw value of the option set to create. Each bit of rawValue potentially represents an element of the option set, though raw values may include bits that are not defined as distinct values of the OptionSet type.

  • Creates a new instance of XMLParserOptions initialized 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]
  • Strict parsing Equivalent to .allZeros.

    Declaration

    Swift

    public static let strict = HTMLParserOptions.allZeros
  • Relaxed parsing.

    Corresponding libxml2 enum case: HTML_PARSE_RECOVER

    Declaration

    Swift

    public static let relaxedParsing = HTMLParserOptions(HTML_PARSE_RECOVER)
  • Do not default a doctype if not found.

    Corresponding libxml2 enum case: HTML_PARSE_NODEFDTD

    Declaration

    Swift

    public static let noDefaultDTD = HTMLParserOptions(HTML_PARSE_NODEFDTD)
  • Suppress error reports.

    Corresponding libxml2 enum case: HTML_PARSE_NOERROR

    Declaration

    Swift

    public static let noError = HTMLParserOptions(HTML_PARSE_NOERROR)
  • Suppress warning reports.

    Corresponding libxml2 enum case: HTML_PARSE_NOWARNING

    Declaration

    Swift

    public static let noWarning = HTMLParserOptions(HTML_PARSE_NOWARNING)
  • Pedantic error reporting.

    Corresponding libxml2 enum case: HTML_PARSE_PEDANTIC

    Declaration

    Swift

    public static let pedantic = HTMLParserOptions(HTML_PARSE_PEDANTIC)
  • Remove blank nodes.

    Corresponding libxml2 enum case: HTML_PARSE_NOBLANKS

    Declaration

    Swift

    public static let noBlankNodes = HTMLParserOptions(HTML_PARSE_NOBLANKS)
  • Forbid network access.

    Corresponding libxml2 enum case: HTML_PARSE_NONET

    Declaration

    Swift

    public static let forbidNetworkAccess = HTMLParserOptions(HTML_PARSE_NONET)
  • Do not add implied html/body… elements.

    Corresponding libxml2 enum case: HTML_PARSE_NOIMPLIED

    Declaration

    Swift

    public static let noImpliedElements = HTMLParserOptions(HTML_PARSE_NOIMPLIED)
  • Compact small text nodes.

    Corresponding libxml2 enum case: HTML_PARSE_COMPACT

    Declaration

    Swift

    public static let compact = HTMLParserOptions(HTML_PARSE_COMPACT)
  • Ignore internal document encoding hint.

    Corresponding libxml2 enum case: HTML_PARSE_IGNORE_ENC

    Declaration

    Swift

    public static let ignoreEncoding = HTMLParserOptions(HTML_PARSE_IGNORE_ENC)