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
name
The name of the XmlElement to create.
parent
The 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
name
The 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
parent
The 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]) -> XmlElement
Parameters
name
The name of the new XML element to add.
text
The content of the new element.
attributes
The 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) -> String
Parameters
k
The 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) -> XmlElement
Parameters
name
The name of the new XML element to add.
text
The 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) -> XmlElement
Parameters
name
The 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
name
The 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
name
The 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() -> String
Return 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 = "") -> String
Parameters
name
The name of the child element.
defaultValue
The 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) -> Int
Parameters
name
The name of the child element.
defaultValue
The 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) -> UInt
Parameters
name
The name of the child element.
defaultValue
The 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) -> Double
Parameters
name
The name of the child element.
defaultValue
The 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) -> Bool
Parameters
name
The name of the child element.
defaultValue
The 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