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) -> XmlElementParameters
elementNameThe 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
elementThe 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() -> StringReturn Value
The XML content.
-
Parses the XML file with the specified path.
Declaration
Swift
open func parseFile(_ pathToFile: String)Parameters
pathToFileThe path to the file location.
-
Parses the XML file at specified URL.
Declaration
Swift
open func parseFile(_ fileUrl: URL)Parameters
fileUrlURL 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
parserAn NSXMLParser that parses the document.
elementNameThe name of the element.
namespaceURIThe URI of the XML namespace.
qualifiedNameThe qualified XML name. The value can be nil.
-
Parses the XML file.
Declaration
Swift
open func parser(_ parser: XMLParser, foundCharacters string: String)Parameters
parserAn NSXMLParser that parses the document.
stringA string with the characters.
-
Parses the XML file.
Declaration
Swift
open func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?)Parameters
parserAn NSXMLParser that parses the document.
elementNameThe name of the element.
namespaceURIThe URI of the XML namespace.
qualifiedNameThe qualified XML name. The value can be nil.
XmlDomBuilder Class Reference