Latest 1.0.4
Homepage https://github.com/simplepanda/simplexml
License MIT
Platforms ios 8.0, osx 10.10
Authors

Version
License
Platform

SimpleXML is a simple XML parsing implementation for Swift 4+ projects.

SimpleXML provides a similar parsing implementation to JSONSerialization, the integrated Apple JSON parsing mechanism. Rather than building a potentially complex SAX style parsing mechanism for reading XML files tag by tag using XMLParser, you you can simply deserialize any XML file into convenient, familiar Dictionary, Array, and String structures.

Example

Deserializing XML is easy. Given some example XML:

<root>
  <child>
    <name>Dylan</name>
  </child>
</root>

You can parse it like this:

  let url = URL(string: "http://some-xml-file.xml")
  let xmlData = try SimpleXML.parse(url)

  // Get the root node of the XML document.
  let root = xmlData["root"] as! [String:Any]

  // Get the child object of the root node.
  let child = root["child"] as! [String:Any]

  // Get the name string from the child node.
  let name = child["name"] as! String

  // Print "Dylan"
  print(name)

Requirements

SimpleXML is built in Swift 4.0 and will run on iOS or macOS.

Installation

SimpleXML is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'SimpleXML'

Author

Dylan Neild, [email protected]

License

SimpleXML is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SimpleXML",
    "version": "1.0.4",
    "summary": "A simple library for parsing XML to a Swift native Dictionary tree.",
    "description": "A simple library for parsing XML to a Swift native Dictionary tree.nnThis library works similairly to the standard Swift JSON libraries - you provide it access to a stream, URL, or Data buffer of XML and it returns a [String:Any] dictionary that you can walk through easily.nnMore description and usage patterns forthcoming.",
    "homepage": "https://github.com/simplepanda/simplexml",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Dylan Neild": "[email protected]"
    },
    "source": {
        "git": "https://github.com/simplepanda/simplexml.git",
        "tag": "1.0.4"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "source_files": "SimpleXML/Classes/*.swift",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This