swiftxml

1.0.0

A lightweight xml parser written in pure swift
tayloraswift/swiftxml

What's New

swiftxml

2017-01-02T05:06:38Z

SwiftXML

Language Issues License Build Queen

Lightweight XML parsing in pure Swift 3. No Foundation. No dependencies.

SwiftXML doesn’t wrap anything. It parses XML directly, character by character. And the API is simple and easy to use. In fact, it exposes just two objects — a protocol and a function:

protocol Parser
{
    func handle_data(data:[UnicodeScalar])
    func handle_starttag(name:String, attributes:[String: String])
    func handle_startendtag(name:String, attributes:[String: String])
    func handle_endtag(name:String)
    func error(_:String, line:Int, column:Int)
}
func parse(_:String, parser:Parser)

SwiftXML will tokenize your XML string into tags and data. It does not build any tree structures; that is for you to implement. Nor does it read files from disk into memory; that is for the Swift standard library to implement (hint hint @ Swift standard library devs).

See the swiftxmlTests.swift file for a usage example, if you are still confused.

Description

  • Swift Tools 3.1.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Oct 18 2024 06:34:57 GMT-0900 (Hawaii-Aleutian Daylight Time)