XMLElement

public class XMLElement: XMLNode

Represents an element in XMLDocument or HTMLDocument

  • The element’s namespace.

    Declaration

    Swift

    public private(set) lazy var namespace: String? =
  • Returns the child element at the specified index.

    Declaration

    Swift

    public subscript (idx: Int) -> XMLElement?

    Parameters

    idx

    The index.

    Return Value

    The child element.

  • Returns the value for the attribute with the specified key.

    Declaration

    Swift

    public subscript (name: String) -> String?

    Parameters

    name

    The attribute name.

    Return Value

    The attribute value, or nil if the attribute is not defined.

  • tag

    The element’s tag.

    Declaration

    Swift

    public private(set) lazy var tag: String? =
  • All attributes for the element.

    Declaration

    Swift

    public private(set) lazy var attributes: [String : String] =
  • Returns the value for the attribute with the specified key.

    Declaration

    Swift

    public func attr(name: String, namespace ns: String? = nil) -> String?

    Parameters

    name

    The attribute name.

    ns

    The namespace, or nil by default if not using a namespace

    Return Value

    The attribute value, or nil if the attribute is not defined.

  • The element’s children elements.

    Declaration

    Swift

    public var children: [XMLElement]
  • Get the element’s child nodes of specified types

    Declaration

    Swift

    public func childNodes(ofTypes types: [XMLNodeType]) -> [XMLNode]

    Parameters

    types

    type of nodes that should be fetched (e.g. .Element, .Text, .Comment)

    Return Value

    all children of specified types

  • Returns the first child element with a tag, or nil if no such element exists.

    Declaration

    Swift

    public func firstChild(tag tag: String, inNamespace ns: String? = nil) -> XMLElement?

    Parameters

    tag

    The tag name.

    ns

    The namespace, or nil by default if not using a namespace

    Return Value

    The child element.

  • Returns all children elements with the specified tag.

    Declaration

    Swift

    public func children(tag tag: String, inNamespace ns: String? = nil) -> [XMLElement]

    Parameters

    tag

    The tag name.

    ns

    The namepsace, or nil by default if not using a namespace

    Return Value

    The children elements.

  • Whether the element has a value.

    Declaration

    Swift

    public var isBlank: Bool
  • A number representation of the element’s value, which is generated from the document’s numberFormatter property.

    Declaration

    Swift

    public private(set) lazy var numberValue: NSNumber? =
  • A date representation of the element’s value, which is generated from the document’s dateFormatter property.

    Declaration

    Swift

    public private(set) lazy var dateValue: NSDate? =