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
document
An XmlDomBuilder object.
fileVersion
The 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) -> XmlElement
Parameters
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
elementName
The name of the element.
parentElement
The parent element.
innerText
The 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) -> XmlElement
Parameters
doubleValue
The value to write.
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
stringValue
The value to write.
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
boolValue
The value to write.
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
charValue
The value to write.
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
stringValue
The value to write.
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
intValue
The value to write.
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
intValue
The value to write.
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
enumValue
The enumeration to write.
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
rectangle
The rectangle to write.
elementName
The name of the element.
parentElement
The 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
rectangle
The AnchorPattern to write. The value can be nil.
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
rectangle
The point to write.
elementName
The name of the element.
parentElement
The 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) -> XmlElement
Parameters
x
The X-coordinate of the point to write.
y
The Y-coordinate of the point to write.
elementName
The name of the element.
parentElement
The 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
item
The DiagramItem whose reference is written. The value can be nil.
y
The Y-coordinate of the point to write.
elementName
The name of the element.
parentElement
The 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
item
The object whose tag is written.
tagValue
The tag of the object. The value can be nil.
elementName
The name of the element.
parentElement
The 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
shape
The Shape to write. The value can be nil.
elementName
The name of the element.
parentElement
The 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)->XmlElement
Parameters
color
The color to write.
elementName
The name of the element.
parentElement
The 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
brush
The brush to write. The value can be nil.
elementName
The name of the element.
parentElement
The 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
points
The Point to write.
elementName
The name of the element.
parentElement
The 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
brush
The brush to write. The value can be nil.
elementName
The name of the element.
parentElement
The 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
image
The image to write. The value can be nil.
elementName
The name of the element.
parentElement
The 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
array
The array of double values to write. The value can be nil.
elementName
The name of the element.
subElementName
The name of the nested element.
parentElement
The 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
array
The Color array to write.
elementName
The name of the element.
subElementName
The name of the nested element.
parentElement
The 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
elementName
The name of the element.
parentElement
The parent element.
standalone
true 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
element
The 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
elementName
The name of the element.
parentElement
The 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
parentElement
The 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
brushElement
The 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
elementName
The name of the element.
subElementName
The name of the sub-element.
parentElement
The 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
elementName
The name of the element.
subElementName
The name of the sub-element.
parentElement
The 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
elementName
The name of the element.
parentElement
The 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
parentElement
The parent element to read from.
-
Reads the contents of a Style from the specified XmlElement.
Declaration
Swift
open func readStyleContent(_ styleElement: XmlElement?) -> Style?
Parameters
styleElement
The 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
elementName
The name of the element.
parentElement
The 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
parentElement
The 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
elementName
The name of the element.
parentElement
The parent element to read from. The value can be nil.
defaultValue
The 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
elementName
The name of the element.
parentElement
The 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) -> Point
Parameters
elementName
The name of the element.
parentElement
The 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
elementName
The name of the element.
parentElement
The 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
itemElement
The 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
classId
The 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