Last active
March 9, 2018 02:47
-
-
Save drmohundro/04bc4376d8087711c1058fa4d44ee9c3 to your computer and use it in GitHub Desktop.
Linux namespace and SWXMLHash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let podcastURL = URL(string: "http://feed.thisamericanlife.org/talpodcast")! | |
let contents = """ | |
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/" version="2.0" xml:base="https://www.example.com"> | |
<channel> | |
<title>Some Title</title> | |
<link>https://www.example.com</link> | |
<description>some awesome feed.</description> | |
<language>en</language> | |
<copyright>Copyright 1995-3001</copyright> | |
<itunes:author>John Doe</itunes:author> | |
<itunes:subtitle>sweet subtitle</itunes:subtitle> | |
<itunes:owner> <itunes:email>[email protected]</itunes:email> | |
</itunes:owner> | |
</channel> | |
</rss> | |
""" | |
let xml2 = SWXMLHash.config { cfg in cfg.shouldProcessNamespaces = true }.parse(contents) | |
print(contents) | |
print("-----") | |
print(xml2.description) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/" version="2.0" xml:base="https://www.example.com"> | |
<channel> | |
<title>Some Title</title> | |
<link>https://www.example.com</link> | |
<description>some awesome feed.</description> | |
<language>en</language> | |
<copyright>Copyright 1995-3001</copyright> | |
<itunes:author>John Doe</itunes:author> | |
<itunes:subtitle>sweet subtitle</itunes:subtitle> | |
<itunes:owner> <itunes:email>[email protected]</itunes:email> | |
</itunes:owner> | |
</channel> | |
</rss> | |
----- | |
<rss version="2.0" xml:base="https://www.example.com"> | |
<channel> | |
<title>Some Title</title> | |
<link>https://www.example.com</link> | |
<description>some awesome feed.</description> | |
<language>en</language> | |
<copyright>Copyright 1995-3001</copyright> | |
<author>John Doe</author> | |
<subtitle>sweet subtitle</subtitle> | |
<owner> <email>[email protected]</email> | |
</owner> | |
</channel> | |
</rss> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment