XML

open class XML : NSObject

Undocumented

  • Every XML should have its parent element instead of AEXMLDocument which parent is nil.

    Declaration

    Swift

    open internal(set) weak var parent: XML?
  • Child XML elements.

    Declaration

    Swift

    open internal(set) var children: [XML]
  • XML Element name.

    Declaration

    Swift

    open var name: String
  • XML Element value.

    Declaration

    Swift

    open var value: String?
  • XML Element attributes.

    Declaration

    Swift

    open var attributes: [String : String]
  • Error value (nil if there is no error).

    Declaration

    Swift

    open var error: AEXMLError?
  • String representation of value property (if value is nil this is empty String).

    Declaration

    Swift

    open var string: String { get }
  • Boolean representation of value property (nil if value can’t be represented as Bool).

    Declaration

    Swift

    open var bool: Bool? { get }
  • int

    Integer representation of value property (nil if value can’t be represented as Integer).

    Declaration

    Swift

    open var int: Int? { get }
  • Double representation of value property (nil if value can’t be represented as Double).

    Declaration

    Swift

    open var double: Double? { get }
  • Designated initializer - all parameters are optional.

    Declaration

    Swift

    public init(name: String, value: String? = nil, attributes: [String : String] = [String : String]())

    Parameters

    name

    XML element name.

    value

    XML element value (defaults to nil).

    attributes

    XML element attributes (defaults to empty dictionary).

    Return Value

    An initialized XML object.

  • The first element with given name (Empty element with error if not exists).

    Declaration

    Swift

    open subscript(key: String) -> XML { get }
  • all

    Returns all of the elements with equal name as self (nil if not exists).

    Declaration

    Swift

    open var all: [XML]? { get }
  • Returns the first element with equal name as self (nil if not exists).

    Declaration

    Swift

    open var first: XML? { get }
  • Returns the last element with equal name as self (nil if not exists).

    Declaration

    Swift

    open var last: XML? { get }
  • Returns number of all elements with equal name as self.

    Declaration

    Swift

    open var count: Int { get }
  • Returns all elements with given value.

    Declaration

    Swift

    open func all(withValue value: String) -> [XML]?

    Parameters

    value

    XML element value.

    Return Value

    Optional Array of found XML elements.

  • Returns all elements containing given attributes.

    Declaration

    Swift

    open func all(containingAttributeKeys keys: [String]) -> [XML]?

    Parameters

    attributes

    Array of attribute names.

    Return Value

    Optional Array of found XML elements.

  • Returns all elements with given attributes.

    Declaration

    Swift

    open func all(withAttributes attributes: [String : String]) -> [XML]?

    Parameters

    attributes

    Dictionary of Keys and Values of attributes.

    Return Value

    Optional Array of found XML elements.

  • Adds child XML element to self.

    Declaration

    Swift

    @discardableResult
    open func addChild(_ child: XML) -> XML

    Parameters

    child

    Child XML element to add.

    Return Value

    Child XML element with self as parent.

  • Adds child XML element to self.

    Declaration

    Swift

    @discardableResult
    open func addChild(name: String,
    value: String? = nil,
    attributes: [String : String] = [String : String]()) -> XML

    Parameters

    name

    Child XML element name.

    value

    Child XML element value (defaults to nil).

    attributes

    Child XML element attributes (defaults to empty dictionary).

    Return Value

    Child XML element with self as parent.

  • Removes self from parent XML element.

    Declaration

    Swift

    open func removeFromParent()
  • xml

    Complete hierarchy of self and children in XML escaped and formatted String

    Declaration

    Swift

    open var xml: String { get }
  • Same as xmlString but without \n and \t characters

    Declaration

    Swift

    open var xmlCompact: String { get }
  • Undocumented

    Declaration

    Swift

    public func string(_ keys: [String], _ done: (String) -> Void)
  • Undocumented

    Declaration

    Swift

    public func int(_ keys: [String], _ done: (Int) -> Void)
  • Undocumented

    Declaration

    Swift

    public func double(_ keys: [String], _ done: (Double) -> Void)
  • Undocumented

    Declaration

    Swift

    public func float(_ keys: [String], _ done: (Float) -> Void)
  • Undocumented

    Declaration

    Swift

    public func bool(_ keys: [String], _ done: (Bool) -> Void)
  • Undocumented

    Declaration

    Swift

    public func yes(_ keys: [String], _ done: () -> Void)
  • Undocumented

    Declaration

    Swift

    public func True(_ keys: [String], _ done: () -> Void)
  • Undocumented

    Declaration

    Swift

    public func no(_ keys: [String], _ done: () -> Void)
  • Undocumented

    Declaration

    Swift

    public func False(_ keys: [String], _ done: () -> Void)
  • Undocumented

    Declaration

    Swift

    public func xml(_ keys: [String], _ done: (XML) -> Void)