From 2e278fa6372b04444e2ce741282994c7f56c9693 Mon Sep 17 00:00:00 2001 From: Orkhan Alikhanov Date: Fri, 27 Oct 2017 02:52:05 +0400 Subject: [PATCH] Added setting `xmlns` attribute when initializing `XmlElement` --- Sources/XmlElement.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/XmlElement.swift b/Sources/XmlElement.swift index c9271f2..c6924c4 100644 --- a/Sources/XmlElement.swift +++ b/Sources/XmlElement.swift @@ -15,8 +15,11 @@ open class XmlElement { open var children: [XmlElement] = [] open var parent: XmlElement? - public init(name: String) { + public init(name: String, xmlns: String? = nil) { self.name = name + if let xmlns = xmlns { + attributes["xmlns"] = xmlns + } } open var xml: String {