AtomFeed {atom4R} | R Documentation |
Atom feed class
Description
This class models an atom feed
Format
R6Class
object.
Details
AtomFeed
Value
Object of R6Class
for modelling an Atom feed
Methods
new(xml)
-
This method is used to create an Atom Feed
setId(id)
-
Set identifier
setUpdated(updated)
-
Set update date (object of class 'character' or 'POSIX')
addLink(link, rel, type)
-
Adds a link. Default
rel
value is set to "alternate". Defaulttype
value is set to "text/html" delLink(link, rel, type)
-
Deletes a link
setSelfLink(link)
-
Sets a self-relation link
setAlternateLink(link, type)
-
Sets an alternate-relation link. Default type is "text/html"
setTitle(title)
-
Set title
setSubtitle(subtitle)
-
Set subtitle
addAuthor(author)
-
Adds an author, object of class
AtomAuthor
delAuthor(author)
-
Deletes an author, object of class
AtomAuthor
addContributor(contributor)
-
Adds a contributor, object of class
AtomContributor
delContributor(contributor)
-
Deletes a contributor, object of class
AtomContributor
setGenerator(generator, type)
-
Sets generator
setIcon(icon)
-
Sets icon
addCategory(term, scheme, label)
-
Adds a category
delCategory(term, scheme, label)
-
Deletes a category
addEntry(entry)
-
Adds an entry, object of class
AtomEntry
delEntry(entry)
-
Deletes an entry, object of class
AtomEntry
Super classes
atom4R::atom4RLogger
-> atom4R::AtomAbstractObject
-> AtomFeed
Public fields
id
Identifier
updated
Update date
published
Publication date
title
Title
subtitle
Subtitle
rights
Rights (license, use, ...)
author
Author person
contributor
Contributor person
generator
Generator
icon
Icon
logo
Logo
category
Category
link
links
entry
List of entries
Methods
Public methods
Inherited methods
atom4R::atom4RLogger$ERROR()
atom4R::atom4RLogger$INFO()
atom4R::atom4RLogger$WARN()
atom4R::atom4RLogger$logger()
atom4R::AtomAbstractObject$addListElement()
atom4R::AtomAbstractObject$contains()
atom4R::AtomAbstractObject$createElement()
atom4R::AtomAbstractObject$decode()
atom4R::AtomAbstractObject$delListElement()
atom4R::AtomAbstractObject$encode()
atom4R::AtomAbstractObject$getClass()
atom4R::AtomAbstractObject$getClassName()
atom4R::AtomAbstractObject$getNamespace()
atom4R::AtomAbstractObject$getNamespaceDefinition()
atom4R::AtomAbstractObject$getRootElement()
atom4R::AtomAbstractObject$getXmlElement()
atom4R::AtomAbstractObject$isDocument()
atom4R::AtomAbstractObject$isFieldInheritedFrom()
atom4R::AtomAbstractObject$print()
atom4R::AtomAbstractObject$save()
atom4R::AtomAbstractObject$setIsDocument()
atom4R::AtomAbstractObject$validate()
Method new()
Initializes a AtomFeed
Usage
AtomFeed$new(xml = NULL)
Arguments
xml
object of class XMLInternalNode-class from XML
Method setId()
Set ID
Usage
AtomFeed$setId(id)
Arguments
id
id
Method setUpdated()
Set updated date
Usage
AtomFeed$setUpdated(updated)
Arguments
updated
object of class
Date
orPOSIXt
Method setPublished()
Set published date
Usage
AtomFeed$setPublished(published)
Arguments
published
object of class
Date
orPOSIXt
Method addLink()
Adds link
Usage
AtomFeed$addLink(link, rel = "alternate", type = "text/html")
Arguments
link
link
rel
relation. Default is "alternate"
type
type. Default is "text/html"
Returns
TRUE
if added, FALSE
otherwise
Method delLink()
Deletes link
Usage
AtomFeed$delLink(link, rel = "alternate", type = "text/html")
Arguments
link
link
rel
relation. Default is "alternate"
type
type. Default is "text/html"
Returns
TRUE
if deleted, FALSE
otherwise
Method setSelfLink()
Set self link
Usage
AtomFeed$setSelfLink(link)
Arguments
link
link
Returns
TRUE
if set, FALSE
otherwise
Method setAlternateLink()
Set alternate link
Usage
AtomFeed$setAlternateLink(link, type = "text/html")
Arguments
link
link
type
type. Default is "text/html"
Returns
TRUE
if set, FALSE
otherwise
Method setTitle()
Set title
Usage
AtomFeed$setTitle(title, type = "text")
Arguments
title
title
type
type. Default is "text"
Method setSubtitle()
Set subtitle
Usage
AtomFeed$setSubtitle(subtitle, type = "text")
Arguments
subtitle
subtitle
type
type. Default is "text"
Method setRights()
Set rights
Usage
AtomFeed$setRights(rights, type = "text")
Arguments
rights
rights
type
type. Default is "text"
Method addAuthor()
Adds author
Usage
AtomFeed$addAuthor(author)
Arguments
author
object of class AtomAuthor
Returns
TRUE
if added, FALSE
otherwise
Method delAuthor()
Deletes author
Usage
AtomFeed$delAuthor(author)
Arguments
author
object of class AtomAuthor
Returns
TRUE
if deleted, FALSE
otherwise
Method addContributor()
Adds contributor
Usage
AtomFeed$addContributor(contributor)
Arguments
contributor
object of class AtomContributor
Returns
TRUE
if added, FALSE
otherwise
Method delContributor()
Deletes contributor
Usage
AtomFeed$delContributor(contributor)
Arguments
contributor
object of class AtomContributor
Returns
TRUE
if deleted, FALSE
otherwise
Method setGenerator()
Set generator
Usage
AtomFeed$setGenerator(generator, type = "text")
Arguments
generator
generator
type
type. Default is "text"
Method setIcon()
Set icon
Usage
AtomFeed$setIcon(icon)
Arguments
icon
icon
Method addCategory()
Adds category
Usage
AtomFeed$addCategory(value, term, scheme = NULL, label = NULL)
Arguments
value
value
term
term
scheme
scheme
label
label
Returns
TRUE
if added, FALSE
otherwise
Method delCategory()
Deletes category
Usage
AtomFeed$delCategory(value, term, scheme = NULL, label = NULL)
Arguments
value
value
term
term
scheme
scheme
label
label
Returns
TRUE
if deleted, FALSE
otherwise
Method addEntry()
Adds an entry
Usage
AtomFeed$addEntry(entry)
Arguments
entry
object of class AtomEntry
Returns
TRUE
if added, FALSE
otherwise
Method delEntry()
Deletes an entry
Usage
AtomFeed$delEntry(entry)
Arguments
entry
object of class AtomEntry
Returns
TRUE
if deleted, FALSE
otherwise
Method clone()
The objects of this class are cloneable with this method.
Usage
AtomFeed$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Emmanuel Blondel <emmanuel.blondel1@gmail.com>
Examples
#encoding
atom <- AtomFeed$new()
atom$setId("my-atom-feed")
atom$setTitle("My Atom feed title")
atom$setSubtitle("MyAtom feed subtitle")
author1 <- AtomAuthor$new(
name = "John Doe",
uri = "http://www.atomxml.com/johndoe",
email = "johndoe@atom4R.com"
)
atom$addAuthor(author1)
author2 <- AtomAuthor$new(
name = "John Doe's sister",
uri = "http://www.atomxml.com/johndoesister",
email = "johndoesister@atom4R.com"
)
atom$addAuthor(author2)
contrib1 <- AtomContributor$new(
name = "Contrib1",
uri = "http://www.atomxml.com/contrib1",
email = "contrib1@atom4R.com"
)
atom$addContributor(contrib1)
contrib2 <- AtomContributor$new(
name = "Contrib2",
uri = "http://www.atomxml.com/contrib2",
email = "contrib2@atom4R.com"
)
atom$addContributor(contrib2)
atom$setIcon("https://via.placeholder.com/300x150.png/03f/fff?text=atom4R")
atom$setSelfLink("http://example.com/atom.feed")
atom$setAlternateLink("http://example.com/my-atom-feed")
atom$addCategory("draft", "dataset")
atom$addCategory("world", "spatial")
atom$addCategory("fisheries", "domain")
#add entry
entry <- AtomEntry$new()
entry$setId("my-atom-entry")
entry$setTitle("My Atom feed entry")
entry$setSummary("My Atom feed entry very comprehensive abstract")
author1 <- AtomAuthor$new(
name = "John Doe",
uri = "http://www.atomxml.com/johndoe",
email = "johndoe@atom4R.com"
)
entry$addAuthor(author1)
author2 <- AtomAuthor$new(
name = "John Doe's sister",
uri = "http://www.atomxml.com/johndoesister",
email = "johndoesister@atom4R.com"
)
entry$addAuthor(author2)
contrib1 <- AtomContributor$new(
name = "Contrib1",
uri = "http://www.atomxml.com/contrib1",
email = "contrib1@atom4R.com"
)
entry$addContributor(contrib1)
contrib2 <- AtomContributor$new(
name = "Contrib2",
uri = "http://www.atomxml.com/contrib2",
email = "contrib2@atom4R.com"
)
entry$addContributor(contrib2)
entry$addCategory("draft", "dataset")
entry$addCategory("world", "spatial")
entry$addCategory("fisheries", "domain")
atom$addEntry(entry)
xml <- atom$encode()