XMLDocument

public class XMLDocument

XML document which can be searched and queried.

  • The XML version.

    Declaration

    Swift

    public private(set) lazy var version: String? =
  • The string encoding for the document. This is NSUTF8StringEncoding if no encoding is set, or it cannot be calculated.

    Declaration

    Swift

    public private(set) lazy var encoding: NSStringEncoding =
  • The root element of the document.

    Declaration

    Swift

    public private(set) var root: XMLElement?
  • The formatter used to determine numberValue for elements in the document. By default, this is an NSNumberFormatter instance with NSNumberFormatterDecimalStyle.

    Declaration

    Swift

    public lazy var numberFormatter: NSNumberFormatter =
  • The formatter used to determine dateValue for elements in the document. By default, this is an NSDateFormatter instance configured to accept ISO 8601 formatted timestamps.

    Declaration

    Swift

    public lazy var dateFormatter: NSDateFormatter =
  • Creates and returns an instance of XMLDocument from an XML string, throwing XMLError if an error occured while parsing the XML.

    Declaration

    Swift

    public convenience init(string: String, encoding: NSStringEncoding = NSUTF8StringEncoding) throws

    Parameters

    string

    The XML string.

    encoding

    The string encoding.

    Return Value

    An XMLDocument with the contents of the specified XML string.

  • Creates and returns an instance of XMLDocument from XML data, throwing XMLError if an error occured while parsing the XML.

    Declaration

    Swift

    public convenience init(data: NSData) throws

    Parameters

    data

    The XML data.

    Return Value

    An XMLDocument with the contents of the specified XML string.

  • Creates and returns an instance of XMLDocument from C char array, throwing XMLError if an error occured while parsing the XML.

    Declaration

    Swift

    public convenience init(cChars: [CChar]) throws

    Parameters

    cChars

    cChars The XML data as C char array

    Return Value

    An XMLDocument with the contents of the specified XML string.

  • Define a prefix for a default namespace.

    Declaration

    Swift

    public func definePrefix(prefix: String, defaultNamespace ns: String)

    Parameters

    prefix

    The prefix name

    ns

    The default namespace URI that declared in XML Document