Contents

init(data:options:)

Initializes and returns an NSXMLDocument object created from an Nsdata object.

Declaration

init(data: Data, options mask: XMLNode.Options = []) throws

Parameters

  • data:

    A data object with XML content.

  • mask:

    A bit mask for input options. You can specify multiple options by bit-OR’ing them. See Constants for a list of valid input options.

Return Value

An initialized NSXMLDocument object, or nil if initialization fails because of parsing errors or other reasons.

Discussion

This method is the designated initializer for the NSXMLDocument class.

If you specify NSXMLDocumentTidyXML as one of the options, NSXMLDocument performs several clean-up operations on the document XML (such as removing leading tabs). It does respect the xml:space="preserve" attribute when it attempts to tidy the XML.

See Also

Initializing NSXMLDocument Objects