XMLParserOptions
public struct XMLParserOptions: OptionSet
This is the set of XML parser options that can be passed down
to the XMLDocument
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 ofShippingOptions
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 ofrawValue
potentially represents an element of the option set, though raw values may include bits that are not defined as distinct values of theOptionSet
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 theOptionSet
type. -
Default parsing option.
Equivalent to
[.recoverOnErrors, .noError, .noWarning]
.Declaration
Swift
public static let `default`: XMLParserOptions = [.recoverOnErrors, .noError, .noWarning]
-
Creates a new instance of
XMLParserOptions
initialized with zero raw value.Declaration
Swift
public static var allZeros: XMLParserOptions
-
Recover on errors.
Corresponding libxml2 enum case:
XML_PARSE_RECOVER
Declaration
Swift
public static let recoverOnErrors = XMLParserOptions(XML_PARSE_RECOVER)
-
Substitute entities.
Corresponding libxml2 enum case:
XML_PARSE_NOENT
Declaration
Swift
public static let substituteEntities = XMLParserOptions(XML_PARSE_NOENT)
-
Load the external subset.
Corresponding libxml2 enum case:
XML_PARSE_DTDLOAD
Declaration
Swift
public static let loadExternalSubset = XMLParserOptions(XML_PARSE_DTDLOAD)
-
Default DTD attributes.
Corresponding libxml2 enum case:
XML_PARSE_DTDATTR
Declaration
Swift
public static let defaultDTDAttributes = XMLParserOptions(XML_PARSE_DTDATTR)
-
Validate with the DTD.
Corresponding libxml2 enum case:
XML_PARSE_DTDVALID
Declaration
Swift
public static let validateWithDTD = XMLParserOptions(XML_PARSE_DTDVALID)
-
Suppress error reports.
Corresponding libxml2 enum case:
XML_PARSE_NOERROR
Declaration
Swift
public static let noError = XMLParserOptions(XML_PARSE_NOERROR)
-
Suppress warning reports.
Corresponding libxml2 enum case:
XML_PARSE_NOWARNING
Declaration
Swift
public static let noWarning = XMLParserOptions(XML_PARSE_NOWARNING)
-
Pedantic error reporting.
Corresponding libxml2 enum case:
XML_PARSE_PEDANTIC
Declaration
Swift
public static let pedantic = XMLParserOptions(XML_PARSE_PEDANTIC)
-
Remove blank nodes.
Corresponding libxml2 enum case:
XML_PARSE_NOBLANKS
Declaration
Swift
public static let noBlankNodes = XMLParserOptions(XML_PARSE_NOBLANKS)
-
Use the SAX1 interface internally.
Corresponding libxml2 enum case:
XML_PARSE_SAX1
Declaration
Swift
public static let useSAX1 = XMLParserOptions(XML_PARSE_SAX1)
-
Implement XInclude substitition.
Corresponding libxml2 enum case:
XML_PARSE_XINCLUDE
Declaration
Swift
public static let xInclude = XMLParserOptions(XML_PARSE_XINCLUDE)
-
Forbid network access.
Corresponding libxml2 enum case:
XML_PARSE_NONET
Declaration
Swift
public static let forbidNetworkAccess = XMLParserOptions(XML_PARSE_NONET)
-
Do not reuse the context dictionary.
Corresponding libxml2 enum case:
XML_PARSE_NODICT
Declaration
Swift
public static let noContextDictionary = XMLParserOptions(XML_PARSE_NODICT)
-
Remove redundant namespaces declarations.
Corresponding libxml2 enum case:
XML_PARSE_NSCLEAN
Declaration
Swift
public static let cleanNamespace = XMLParserOptions(XML_PARSE_NSCLEAN)
-
Merge CDATA as text nodes.
Corresponding libxml2 enum case:
XML_PARSE_NOCDATA
Declaration
Swift
public static let noCDATA = XMLParserOptions(XML_PARSE_NOCDATA)
-
Do not generate XINCLUDE START/END nodes.
Corresponding libxml2 enum case:
XML_PARSE_NOXINCNODE
Declaration
Swift
public static let noXIncludeNodes = XMLParserOptions(XML_PARSE_NOXINCNODE)
-
Compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree).
Corresponding libxml2 enum case:
XML_PARSE_COMPACT
Declaration
Swift
public static let compact = XMLParserOptions(XML_PARSE_COMPACT)
-
Parse using XML-1.0 before update 5.
Corresponding libxml2 enum case:
XML_PARSE_OLD10
Declaration
Swift
public static let old10 = XMLParserOptions(XML_PARSE_OLD10)
-
Do not fixup XINCLUDE xml:base uris.
Corresponding libxml2 enum case:
XML_PARSE_NOBASEFIX
Declaration
Swift
public static let noBasefix = XMLParserOptions(XML_PARSE_NOBASEFIX)
-
Relax any hardcoded limit from the parser.
Corresponding libxml2 enum case:
XML_PARSE_HUGE
Declaration
Swift
public static let huge = XMLParserOptions(XML_PARSE_HUGE)
-
Parse using SAX2 interface before 2.7.0.
Corresponding libxml2 enum case:
XML_PARSE_OLDSAX
Declaration
Swift
public static let oldSAX = XMLParserOptions(XML_PARSE_OLDSAX)
-
Ignore internal document encoding hint.
Corresponding libxml2 enum case:
XML_PARSE_IGNORE_ENC
Declaration
Swift
public static let ignoreEncoding = XMLParserOptions(XML_PARSE_IGNORE_ENC)
-
Store big lines numbers in text PSVI field.
Corresponding libxml2 enum case:
XML_PARSE_BIG_LINES
Declaration
Swift
public static let bigLines = XMLParserOptions(XML_PARSE_BIG_LINES)