Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pvorb/atom
Create Atom feeds with Scala
https://github.com/pvorb/atom
Last synced: about 1 month ago
JSON representation
Create Atom feeds with Scala
- Host: GitHub
- URL: https://github.com/pvorb/atom
- Owner: pvorb
- License: mit
- Created: 2012-05-31T07:52:20.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-05-31T14:49:18.000Z (over 12 years ago)
- Last Synced: 2024-04-14T22:22:12.654Z (7 months ago)
- Size: 105 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Atom
====Atom feed library written in Scala.
Usage example
-------------```scala
import java.net.URI
import scala.compat.Platform
import scala.xml.{ PrettyPrinter, Utility }
import de.vorb.xml.atomobject UsageExample extends App {
lazy val entries =
Entry(
id = "http://example.com/2012/test.html",
title = Text("Test"),
content = Some(Text("This is some example text.
", "html")),
updated = Platform.currentTime) ::
Entry(
id = "http://example.com/2012/test2.html",
title = Text("Test 2"),
content = Some(Text("This is some example text.
", "html")),
updated = Platform.currentTime) ::
Nilval feed = Feed(
id = "http://example.com/feed.xml",
title = "Example articles",
updated = Platform.currentTime,
authors = List(
Person("John Doe",
Some("[email protected]"),
Some("http://example.com/john.html")),
Person("Jane Doe",
Some("[email protected]"),
Some("http://example.com/jane.html"))),
links = List(Link("http://example.com/feed.xml", Some("self"))),
entries = entries,
categories = List(Category("test")),
icon = Some("http://example.com/favicon.ico"))val prettyPrinter = new PrettyPrinter(80, 2);
println(prettyPrinter.format(feed.toXML))
}
```This will print something like:
```
http://example.com/feed.xml
Example articles
2012-05-31T16:46:33.851+02:00
John Doe
[email protected]
http://example.com/john.html
Jane Doe
[email protected]
http://example.com/jane.html
http://example.com/2012/test.html
Test
2012-05-31T16:46:33.911+02:00
<p>This is some example text.</p>
http://example.com/2012/test2.html
Test 2
2012-05-31T16:46:33.952+02:00
<p>This is some example text.</p>
http://example.com/favicon.ico```
License
-------Copyright © 2012 Paul Vorbach
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.