XmlDomBuilder
open class XmlDomBuilder : NSObject, XMLParserDelegate
Creates XML elements. This class inherits NSObject and NSXMLParserDelegate.
-
The XmlElement at the root. The value can be nil.
Declaration
Swift
open var root: XmlElement?
-
Initializes a new instance of the XmlDomBuilder class.
Declaration
Swift
public override init()
Return Value
The newly created XmlDomBuilder object.
-
Creates an XML element with the specified name.
Declaration
Swift
open func createElement(_ elementName: String) -> XmlElement
Parameters
elementName
The name of the element.
Return Value
The newly created XmlElement.
-
Adds a child to the specified element.
Declaration
Swift
open func addChild(_ element: XmlElement)
Parameters
element
The XmlElement to which a child is added.
-
Prints the XML.
Declaration
Swift
open func print()
-
Gets the XML content as a string.
Declaration
Swift
open func getXmlContent() -> String
Return Value
The XML content.
-
Parses the XML file with the specified path.
Declaration
Swift
open func parseFile(_ pathToFile: String)
Parameters
pathToFile
The path to the file location.
-
Parses the XML file at specified URL.
Declaration
Swift
open func parseFile(_ fileUrl: URL)
Parameters
fileUrl
URL specifying file location.
-
Parses the XML file.
Declaration
Swift
open func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String])
Parameters
parser
An NSXMLParser that parses the document.
elementName
The name of the element.
namespaceURI
The URI of the XML namespace.
qualifiedName
The qualified XML name. The value can be nil.
-
Parses the XML file.
Declaration
Swift
open func parser(_ parser: XMLParser, foundCharacters string: String)
Parameters
parser
An NSXMLParser that parses the document.
string
A string with the characters.
-
Parses the XML file.
Declaration
Swift
open func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?)
Parameters
parser
An NSXMLParser that parses the document.
elementName
The name of the element.
namespaceURI
The URI of the XML namespace.
qualifiedName
The qualified XML name. The value can be nil.