Skip to content

Commit

Permalink
Merge pull request #15 from ilendemli/master
Browse files Browse the repository at this point in the history
fix array of same keyed items
  • Loading branch information
ShawnMoore authored Sep 29, 2018
2 parents 1ea1496 + b4be291 commit 92a4983
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/XMLParsing/XMLStackParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,15 @@ internal class _XMLElement {
for childElement in children {
for child in childElement.value {
if let content = child.value {
node[childElement.key] = content
if let oldContent = node[childElement.key] as? Array<Any> {
node[childElement.key] = oldContent + [content]

} else if let oldContent = node[childElement.key] {
node[childElement.key] = [oldContent, content]

} else {
node[childElement.key] = content
}
} else if !child.children.isEmpty || !child.attributes.isEmpty {
let newValue = child.flatten()

Expand Down

0 comments on commit 92a4983

Please sign in to comment.