XmlContext
open class XmlContext
Facilitates XML operations.
-
Initializes a new instance of the XmlContext class with the specified document and file version.
Declaration
Swift
public init(document: XmlDomBuilder, fileVersion: Int)Parameters
documentAn XmlDomBuilder object.
fileVersionThe version of the XML file.
Return Value
The newly created XmlContext object.
-
Initializes a new instance of the XmlContext class.
Declaration
Swift
public init() -
Adds a new child node with the specified name to the specified parent node.
Declaration
Swift
open func addChildElement(_ elementName: String, parentElement: XmlElement) -> XmlElementParameters
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Adds a new child node with the specified name and value to the specified parent node.
Declaration
Swift
open func addChildElement(_ elementName: String, parentElement: XmlElement, innerText: String) -> XmlElementParameters
elementNameThe name of the element.
parentElementThe parent element.
innerTextThe value of the element.
Return Value
The newly created XmlElement.
-
Writes a double value with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeDouble( _ doubleValue: Double, elementName: String, parentElement: XmlElement) -> XmlElementParameters
doubleValueThe value to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Undocumented
Declaration
Swift
@discardableResult open func writeDoubleOpt( _ doubleValue: Double?, elementName: String, parentElement: XmlElement) -> XmlElement? -
Writes a string value with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeString( _ stringValue: String, elementName: String, parentElement: XmlElement) -> XmlElementParameters
stringValueThe value to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes a bool value with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeBool( _ boolValue: Bool, elementName: String, parentElement: XmlElement) -> XmlElementParameters
boolValueThe value to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes a char value with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeChar( _ charValue: Character, elementName: String, parentElement: XmlElement) -> XmlElementParameters
charValueThe value to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes a byte value with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeByte( _ byteValue: UInt8, elementName: String, parentElement: XmlElement) -> XmlElementParameters
stringValueThe value to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes an integer value with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeInt( _ intValue: Int, elementName: String, parentElement: XmlElement) -> XmlElementParameters
intValueThe value to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes an unsigned integer value with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeUInt ( _ intValue: UInt, elementName: String, parentElement: XmlElement) -> XmlElementParameters
intValueThe value to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the values of the specified enumeration as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeEnum( _ enumValue: Int, elementName: String, parentElement: XmlElement) -> XmlElementParameters
enumValueThe enumeration to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified rectangle as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeRectangle( _ rectangle: Rect, elementName: String, parentElement: XmlElement) -> XmlElementParameters
rectangleThe rectangle to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified AnchorPattern as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeAnchorPattern( _ anchorPattern: AnchorPattern?, elementName: String, parentElement: XmlElement) -> XmlElement?Parameters
rectangleThe AnchorPattern to write. The value can be nil.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement. The value can be nil.
-
Writes the specified point as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writePoint( _ point: Point, elementName: String, parentElement: XmlElement) -> XmlElementParameters
rectangleThe point to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified point as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writePoint( _ x: Double, y: Double, elementName: String, parentElement: XmlElement) -> XmlElementParameters
xThe X-coordinate of the point to write.
yThe Y-coordinate of the point to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the reference to the specified DiagramItem as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeItemReference( _ item: DiagramItem?, elementName: String, parentElement: XmlElement) -> XmlElement?Parameters
itemThe DiagramItem whose reference is written. The value can be nil.
yThe Y-coordinate of the point to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the tag of the specified object as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeTag( _ item: AnyObject, tagValue: AnyObject?, elementName: String, parentElement: XmlElement) -> XmlElement?Parameters
itemThe object whose tag is written.
tagValueThe tag of the object. The value can be nil.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified shape as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeShape( _ shape: Shape?, elementName: String, parentElement: XmlElement) -> XmlElement?Parameters
shapeThe Shape to write. The value can be nil.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified color as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeColor( _ color: Color, elementName: String, parentElement: XmlElement)->XmlElementParameters
colorThe color to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified brush as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeBrush( _ brush: Brush?, elementName: String, parentElement: XmlElement) -> XmlElement?Parameters
brushThe brush to write. The value can be nil.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified collection of Point-s as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writePointCollection( _ points: [Point], elementName: String, parentElement: XmlElement) -> XmlElement?Parameters
pointsThe Point to write.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified style as an XML element with the specified name under the specified parent node.
Declaration
Swift
open func writeStyle(_ style: Style?, elementName: String, parentElement: XmlElement) -> XmlElement?Parameters
brushThe brush to write. The value can be nil.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified image as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeImage( _ image: UIImage?, elementName: String, parentElement: XmlElement) -> XmlElement?Parameters
imageThe image to write. The value can be nil.
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified array of double values as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeDoubleArray( _ array: [Double], elementName: String, subElementName: String, parentElement: XmlElement) -> XmlElement?Parameters
arrayThe array of double values to write. The value can be nil.
elementNameThe name of the element.
subElementNameThe name of the nested element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Writes the specified array of Color-s as an XML element with the specified name under the specified parent node.
Declaration
Swift
@discardableResult open func writeColorArray( _ array: [Color], elementName: String, subElementName: String, parentElement: XmlElement) -> XmlElement?Parameters
arrayThe Color array to write.
elementNameThe name of the element.
subElementNameThe name of the nested element.
parentElementThe parent element.
Return Value
The newly created XmlElement.
-
Reads an AnchorPattern with the specified name from the specified XmlElement.
Declaration
Swift
open func readAnchorPattern(_ elementName: String, parentElement: XmlElement, standalone: Bool) -> AnchorPattern?Parameters
elementNameThe name of the element.
parentElementThe parent element.
standalonetrue if the element is standalone; otherwise false.
Return Value
The AnchorPattern that was read; nil if none was read.
-
Reads the file version from the specified XmlElement.
Declaration
Swift
open func readVersion(_ element: XmlElement?)Parameters
elementThe element to read from. The value can be nil.
-
Reads a Brush with the specified name from the specified XmlElement.
Declaration
Swift
open func readBrush(_ elementName: String, parentElement: XmlElement?) -> Brush?Parameters
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The Brush that was read; nil if none was read.
-
Reads an array with Brush objects from the specified XmlElement.
Declaration
Swift
open func readBrushes(_ parentElement: XmlElement?)Parameters
parentElementThe XML element to read from. The value can be nil.
-
Reads the contents of a Brush from the specified XmlElement.
Declaration
Swift
open func readBrushContent(_ brushElement: XmlElement?) -> Brush?Parameters
brushElementThe brush element to read from.
Return Value
The Brush that was read; nil if none was read.
-
Reads an array with double values from element with the specified name and the specified sub element and XmlElement.
Declaration
Swift
open func readDoubleArray(_ elementName: String, subElementName: String, parentElement: XmlElement) -> [Double]Parameters
elementNameThe name of the element.
subElementNameThe name of the sub-element.
parentElementThe parent element.
Return Value
An array with the double values that were read.
-
Reads a Color array with the specified name from the specified sub element and XmlElement.
Declaration
Swift
open func readColorArray(_ elementName: String, subElementName: String, parentElement: XmlElement) -> [Color]Parameters
elementNameThe name of the element.
subElementNameThe name of the sub-element.
parentElementThe parent element.
Return Value
Array with color objects that was read.
-
Reads the contents of a Style from the specified XmlElement.
Declaration
Swift
open func readStyle(_ elementName: String, parentElement: XmlElement?) -> Style?Parameters
elementNameThe name of the element.
parentElementThe parent element to read from.
Return Value
The Style that was read; nil if none was read.
-
Reads a collection of Style objects from the specified XmlElement.
Declaration
Swift
open func readStyles(_ parentElement: XmlElement?)Parameters
parentElementThe parent element to read from.
-
Reads the contents of a Style from the specified XmlElement.
Declaration
Swift
open func readStyleContent(_ styleElement: XmlElement?) -> Style?Parameters
styleElementThe style element to read from.
Return Value
The Style that was read; nil if none was read.
-
Reads an Image with the specified name from the specified XmlElement.
Declaration
Swift
open func readImage(_ elementName: String, parentElement: XmlElement?) -> UIImage?Parameters
elementNameThe name of the element.
parentElementThe parent element to read from.
Return Value
The Image that was read; nil if none was read.
-
Reads an array of Image-s from the specified XmlElement.
Declaration
Swift
open func readImages(_ parentElement: XmlElement?)Parameters
parentElementThe name of the element. The value can be nil.
-
Reads a Shape with the specified name from the specified XmlElement and with the specified default Shape.
Declaration
Swift
open func readShape(_ elementName: String, parentElement: XmlElement?, defaultValue: Shape?) -> Shape?Parameters
elementNameThe name of the element.
parentElementThe parent element to read from. The value can be nil.
defaultValueThe default Shape.
Return Value
The Shape that was read; nil if none was read.
-
Reads an array with Point-s with the specified name from the specified XmlElement.
Declaration
Swift
open func readPointCollection(_ elementName: String, parentElement: XmlElement) -> [Point]Parameters
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The Point array that was read.
-
Reads a Point with the specified name from the specified XmlElement.
Declaration
Swift
open func readPoint(_ elementName: String, parentElement: XmlElement) -> PointParameters
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The Point that was read.
-
Reads a DiagramItem with the specified name from the specified XmlElement.
Declaration
Swift
open func readItemReference(_ elementName: String, parentElement: XmlElement) -> DiagramItem?Parameters
elementNameThe name of the element.
parentElementThe parent element.
Return Value
The DiagramItem that was read. Nil if none was read.
-
Reads a reference to a DiagramItem from the specified XmlElement.
Declaration
Swift
open func readItemReference(_ itemElement: XmlElement) -> DiagramItem?Parameters
itemElementThe name of the element.
Return Value
The DiagramItem whose reference was read. Nil if none was read.
-
Instantiates a DiagramItem with the specified class id.
Declaration
Swift
open func instantiateItem(_ classId: String?) -> DiagramItem?Parameters
classIdThe class id.
Return Value
The DiagramItem that was instantiated. Nil if none was created.
-
Specifies the file version.
Declaration
Swift
open var fileVersion: Int -
Gets the latest version.
Declaration
Swift
open class var latestVersion: Int { get }Return Value
the version.
-
Specifies if there are inplace resources used in this XmlContext.
Declaration
Swift
open var inplaceResources: Bool
XmlContext Class Reference