Simple XML parsing in Swift



CocoaPods Carthage compatible CocoaPods Join the chat at codebeat

SWXMLHash is a relatively simple way to parse XML in Swift. If you're familiar with NSXMLParser, this library is a simple wrapper around it. Conceptually, it provides a translation from XML to a dictionary of arrays (aka hash).

The API takes a lot of inspiration from SwiftyJSON.



  • iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 8.0+


SWXMLHash can be installed using CocoaPods, Carthage, Swift Package Manager, or manually.


To install CocoaPods, run:

$ gem install cocoapods

Then create a Podfile with the following contents:

platform :ios, '10.0'

target 'YOUR_TARGET_NAME' do
  pod 'SWXMLHash', '~> 5.0.0'

Finally, run the following command to install it:

$ pod install


To install Carthage, run (using Homebrew):

$ brew update
$ brew install carthage

Then add the following line to your Cartfile:

github "drmohundro/SWXMLHash" ~> 5.0

Swift Package Manager

Swift Package Manager requires Swift version 4.0 or higher. First, create a Package.swift file. It should look like:

dependencies: [
    .package(url: "", from: "5.0.0")

swift build should then pull in and compile SWXMLHash for you to begin using.

Manual Installation

To install manually, you'll need to clone the SWXMLHash repository. You can do this in a separate directory or you can make use of git submodules - in this case, git submodules are recommended so that your repository has details about which commit of SWXMLHash you're using. Once this is done, you can just drop the SWXMLHash.swift file into your project.

NOTE: if you're targeting iOS 7, you'll have to install manually because embedded frameworks require a minimum deployment target of iOS 8 or OSX Mavericks.

Getting Started

If you're just getting started with SWXMLHash, I'd recommend cloning the repository down and opening the workspace. I've included a Swift playground in the workspace which makes it easy to experiment with the API and the calls.

Swift Playground


SWXMLHash allows for limited configuration in terms of its approach to parsing. To set any of the configuration options, you use the configure method, like so:

let xml = SWXMLHash.config {
              config in
              // set any config options here

The available options at this time are:

  • shouldProcessLazily
    • This determines whether not to use lazy loading of the XML. It can significantly increase the performance of parsing if your XML is large.
    • Defaults to false
  • shouldProcessNamespaces
    • This setting is forwarded on to the internal NSXMLParser instance. It will return any XML elements without their namespace parts (i.e. "<h:table>" will be returned as "<table>")
    • Defaults to false
  • caseInsensitive
    • This setting allows for key lookups to be case insensitive. Typically XML is a case sensitive language, but this option lets you bypass this if necessary.
    • Defaults to false
  • encoding
    • This setting allows for explicitly specifying the character encoding when an XML string is passed to parse.
    • Defaults to String.encoding.utf8
  • userInfo
    • This setting mimics Codable's userInfo property to allow the user to add contextual information that will be used for deserialization.
    • See Codable's userInfo docs
    • The default is [:]
  • detectParsingErrors
    • This setting attempts to detect XML parsing errors. parse will return an XMLIndexer.parsingError if any parsing issues are found.
    • Defaults to false (because of backwards compatibility and because many users attempt to parse HTML with this library)


All examples below can be found in the included specs.


let xml = SWXMLHash.parse(xmlToParse)

Alternatively, if you're parsing a large XML file and need the best performance, you may wish to configure the parsing to be processed lazily. Lazy processing avoids loading the entire XML document into memory, so it could be preferable for performance reasons. See the error handling for one caveat regarding lazy loading.

let xml = SWXMLHash.config {
              config in
              config.shouldProcessLazily = true

The above approach uses the new config method, but there is also a lazy method directly off of SWXMLHash.

let xml = SWXMLHash.lazy(xmlToParse)

Single Element Lookup



Will return "Foo".


Multiple Elements Lookup



The below will return "John".


Attributes Usage


    <book id="1"><author>Bob</author></book>
    <book id="123"><author>John</author></book>
    <book id="456"><author>Mark</author></book>

The below will return "123".

xml["root"]["catalog"]["book"][1].element?.attribute(by: "id")?.text

Alternatively, you can look up an element with specific attributes. The below will return "John".

xml["root"]["catalog"]["book"].withAttribute("id", "123")["author"].element?.text

Returning All Elements At Current Level



The all method will iterate over all nodes at the indexed level. The code below will return "Fiction, Non-fiction, Technical".

", ".join(xml["root"]["catalog"]["book"] { elem in

You can also iterate over the all method:

for elem in xml["root"]["catalog"]["book"].all {

Returning All Child Elements At Current Level



The below will print "root", "catalog", "book", "genre", "title", and "date" (note the children method).

func enumerate(indexer: XMLIndexer) {
    for child in indexer.children {

enumerate(indexer: xml)

Filtering elements


    <book id=\"bk101\">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
    <book id=\"bk102\">
      <author>Ralls, Kim</author>
      <title>Midnight Rain</title>
    <book id=\"bk103\">
      <author>Corets, Eva</author>
      <title>Maeve Ascendant</title>

The following will return return "Midnight Rain". Filtering can be by any part of the XMLElement class or by index as well.

let subIndexer = xml!["root"]["catalog"]["book"]
    .filterAll { elem, _ in elem.attribute(by: "id")!.text == "bk102" }
    .filterChildren { _, index in index >= 1 && index <= 3 }


Error Handling

Using Swift 2.0's new error handling feature:

do {
    try xml!.byKey("root").byKey("what").byKey("header").byKey("foo")
} catch let error as IndexingError {
    // error is an IndexingError instance that you can deal with

Or using the existing indexing functionality:

switch xml["root"]["what"]["header"]["foo"] {
case .element(let elem):
    // everything is good, code away!
case .xmlError(let error):
    // error is an IndexingError instance that you can deal with

Note that error handling as shown above will not work with lazy loaded XML. The lazy parsing doesn't actually occur until the element or all method are called - as a result, there isn't any way to know prior to asking for an element if it exists or not.

Simple Type Conversion


  <elem>Monday, 23 January 2016 12:01:12 111</elem>

With the following implementation for Date element and attribute deserialization:

extension Date: XMLElementDeserializable, XMLAttributeDeserializable {
    public static func deserialize(_ element: XMLElement) throws -> Date {
        let date = stringToDate(element.text)

        guard let validDate = date else {
            throw XMLDeserializationError.typeConversionFailed(type: "Date", element: element)

        return validDate

    public static func deserialize(_ attribute: XMLAttribute) throws -> Date {
        let date = stringToDate(attribute.text)

        guard let validDate = date else {
            throw XMLDeserializationError.attributeDeserializationFailed(type: "Date", attribute: attribute)

        return validDate

    private static func stringToDate(_ dateAsString: String) -> Date? {
        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss zzz"
        return dateAsString)

The below will return a date value:

let dt: Date = try xml["root"]["elem"].value()

Complex Types Conversion


    <book isbn="0000000001">
      <title>Book A</title>
    <book isbn="0000000002">
      <title>Book B</title>
    <book isbn="0000000003">
      <title>Book C</title>

with Book struct implementing XMLIndexerDeserializable:

struct Book: XMLIndexerDeserializable {
    let title: String
    let price: Double
    let year: Int
    let amount: Int?
    let isbn: Int
    let category: [String]

    static func deserialize(_ node: XMLIndexer) throws -> Book {
        return try Book(
            title: node["title"].value(),
            price: node["price"].value(),
            year: node["year"].value(),
            amount: node["amount"].value(),
            isbn: node.value(ofAttribute: "isbn"),
            category : node["categories"]["category"].value()

The below will return an array of Book structs:

let books: [Book] = try xml["root"]["books"]["book"].value()

Types Conversion

You can convert any XML to your custom type by implementing XMLIndexerDeserializable for any non-leaf node (e.g. <book> in the example above).

For leaf nodes (e.g. <title> in the example above), built-in converters support Int, Double, Float, Bool, and String values (both non- and -optional variants). Custom converters can be added by implementing XMLElementDeserializable.

For attributes (e.g. isbn= in the example above), built-in converters support the same types as above, and additional converters can be added by implementing XMLAttributeDeserializable.

Types conversion supports error handling, optionals and arrays. For more examples, look into SWXMLHashTests.swift or play with types conversion directly in the Swift playground.


Does SWXMLHash handle URLs for me?

No - SWXMLHash only handles parsing of XML. If you have a URL that has XML content on it, I'd recommend using a library like AlamoFire to download the content into a string and then parsing it.

Does SWXMLHash support writing XML content?

No, not at the moment - SWXMLHash only supports parsing XML (via indexing, deserialization, etc.).

I'm getting an "Ambiguous reference to member 'subscript'" when I call .value().

.value() is used for deserialization - you have to have something that implements XMLIndexerDeserializable (or XMLElementDeserializable if it is a single element versus a group of elements) and that can handle deserialization to the left-hand side of expression.

For example, given the following:

let dateValue: Date = try! xml["root"]["date"].value()

You'll get an error because there isn't any built-in deserializer for Date. See the above documentation on adding your own deserialization support. In this case, you would create your own XMLElementDeserializable implementation for Date. See above for an example of how to add your own Date deserialization support.

I'm getting an EXC_BAD_ACCESS (SIGSEGV) when I call parse()

Chances are very good that your XML content has what is called a "byte order mark" or BOM. SWXMLHash uses NSXMLParser for its parsing logic and there are issues with it and handling BOM characters. See issue #65 for more details. Others who have run into this problem have just stripped the BOM out of their content prior to parsing.

How do I handle deserialization with a class versus a struct (such as with NSDate)?

Using extensions on classes instead of structs can result in some odd catches that might give you a little trouble. For example, see this question on StackOverflow where someone was trying to write their own XMLElementDeserializable for NSDate which is a class and not a struct. The XMLElementDeserializable protocol expects a method that returns Self - this is the part that gets a little odd.

See below for the code snippet to get this to work and note in particular the private static func value<T>() -> T line - that is the key.

extension NSDate: XMLElementDeserializable {
    public static func deserialize(_ element: XMLElement) throws -> Self {
        guard let dateAsString = element.text else {
            throw XMLDeserializationError.nodeHasNoValue

        let dateFormatter = NSDateFormatter()
        dateFormatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss zzz"
        let date = dateFormatter.dateFromString(dateAsString)

        guard let validDate = date else {
            throw XMLDeserializationError.typeConversionFailed(type: "Date", element: element)

        // NOTE THIS
        return value(validDate)

    // AND THIS
    private static func value<T>(date: NSDate) -> T {
        return date as! T

How do I handle deserialization with an enum?

Check out this great suggestion/example from @woolie up at

Have a different question?

Feel free to shoot me an email, post a question on StackOverflow, or open an issue if you think you've found a bug. I'm happy to try to help!

Another alternative is to post a question in the Discussions.


See CHANGELOG for a list of all changes and their corresponding versions.


See CONTRIBUTING for guidelines to contribute back to SWXMLHash.


SWXMLHash is released under the MIT license. See LICENSE for details.

  • Add automatic deserialization of attributes.

    Add automatic deserialization of attributes.

    Recent pull request #68 from @ncreated introduced automatic type conversion for Elements and Indexers, but working with attributes is still painful. I am working with some (imo) poorly designed XML, which has a number of elements like this:

    <stats minplayers="2" maxplayers="2" minplaytime="40" maxplaytime="60" playingtime="60" numowned="253" rating="8.5">

    It would be nice to be able to automatically convert these attributes into Int, Float, Double, Bool, and String types (as well as Int?, Float?, etc...) with a syntax similar to node["test"].value().

    As it stands now, when processing attributes within a deserializer, I need to do crazy optional gymnastics, like this:

    var minPlayers: Int
    if let minPlayersString = node["stats"].attribute("minplayers") {
       if let minPlayersInt = Int(minPlayersString) {
          minPlayers = minPlayersInt

    I would love to be able to replace this with something like this: var minPlayers: Int = node["stats"].attribute("minplayers")

    Swift's 'guard' syntax makes this slightly less laborious if the values are guaranteed to be there, but there is still certainly room for improvement.

    opened by gca3020 33
  • This node is invalid:

    This node is invalid:

    I'm fetching Google Contacts and I'm trying to Deserialize the object using 'SWXMLHash' but when I try to Deserialize it gives error

    This node is invalid:

    Data format

    <feed gd:etag="W/"DEENSH0_fit7I2A9XR9QEk8.""
        <id>[email protected]</id>
        <category scheme="" term=""></category>
        <title>Nitesh's Contacts</title>
        <link rel="alternate" type="text/html" href=""></link>
        <link rel="" type="application/atom+xml" href=""></link>
        <link rel="" type="application/atom+xml" href=""></link>
        <link rel="" type="application/atom+xml" href=""></link>
        <link rel="self" type="application/atom+xml" href=""></link>
            <email>[email protected]</email>
        <generator uri="" version="1.0">Contacts</generator>
        <entry gd:etag=""Q3wzeDsadssaVSLysdadst7I2Adas9XRVaEk8PRAI."">
            <category scheme="" term=""></category>
            <link rel="" type="image/*" href=""></link>
            <link rel="self" type="application/atom+xml" href=""></link>
            <link rel="edit" type="application/atom+xml" href=""></link>
            <gd:organization rel="">
            <gd:email rel="" address="[email protected]" primary="true"></gd:email>
            <gd:phoneNumber rel="" uri="tel:+91-9922dsd9-26631">+91 99-22-926631</gd:phoneNumber>
            <gContact:groupMembershipInfo deleted="false" href=""></gContact:groupMembershipInfo>

    GoogleContactsDeserializable File

    struct GoogleContacts: XMLIndexerDeserializable {
        let fullName: String
        let email: String
        static func deserialize(_ node: XMLIndexer) throws -> GoogleContacts {
            return try GoogleContacts(
                fullName: node["gd:name"]["gd:fullName"].value(),
                email: node["gd:email"].value(ofAttribute: "address")


    let xml = SWXMLHash.parse(data)
    do {
        let nodes: [GoogleContacts] = try xml["feed"]["entry"].value()
    } catch let error {
    opened by n1tesh 18
  • Async NSXML can’t work in sync mode, please add completion handlers

    Async NSXML can’t work in sync mode, please add completion handlers

    Sometimes “parse” method returns an empty object (every 4-5th execution)

    Code: let xml = SWXMLHash.parse(data)

    Log: (lldb) po xml Element { Element = 0x00007f93f2e18960 { name = "SWXMLHash_Root_Element" text = nil attributes = {} children = 0 values {} count = 0 index = 0 } }

    (lldb) po data <OS_dispatch_data: data[0x7f93f2e29830] = { composite, size = 2031, num_records = 2 record[0] = { from = 0, length = 1297, data_object = 0x7f93f2ccdff0 }, record[1] = { from = 0, length = 734, data_object = 0x7f93f2e157c0 }, }>

    need repro awaiting reply 
    opened by alusev 14
  • Add support for Swift 3 and Xcode 8 support

    Add support for Swift 3 and Xcode 8 support

    At the moment, SWXMLHash itself compiles, but the tests won't compile without a corresponding Swift 3 version of both Quick and Nimble.

    This PR will also be what ships in SWXMLHash version 3.0.0.

    opened by drmohundro 13
  • Getting entire HTML between opening and closing tag.

    Getting entire HTML between opening and closing tag.

    My question might be a little bit lame but I just can't figure it out. How to get everything between opening and closing html tag? For example now I have let b = xml["everything"]["news"][i]["content"].element?.text which returns string: Click this for super cool news. and I would like it to return Click this <a href="">link</a> for super cool news. Thank you for help.

    bug help wanted question 
    opened by Pawel-Janik 13
  • Carthage using builds unnecessary dependencies

    Carthage using builds unnecessary dependencies

    Nimble and Quick dependencies are builded too, because they have shared scheme in project. But I want to use SWXMLHash and Nimble or Quick are worthless for me. And it takes some time when more frameworks is builded.

    opened by tomassliz 12
  • lazily create nested enums

    lazily create nested enums

    Reading it makes me think that this would be the right way to create the nested enum structure lazily.

    Any thoughts?

    opened by tkrajacic 12
  • Getting Attribute count to add values to an array in Swift with SWXMLHash

    Getting Attribute count to add values to an array in Swift with SWXMLHash

    Here is the XML I'm parsing with SWXMLHash:

    <response version="1.2" xsi:noNamespaceSchemaLocation="" xmlns:xsd="" xmlns:xsi="">'
        <data_source name="metars"/>
        <request type="retrieve"/>
        <data num_results="1">
                <raw_text>KDEN 261153Z 07012KT 3SM -FZDZSN BKN004 OVC008 M05/M06 A3009 RMK AO2 SLP213 P0000 60000 I1000 I6000 T10501061 11039 21050 53009</raw_text>
                <wx_string>-FZDZ SN</wx_string>
                <sky_condition cloud_base_ft_agl="400" sky_cover="BKN"/>
                <sky_condition cloud_base_ft_agl="800" sky_cover="OVC"/>

    I want to get the count of sky_condition sky_cover sky_base_ft_agl as there is always at least one with no cloud base (CLR) or multiple FEW, BKN or OVC with cloud bases with each. I want to be able to get the number of sky conditions and then enumerate through them and add them to an array so that I can show them on a label together.

    Here is the code I have to get the data to parse and then present to a label:

     func getWxData () {
            let urlStringMax = ""
        if let urlMax = NSURL(string: urlStringMax) {
            if let data = try? NSData(contentsOfURL: urlMax, options: []) {
               let xml = SWXMLHash.parse(data)
                metar1 = xml["response"]["data"]["METAR"]["raw_text"].element!.text!
               skycover = xml["response"]["data"]["METAR"]["sky_condition"][0].element?.attributes["sky_cover"]

    Any help would be greatly appreciated!!

    opened by zdigitalpro 11
  • Trouble parsing this kind of XML

    Trouble parsing this kind of XML

    I've been using this framework for a while, and had no trouble with it. But now I need to parse this kind of response and I cannot understand/find a way to build a model class to parse this.

    Any help?

    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="" xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="" xmlns:SOAP-ENC="" xmlns:tns="urn:xxxxxxxxxxxx">
          <ns1:BuscarDebitosPendentesResponse xmlns:ns1="BuscarDebitosPendentes">
             <return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:DebitosPendentes[19]">
                 <item xsi:type="tns:DebitosPendentes">
                     <Vencimento xsi:type="xsd:string">xxxxxxxxxxxx</Vencimento>
                     <ValorAtualizado xsi:type="xsd:decimal">xxxxxxxxxxxx</ValorAtualizado>
                     <Valor xsi:type="xsd:decimal">xxxxxxxxxxxx</Valor>
                     <Sequencia xsi:type="xsd:string">xxxxxxxxxxxx</Sequencia>
                     <NroBanco xsi:type="xsd:int">xxxxxxxxxxxx</NroBanco>
                     <BcoCobr xsi:type="xsd:int">xxxxxxxxxxxx</BcoCobr>
                     <Cobranca xsi:type="xsd:string">xxxxxxxxxxxx</Cobranca>
                     <Itens xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:ListaItens[1]">
                         <item xsi:type="tns:ListaItens">
                            <Descricao xsi:type="xsd:string">xxxxxxxxxxxx</Descricao>
                            <ValorItem xsi:type="xsd:decimal">xxxxxxxxxxxx</ValorItem>
    opened by JFSene 9
  • Add automatic type conversion

    Add automatic type conversion

    This PR adds automatic type conversion, like this:

    let books: [Book] = try xml["root"]["books"]["book"].value()

    Inspired by discussion in

    opened by ncreated 9
  • Rename Framework

    Rename Framework

    I have this issue when I create my XCFramework and the build tool generate my .swiftinterface files. With my dependency on SWXMLHash and a contained class of the same name, I run into the same issues found in the link above.

    The short of it is that the classes in your framework are listed in the .swiftinterface file and the framework name is prepended. So XMLIndexerDeserializable becomes SWXMLHash.XMLIndexerDeserializable and Swift looks in the SWXMLHash class for XMLIndexerDeserializable.

    The above link also contains a link to the issue to address,, however, doesn't look like this will be available any time soon.

    opened by fgarciaDev 8
  • Elements with namespaces have their element names

    Elements with namespaces have their element names "switched"

    Running the following on Ubuntu (via Docker):

    let podcastURL = URL(string: "")!
    let contents = try String(contentsOf: podcastURL, encoding: .utf8)
    let xml = SWXMLHash.parse(contents)

    will switch an element name (around the :) when it has a namespace. For e.g., the string contents has

    <itunes:image href="" />

    while the xml print out gives:

    <image:itunes href=""></image:itunes>

    Note: this is only on Linux; the same code on macOS gives the correct element name.

    Platform: ubuntu:16.04 Xcode 9.2, Swift 4.0.3

    opened by raheelahmad 4
  • Type conversion with nested nodes

    Type conversion with nested nodes

    I was wondering if SWXMLHash supports nested nodes of the same type.

    Given the following XML:

    <?xml version="1.0" encoding="UTF-8"?>

    And the code:

    let xml = SWXMLHash.parse(content!)
    struct Node: XMLIndexerDeserializable {
        let name: String
        let node: [Node]?
        static func deserialize(node: XMLIndexer) throws -> Node {
            return try Node(
                name: node["name"].value(),
                node: node["node"].value()
    do {
        let nodes: [Node] = try xml["nodes"]["node"].value()
    } catch let error {

    This results in the message "This node is invalid: \n". This is working with child nodes, that are not of type Node.

    opened by olisim 6
  • 7.0.1(May 7, 2022)

    Renaming XMLIndexerDeserializable protocol and Adding XMLValueDeserialization protocol

    I renamed XMLIndexerDeserializable to be XMLObjectDeserialization - its purpose is to deserialize object structures like classes or structs. So, multiple values. Then, there is a new protocol named XMLValueDeserialization - it serves the purpose of both XMLElementDeserializable and XMLAttributeDeserializable. It is only used for custom value deserialization. I hope this will clarify the usage a lot. It makes sense to me anyway!

    This should cover the use case at

    Usability of Errors

    Multiple times when helping people, I'd notice that the nodeIsInvalid error would get thrown, but the error message was just about impossible to determine what was wrong. The code had implemented CustomStringConvertible but everyone was using localizedDescription. Now, errors implement LocalizedError, too, so it is a lot more obvious to see the elements that had caused issues.

    Code Reorganization

    The code had all been lumped into two Swift files since the beginning. It was unwieldy then, but it has just gotten worse. So I gave in and broke them all out into their own files by type. Much better.

    Source code(tar.gz)
    Source code(zip)
  • 6.0.0(Sep 29, 2021)

    Released on 2021-09-28.

    • Rename main class from SWXMLHash to XMLHash so that the module name (i.e. SWXMLHash) doesn't conflict with the class name. There are a decent number of issues related to naming conflicts so hopefully this will avoid them. Fixes #242, see also links on PR #246 where other similar issues are documented.
    Source code(tar.gz)
    Source code(zip)
  • 5.0.0(Aug 29, 2019)

    Released on 2019-08-28.

    • Added official/full Swift 5.1 compatibility (via #216)
      • Note that API compatibility hasn't changed... it is a major version upgrade to support new language features.
    Source code(tar.gz)
    Source code(zip)
  • 4.9.0(Mar 29, 2019)

  • 4.8.0(Mar 6, 2019)

  • 4.7.6(Dec 11, 2018)

  • 4.7.5(Nov 26, 2018)

  • 4.7.4(Nov 26, 2018)

  • 4.7.2(Nov 26, 2018)

  • 4.7.1(Aug 4, 2018)

  • 4.7.0(May 7, 2018)

  • 4.6.0(Mar 10, 2018)

  • 4.5.1(Mar 8, 2018)

  • 4.5.0(Feb 21, 2018)

  • 4.4.1(Feb 21, 2018)

  • 4.4.0(Feb 4, 2018)

  • 4.3.6(Jan 21, 2018)

  • 4.3.5(Jan 15, 2018)

  • 4.2.5(Nov 10, 2017)

  • 4.2.4(Nov 9, 2017)

  • 4.2.3(Sep 28, 2017)

  • 4.2.2(Sep 22, 2017)

  • 4.2.1(Sep 22, 2017)

  • 4.2.0(Sep 22, 2017)

  • 4.1.1(Sep 22, 2017)

  • 4.1.0(Sep 22, 2017)

  • 4.0.0(Sep 22, 2017)

    Released on 2017-05-15.

    • Changed all enums to be camel cased (e.g. thisValue versus ThisValue) to match the Swift naming recommendations
    • Removed Sequence from XMLIndexer to avoid a conflict with the element property coming in Swift 4
      • As a result, for-in no longer works directly against XMLIndexer; however, for-in works just fine against the .all method
    • Changed .text to no longer be optional

    (via #133, #134 and #135)

    Source code(tar.gz)
    Source code(zip)
  • 3.1.0(Sep 24, 2017)

    Released on 2017-05-15.

    Added recursiveText property which pulls the text property from the currently indexed element and all child elements. (see PR #131)

    Source code(tar.gz)
    Source code(zip)
  • 3.0.5(Sep 24, 2017)

  • 3.0.4(Sep 24, 2017)

David Mohundro
Dad, Code, Tech, Games, comma-delimited lists.
David Mohundro
Easy XML parsing using Codable protocols in Swift

XMLCoder Encoder & Decoder for XML using Swift's Codable protocols. This package is a fork of the original ShawnMoore/XMLParsing with more features an

Max Desiatov 647 Nov 17, 2022
A simple way to map XML to Objects written in Swift

XMLMapper XMLMapper is a framework written in Swift that makes it easy for you to convert your model objects (classes and structs) to and from XML. Ex

Giorgos Charitakis 107 Nov 14, 2022
Simple XML Parser implemented in Swift

Simple XML Parser implemented in Swift What's this? This is a XML parser inspired by SwiftyJSON and SWXMLHash. NSXMLParser in Foundation framework is

Yahoo! JAPAN 529 Nov 20, 2022
CheatyXML is a Swift framework designed to manage XML easily

CheatyXML CheatyXML is a Swift framework designed to manage XML easily. Requirements iOS 8.0 or later tvOS 9.0 or later Installation Cocoapods If you'

Louis Bodart 24 Mar 31, 2022
The most swifty way to deal with XML data in swift 5.

SwiftyXML SwiftyXML use most swifty way to deal with XML data. Features Infinity subscript dynamicMemberLookup Support (use $ started string to subscr

Kevin 99 Sep 6, 2022
A fast & lightweight XML & HTML parser in Swift with XPath & CSS support

Fuzi (斧子) A fast & lightweight XML/HTML parser in Swift that makes your life easier. [Documentation] Fuzi is based on a Swift port of Mattt Thompson's

Ce Zheng 983 Nov 15, 2022
Ji (戟) is an XML/HTML parser for Swift

Ji 戟 Ji (戟) is a Swift wrapper on libxml2 for parsing XML/HTML. Features Build XML/HTML Tree and Navigate. XPath Query Supported. Comprehensive Unit T

HongHao Zhang 823 Nov 21, 2022
Kanna(鉋) is an XML/HTML parser for Swift.

Kanna(鉋) Kanna(鉋) is an XML/HTML parser for cross-platform(macOS, iOS, tvOS, watchOS and Linux!). It was inspired by Nokogiri(鋸). ℹ️ Documentation Fea

Atsushi Kiwaki 2.3k Nov 19, 2022
A sensible way to deal with XML & HTML for iOS & macOS

Ono (斧) Foundation lacks a convenient, cross-platform way to work with HTML and XML. NSXMLParser is an event-driven, SAX-style API that can be cumbers

Mattt 2.6k Nov 13, 2022
Generate styled SwiftUI Text from strings with XML tags.

XMLText is a mini library that can generate SwiftUI Text from a given XML string with tags. It uses AttributedString to compose the final text output.

null 14 Oct 20, 2022
Fetch a XML feed and parse it into objects

AlamofireXmlToObjects ?? This is now a subspec of EVReflection and the code is maintained there. ?? You can install it as a subspec like this: use_fra

Edwin Vermeer 65 Dec 29, 2020
SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)

SwiftSoup is a pure Swift library, cross-platform (macOS, iOS, tvOS, watchOS and Linux!), for working with real-world HTML. It provides a very conveni

Nabil Chatbi 3.6k Nov 25, 2022
Mathias Köhnke 1.1k Oct 14, 2022
📄 A Swift DSL for writing type-safe HTML/CSS in SwiftUI way

?? swift-web-page (swep) Swep is a Swift DSL for writing type-safe HTML/CSS in SwiftUI way. Table of Contents Motivation Examples Safety Design FAQ In

Abdullah Aljahdali 13 Aug 30, 2022
Swift package to convert a HTML table into an array of dictionaries.

Swift package to convert a HTML table into an array of dictionaries.

null 1 Jun 18, 2022
Mongrel is a Swift and HTML hybrid with a bit of support for CSS and Javascript.

Mongrel is a Swift and HTML hybrid with a bit of support for CSS and Javascript. Using a declaritive style of programming, Mongrel makes writing HTML feel natural and easy. Mongrel also uses a SwiftUI like body structure allowing structs to be completely dedicated as an HTML page or element.

Nicholas Bellucci 12 Sep 22, 2022
Simple XML parsing in Swift

SWXMLHash SWXMLHash is a relatively simple way to parse XML in Swift. If you're familiar with NSXMLParser, this library is a simple wrapper around it.

David Mohundro 1.3k Nov 22, 2022
Easy XML parsing using Codable protocols in Swift

XMLCoder Encoder & Decoder for XML using Swift's Codable protocols. This package is a fork of the original ShawnMoore/XMLParsing with more features an

Max Desiatov 647 Nov 17, 2022
A lightweight XMLParser for assembling and parsing XML values written for iOS 8+ in Swift 2.

Overview Description Requirements Installation Usage Author License Description XMLParser lets you convert a pure Swift dictionary into XML string and

Eugene Mozharovsky 75 Feb 2, 2022
Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable

Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable. Elevate should no longer be used for

Nike Inc. 611 Oct 23, 2022