XmlElement
open class XmlElement
Represents a XML element used for serialiation and deserialization of the diagram.
-
Initializes a new instance of the XmlElement class with the specified name and parent.
Declaration
Swift
public init(name: String, parent: XmlElement?)Parameters
nameThe name of the XmlElement to create.
parentThe parent element.
Return Value
The newly created XML element.
-
Initializes a new instance of the XmlElement class with the specified name.
Declaration
Swift
public init(name: String)Parameters
nameThe name of the XmlElement to create.
Return Value
The newly created XML element.
-
Initializes a new instance of the XmlElement class with the specified parent.
Declaration
Swift
public init()Parameters
parentThe parent element.
Return Value
The newly created XML element.
-
Adds the specified element as the child of this XmlElement.
Declaration
Swift
open func addChild(_ element: XmlElement) -
Adds a XML element with the specified name, text and attributes as a child of this XmlElement.
Declaration
Swift
open func addChild(_ name: String, text: String, attributes: [String : String]) -> XmlElementParameters
nameThe name of the new XML element to add.
textThe content of the new element.
attributesThe attributes of the new element.
Return Value
The newly created XmlElement.
-
Gets the contents of this XmlElement as a string.
Declaration
Swift
open func getXmlAsString(_ k: Int) -> StringParameters
kThe indent at which the node starts.
Return Value
A string that represents the XmlElement.
-
Adds a XML element with the specified name and text as a child to this XmlElement.
Declaration
Swift
open func addChild(_ name: String, text: String) -> XmlElementParameters
nameThe name of the new XML element to add.
textThe content of the new element.
Return Value
The newly created XmlElement.
-
Adds a XML element with the specified name as a child to this XmlElement.
Declaration
Swift
open func addChild(_ name: String) -> XmlElementParameters
nameThe name of the new XML element to add.
Return Value
The newly created XmlElement.
-
Gets the child of this XmlElement with the specified name.
Declaration
Swift
open func getChild(_ name: String) -> XmlElement?Parameters
nameThe name of the XmlElement to get.
Return Value
The XmlElement; nil if none was found.
-
Gets all children of the XmlElement with the specified name.
Declaration
Swift
open func getAllChildren(_ name: String) -> [XmlElement]Parameters
nameThe name of the XmlElement.
Return Value
An array with the XmlElement-s that are the children.
-
Gets the text of the first child of this XmlElement.
Declaration
Swift
open func getInnerText() -> StringReturn Value
The text.
-
Reads the contents of the child with the specified name as a string.
Declaration
Swift
open func readString(_ name: String, defaultValue: String = "") -> StringParameters
nameThe name of the child element.
defaultValueThe string to return if no child with such name is found.
Return Value
The contents of the first child as a string.
-
Reads the contents of the child with the specified name as an integer.
Declaration
Swift
open func readInteger(_ name: String, defaultValue: Int = 0) -> IntParameters
nameThe name of the child element.
defaultValueThe integer to return if no child with such name is found.
Return Value
The contents of the first child as an integer.
-
Reads the contents of the child with the specified name as an unsigned integer.
Declaration
Swift
open func readUInt(_ name: String, defaultValue: UInt = 0) -> UIntParameters
nameThe name of the child element.
defaultValueThe unsigned integer to return if no child with such name is found.
Return Value
The contents of the first child as an unsigned integer.
-
Reads the contents of the child with the specified name as a double value.
Declaration
Swift
open func readDouble(_ name: String, defaultValue: Double = 0.0) -> DoubleParameters
nameThe name of the child element.
defaultValueThe double to return if no child with such name is found.
Return Value
The contents of the first child as a double.
-
Undocumented
Declaration
Swift
public func readDoubleOpt(_ name: String) -> Double? -
Reads the contents of the child with the specified name as a bool.
Declaration
Swift
open func readBool(_ name: String, defaultValue: Bool = false) -> BoolParameters
nameThe name of the child element.
defaultValueThe bool to return if no child with such name is found.
Return Value
The contents of the first child as a bool.
-
Specifies the name of the XmlElement.
Declaration
Swift
open var name: String -
Specifies the children of the XmlElement.
Declaration
Swift
open var children: [XmlElement] -
Specifies the attributes of the XmlElement.
Declaration
Swift
open var attributes: [String : String] -
Specifies the parent of the XmlElement. The value can be nil.
Declaration
Swift
open var parent: XmlElement? -
Specifies the text of the XmlElement.
Declaration
Swift
open var text: String
XmlElement Class Reference