Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For make true XML need in the loop get all value and fix then. #9

Closed
kiri11ko opened this issue Jul 16, 2019 · 2 comments
Closed

For make true XML need in the loop get all value and fix then. #9

kiri11ko opened this issue Jul 16, 2019 · 2 comments

Comments

@kiri11ko
Copy link

For make true XML need in the loop get all value and fix then.
Example:
let newXMLHead: XML = XML(name: "clients")
let usersXML: [XML] = memoryXML!["#clients"]["client"].xmlList!
for value in usersXML {
let newXML: XML = XML(name: "clients")
for (key, subValue) in value.attributes {
newXML.addAttribute(name: key, value: subValue.percentEscapeString())
}
newXMLHead.addChild(newXML)
}

Where
extension String {
func percentEscapeString() -> String {
return self
.replacingOccurrences(of: "&", with: "&")
.replacingOccurrences(of: """, with: """)
.replacingOccurrences(of: "'", with: "'")
.replacingOccurrences(of: ">", with: ">")
.replacingOccurrences(of: "<", with: "&lt;")
}
}

Originally posted by @kiri11ko in #8 (comment)

@chenyunguiMilook
Copy link
Owner

@kiri11ko, thanks for bringing this up, I will schedule to implement this recently.

@chenyunguiMilook
Copy link
Owner

@kiri11ko I have fixed this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants