AEXMLDocument

public class AEXMLDocument: AEXMLElement

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

XML Parsing is also done with this object.

  • This is only used for XML Document header (default value is 1.0).

    Declaration

    Swift

    public let version: Double
  • This is only used for XML Document header (default value is utf-8).

    Declaration

    Swift

    public let encoding: String
  • This is only used for XML Document header (default value is no).

    Declaration

    Swift

    public let standalone: String
  • Root (the first child element) element of XML Document (AEXMLError element if not exists).

    Declaration

    Swift

    public var root: AEXMLElement { return children.count == 1 ? children.first! : AEXMLElement(AEXMLElement.errorElementName, value: "XML Document must have root element.") }
  • Designated initializer - Creates and returns XML Document object.

    :param: version Version value for XML Document header (defaults to 1.0). :param: encoding Encoding value for XML Document header (defaults to utf-8). :param: standalone Standalone value for XML Document header (defaults to no). :param: root Root XML element for XML Document (defaults to nil).

    :returns: An initialized XML Document object.

    Declaration

    Swift

    public init(version: Double = Defaults.version, encoding: String = Defaults.encoding, standalone: String = Defaults.standalone, root: AEXMLElement? = nil)
  • Convenience initializer - used for parsing XML data (by calling loadXMLData: internally).

    :param: version Version value for XML Document header (defaults to 1.0). :param: encoding Encoding value for XML Document header (defaults to utf-8). :param: standalone Standalone value for XML Document header (defaults to no). :param: xmlData XML data to parse. :param: error If there is an error reading in the data, upon return contains an NSError object that describes the problem.

    :returns: An initialized XML Document object containing the parsed data. Returns nil if the data could not be parsed.

    Declaration

    Swift

    public convenience init(version: Double = Defaults.version, encoding: String = Defaults.encoding, standalone: String = Defaults.standalone, xmlData: NSData) throws
  • Creates instance of AEXMLParser (private class which is simple wrapper around NSXMLParser) and starts parsing the given XML data.

    :param: data XML which should be parsed.

    :returns: NSError if parsing is not successfull, otherwise nil.

    Declaration

    Swift

    public func loadXMLData(data: NSData) throws
  • Override of xmlString property of AEXMLElement - it just inserts XML Document header at the beginning.

    Declaration

    Swift

    public override var xmlString: String