XMLDocument

open class XMLDocument : XML

This class is inherited from XML and has a few addons to represent XML Document.

XML Parsing is also done with this object.

  • Root (the first child element) element of XML Document (Empty element with error if not exists).

    Declaration

    Swift

    open var root: XML { get }
  • Undocumented

    Declaration

    Swift

    open let options: AEXMLOptions
  • Designated initializer - Creates and returns new XML Document object.

    Declaration

    Swift

    public init(root: XML? = nil, options: AEXMLOptions = AEXMLOptions())

    Parameters

    root

    Root XML element for XML Document (defaults to nil).

    options

    Options for XML Document header and parser settings (defaults to AEXMLOptions()).

    Return Value

    Initialized XML Document object.

  • Convenience initializer - used for parsing XML data (by calling loadXMLData: internally).

    Declaration

    Swift

    public convenience init(xml: Data, options: AEXMLOptions = AEXMLOptions()) throws

    Parameters

    xmlData

    XML data to parse.

    options

    Options for XML Document header and parser settings (defaults to AEXMLOptions()).

    Return Value

    Initialized XML Document object containing parsed data. Throws error if data could not be parsed.

  • Convenience initializer - used for parsing XML string (by calling init(xmlData:options:) internally).

    Declaration

    Swift

    public convenience init(xml: String,
                            encoding: String.Encoding = String.Encoding.utf8,
                            options: AEXMLOptions = AEXMLOptions()) throws

    Parameters

    xmlString

    XML string to parse.

    encoding

    String encoding for creating Data from xmlString (defaults to String.Encoding.utf8)

    options

    Options for XML Document header and parser settings (defaults to AEXMLOptions()).

    Return Value

    Initialized XML Document object containing parsed data. Throws error if data could not be parsed.

  • Creates instance of AEXMLParser (private class which is simple wrapper around XMLParser) and starts parsing the given XML data. Throws error if data could not be parsed.

    Declaration

    Swift

    open func loadXML(_ data: Data) throws

    Parameters

    data

    XML which should be parsed.

  • xml

    Override of xml property of XML - it just inserts XML Document header at the beginning.

    Declaration

    Swift

    open override var xml: String { get }