FastXML 1.2.0

FastXML 1.2.0

Maintained by Morgan Fitussi.



FastXML 1.2.0

  • By
  • Morgan Fitussi

FastXML

A Fast, Swifty and Tested XML parser written in Swift

GitHub license Carthage compatible Cocoapods compatible Build Status Platform

Usage

Sample XML

<breakfast_menu>
	<food>
		<name language="english">Belgian Waffles</name>
		<price currency="dollar">5.95</price>
		<description>Two of our famous Belgian Waffles with plenty of real maple syrup</description>
		<calories>650</calories>
	</food>
	<food>
		<name language="french">Toast français</name>
		<price currency="euro">3.50</price>
		<description>Tranches épaisses faites à partir de notre pain au levain fait maison</description>
		<calories>600</calories>
	</food>
</breakfast_menu>

Given

FastXML(xmldata: xmlString.data(using: .utf8)!) { (xml, error) in
	print(xml!["breakfast_menu"]["food"][0]["name"].value)
	print(xml!["breakfast_menu"]["food"][0]["name"]["$language"].value)
	print(xml!["breakfast_menu"].tags)
	print(xml!["breakfast_menu"]["food"][0].tags)
	print(xml!["breakfast_menu"]["food"][0]["name"].attributes)
}

Output

"Belgian Waffles"
"english"
["food"]
["name","price","description","calories"]
["language"]

Requirements

  • Swift 4.0+ | iOS 8.0+ | macOS 10.10+ | tvOS 9.0+ | watchOS 2.0+
  • Xcode 8 or later

Installation

CocoaPods

You can use CocoaPods to install FastXML by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
    pod 'FastXML', '~> 1.2.0'
end

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/FastXML.framework to an iOS project.

github "Dohko/FastXML" ~> 1.2.0

Manually

Download and Drag/Drop FastXML.swift and Tag.swift into your project.

Swift Package Manager

You can use The Swift Package Manager to install FastXML by adding the proper description to your Package.swift file:

import PackageDescription

let package = Package(
    name: "PROJECT_NAME",
    targets: [],
    dependencies: [
        .Package(url: "https://github.com/dohko/FastXML.git", majorVersion: 1, minor: 2)
    ]
)

License

FastXML is released under the MIT license:

Support

Author

Morgan Fitussi, [email protected]