Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JaapWijnen/swift-xml-parser
https://github.com/JaapWijnen/swift-xml-parser
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/JaapWijnen/swift-xml-parser
- Owner: JaapWijnen
- License: mit
- Created: 2022-01-26T13:41:59.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-03T16:47:10.000Z (over 1 year ago)
- Last Synced: 2024-07-14T11:25:24.709Z (4 months ago)
- Language: Swift
- Size: 50.8 KB
- Stars: 7
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swift-xml-parser
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FJaapWijnen%2Fswift-xml-parser%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/JaapWijnen/swift-xml-parser)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FJaapWijnen%2Fswift-xml-parser%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/JaapWijnen/swift-xml-parser)A reversible XML parser powered by the excellent [swift-parsing][swift-parsing] package by [pointfree.co][pointfree]
## Getting Started
```swift
var input = """
"""
// The `XMLParser` type takes a single `Bool` parameter which determines the printing mode (with or without newlines/indentation)
let xml = try XMLParser(indenting: true).parse(input)
//XML(
// prolog: [
// "version": "1.0",
// "encoding": "utf-8"
// ],
// root: XML.Element(
// name: "root",
// attributes: [:],
// content: [
// .element(.init(name: "content", attributes: ["attribute1": "value"]))
// ]
// )
//)let indentedPrintedXML = xmlParser(true).print(xml)
//
//
//
//let flatPrintedXML = xmlParser(false).print(xml)
//
```## License
This library is released under the MIT license. See [LICENSE](LICENSE) for details.
[swift-parsing]: https://github.com/pointfreeco/swift-parsing
[pointfree]: https://pointfree.co