| 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
relvalue is set to "alternate". Defaulttypevalue 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
idIdentifier
updatedUpdate date
publishedPublication date
titleTitle
subtitleSubtitle
rightsRights (license, use, ...)
authorAuthor person
contributorContributor person
generatorGenerator
iconIcon
logoLogo
categoryCategory
linklinks
entryList 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
xmlobject of class XMLInternalNode-class from XML
Method setId()
Set ID
Usage
AtomFeed$setId(id)
Arguments
idid
Method setUpdated()
Set updated date
Usage
AtomFeed$setUpdated(updated)
Arguments
updatedobject of class
DateorPOSIXt
Method setPublished()
Set published date
Usage
AtomFeed$setPublished(published)
Arguments
publishedobject of class
DateorPOSIXt
Method addLink()
Adds link
Usage
AtomFeed$addLink(link, rel = "alternate", type = "text/html")
Arguments
linklink
relrelation. Default is "alternate"
typetype. Default is "text/html"
Returns
TRUE if added, FALSE otherwise
Method delLink()
Deletes link
Usage
AtomFeed$delLink(link, rel = "alternate", type = "text/html")
Arguments
linklink
relrelation. Default is "alternate"
typetype. Default is "text/html"
Returns
TRUE if deleted, FALSE otherwise
Method setSelfLink()
Set self link
Usage
AtomFeed$setSelfLink(link)
Arguments
linklink
Returns
TRUE if set, FALSE otherwise
Method setAlternateLink()
Set alternate link
Usage
AtomFeed$setAlternateLink(link, type = "text/html")
Arguments
linklink
typetype. Default is "text/html"
Returns
TRUE if set, FALSE otherwise
Method setTitle()
Set title
Usage
AtomFeed$setTitle(title, type = "text")
Arguments
titletitle
typetype. Default is "text"
Method setSubtitle()
Set subtitle
Usage
AtomFeed$setSubtitle(subtitle, type = "text")
Arguments
subtitlesubtitle
typetype. Default is "text"
Method setRights()
Set rights
Usage
AtomFeed$setRights(rights, type = "text")
Arguments
rightsrights
typetype. Default is "text"
Method addAuthor()
Adds author
Usage
AtomFeed$addAuthor(author)
Arguments
authorobject of class AtomAuthor
Returns
TRUE if added, FALSE otherwise
Method delAuthor()
Deletes author
Usage
AtomFeed$delAuthor(author)
Arguments
authorobject of class AtomAuthor
Returns
TRUE if deleted, FALSE otherwise
Method addContributor()
Adds contributor
Usage
AtomFeed$addContributor(contributor)
Arguments
contributorobject of class AtomContributor
Returns
TRUE if added, FALSE otherwise
Method delContributor()
Deletes contributor
Usage
AtomFeed$delContributor(contributor)
Arguments
contributorobject of class AtomContributor
Returns
TRUE if deleted, FALSE otherwise
Method setGenerator()
Set generator
Usage
AtomFeed$setGenerator(generator, type = "text")
Arguments
generatorgenerator
typetype. Default is "text"
Method setIcon()
Set icon
Usage
AtomFeed$setIcon(icon)
Arguments
iconicon
Method addCategory()
Adds category
Usage
AtomFeed$addCategory(value, term, scheme = NULL, label = NULL)
Arguments
valuevalue
termterm
schemescheme
labellabel
Returns
TRUE if added, FALSE otherwise
Method delCategory()
Deletes category
Usage
AtomFeed$delCategory(value, term, scheme = NULL, label = NULL)
Arguments
valuevalue
termterm
schemescheme
labellabel
Returns
TRUE if deleted, FALSE otherwise
Method addEntry()
Adds an entry
Usage
AtomFeed$addEntry(entry)
Arguments
entryobject of class AtomEntry
Returns
TRUE if added, FALSE otherwise
Method delEntry()
Deletes an entry
Usage
AtomFeed$delEntry(entry)
Arguments
entryobject 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
deepWhether 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()