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
idxThe index.
Return Value
The child element.
-
Returns the value for the attribute with the specified key.
Declaration
Swift
public subscript (name: String) -> String?Parameters
nameThe attribute name.
Return Value
The attribute value, or
nilif the attribute is not defined. -
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
nameThe attribute name.
nsThe namespace, or
nilby default if not using a namespaceReturn Value
The attribute value, or
nilif 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
typestype 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
nilif no such element exists.Declaration
Swift
public func firstChild(tag tag: String, inNamespace ns: String? = nil) -> XMLElement?Parameters
tagThe tag name.
nsThe namespace, or
nilby default if not using a namespaceReturn 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
tagThe tag name.
nsThe namepsace, or
nilby default if not using a namespaceReturn 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
numberFormatterproperty.Declaration
Swift
public private(set) lazy var numberValue: NSNumber? = -
A date representation of the element’s value, which is generated from the document’s
dateFormatterproperty.Declaration
Swift
public private(set) lazy var dateValue: NSDate? =
XMLElement Class Reference