ComposantsComponents

ComposantsComponents › InternetInternet

tRSSOutput

tRSSOutput

InternetInternet

Écrit les lignes d'un flux sous forme de flux RSS 2.0 ou Atom, dans un fichier XML : l'en-tête du canal vient des paramètres, chaque ligne devient un article, chaque colonne un élément de cet article. Le document est construit en mémoire et écrit à la fin du sous-job. Pour publier le fichier, envoyez-le ensuite sur un serveur (tFTPPut…) ; pour lire un flux, prenez un tRSSInput. Writes the rows of a flow as an RSS 2.0 or Atom feed, to an XML file: the channel header comes from the settings, each row becomes an item, each column an element of that item. The document is built in memory and written at the end of the subjob. To publish the file, then send it to a server (tFTPPut…); to read a feed, take a tRSSInput.

EntréeInput

Main les articles à écrire, une ligne par article.the items to write, one row per item.

SortieOutput

Le fichier XML. Un lien Main en sortie transmet les lignes reçues, inchangées ; pas de lien Iterate.The XML file. A Main output link passes on the received rows, unchanged; no Iterate link.

Déclencheurs en sortieOutput triggers

On Subjob Ok On Subjob Error On Component Ok On Component Error Run if

UtilisationUsage

Des lignes vers un fichier RSSRows to an RSS file

row1 (Main) OnSubjobOk tFixedFlowInput_1 tRSSOutput_1 tJava_1

Le job des exemples : un tFixedFlowInput fournit les articles, le tRSSOutput écrit le fichier, puis un tJava l'affiche. En pratique, les articles viennent d'une base, d'un fichier ou d'un tMap qui donne aux colonnes les noms des éléments voulus. The job of the examples: a tFixedFlowInput provides the items, the tRSSOutput writes the file, then a tJava prints it. In practice, the items come from a database, a file or a tMap that gives the columns the names of the wanted elements.

  1. Déposez le tRSSOutput depuis la famille Internet de la palette et reliez-lui le flux des articles. Drop the tRSSOutput from the Internet family of the palette and connect the flow of the items to it.
  2. Indiquez le Nom de fichier ; son dossier doit exister. Give the File Name; its folder must exist.
  3. Choisissez le Mode. En RSS, nommez les colonnes du schéma comme les éléments d'un article RSS (title, link, description, guid…) et remplissez le Canal. En ATOM, le schéma est imposé et vous remplissez le Flux. Choose the Mode. In RSS, name the columns of the schema like the elements of an RSS item (title, link, description, guid…) and fill in the Channel. In ATOM, the schema is imposed and you fill in the Feed.
  4. Ajoutez au besoin des Éléments facultatifls du canal (language, image…). Add Optional Channel Elements if needed (language, image…).

Paramètres simplesBasic settings

Les libellés sont ceux de l'onglet Composant, dans son ordre ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Le composant n'a pas de paramètres avancés propres. Tous les textes du canal et du flux sont des expressions Java : "Example News", context.feedTitle. Labels are those of the Component tab, in its order; the technical name, in grey, is the parameter name in the job file. The component has no advanced settings of its own. All the texts of the channel and of the feed are Java expressions: "Example News", context.feedTitle.

ParamètreSetting DéfautDefault VisibleShown Description
Nom de fichierFile NameFILENAME chemin par défaut + /out.xmldefault path + /out.xml ToujoursAlways Le fichier écrit : "C:/data/rss/news.xml". Il est remplacé s'il existe. Son dossier n'est pas créé : absent, le composant échoue à la fin, une fois toutes les lignes reçues (voir Exemples). The written file: "C:/data/rss/news.xml". It is replaced if it exists. Its folder is not created: when it is missing, the component fails at the end, once all the rows are received (see Examples).
Écrire à la suite deAppendAPPEND NonNo ToujoursAlways Cochée et le fichier présent : il est relu, les nouveaux articles s'ajoutent après les anciens et l'en-tête prend les valeurs du composant. Marche en RSS seulement ; en Atom, le composant échoue dès que le fichier existe (voir Écrire à la suite). Checked and the file present: it is read again, the new items are added after the old ones and the header takes the values of the component. Works in RSS only; in Atom, the component fails as soon as the file exists (see Append).
EncodageEncodingENCODING "UTF-8" ToujoursAlways Encodage des octets du fichier et de la déclaration XML. Avec "ISO-8859-15", la première ligne a été <?xml version="1.0" encoding="ISO-8859-15"?> et le « é » de « Café » l'octet E9 ; un tRSSInput l'a relu correctement. Encoding of the bytes of the file and of the XML declaration. With "ISO-8859-15", the first line was <?xml version="1.0" encoding="ISO-8859-15"?> and the "é" of "Café" the E9 byte; a tRSSInput read it back correctly.
ModeRSS / ATOM RSS ToujoursAlways RSS : document <rss version="2.0">, un <item> par ligne. ATOM : document <feed xmlns="http://www.w3.org/2005/Atom">, une <entry> par ligne, schéma imposé. RSS: <rss version="2.0"> document, one <item> per row. ATOM: <feed xmlns="http://www.w3.org/2005/Atom"> document, one <entry> per row, imposed schema.
Canal › TitreChannel › TitleTITLE "" RSS Élément <title> du canal. <title> element of the channel.
Canal › DescriptionChannel › DescriptionDESCRIPTION "" RSS Élément <description> du canal. <description> element of the channel.
Canal › Date de publicationChannel › Publication datePUBDATE "" RSS Texte écrit tel quel dans un élément <pubdate> (en minuscules, alors que RSS 2.0 l'appelle pubDate). Écrivez-le au format des dates RSS : "Fri, 20 Nov 2026 18:00:00 GMT". Text written as is in a <pubdate> element (in lower case, while RSS 2.0 calls it pubDate). Write it in the format of RSS dates: "Fri, 20 Nov 2026 18:00:00 GMT".
Canal › LienChannel › LinkLINK "" RSS Élément <link> du canal : l'adresse du site. <link> element of the channel: the address of the site.
Flux › TitreFeed › TitleaTITLE "" ATOM Élément <title> du flux. <title> element of the feed.
Flux › LienFeed › LinkaLINK "" ATOM Attribut href d'un élément <link/> du flux. href attribute of a <link/> element of the feed.
Flux › IDFeed › IdaID "" ATOM Élément <id> : identifiant permanent du flux, souvent une adresse ou un urn:uuid:…. <id> element: permanent identifier of the feed, often an address or a urn:uuid:….
Flux › Date de mise à jourFeed › Update dateaUPDATED "" ATOM Texte de l'élément <updated>, écrit tel quel : donnez-le au format d'Atom, "2026-11-20T18:00:00Z". Text of the <updated> element, written as is: give it in the Atom format, "2026-11-20T18:00:00Z".
Flux › Nom de l'auteurFeed › Author nameaAUTHOR "" ATOM Écrit dans <author><name>…</name></author>. Written in <author><name>…</name></author>.
Éléments facultatifls du canalOptional Channel ElementsELEMENTS videempty ToujoursAlways Colonnes Nom de l'élément et Valeur de l'élement, ajoutés à la fin de l'en-tête du canal (ou du flux en Atom). Règles dans Les éléments facultatifs. Element Name and Element Value columns, added at the end of the header of the channel (or of the feed in Atom). Rules in Optional elements.
SchémaSchemaSCHEMA RSS : celui du flux ; ATOM : id, title, link, updated, summaryRSS: the one of the flow; ATOM: id, title, link, updated, summary ToujoursAlways Une colonne = un élément de l'article, nommé comme la colonne en minuscules (pubDate donne <pubdate>). En Atom, les cinq colonnes sont des String en lecture seule ; link y devient l'attribut href. Voir Les valeurs écrites. One column = one element of the item, named like the column in lower case (pubDate gives <pubdate>). In Atom, the five columns are read-only Strings; link becomes the href attribute there. See Written values.

Variables globalesGlobal variables

NB_LINE
Integer, disponible après le composant : nombre d'articles écrits par ce composant (sans les anciens d'un fichier complété).Integer, available after the component: number of items written by this component (without the old ones of an appended file).
ERROR_MESSAGE
String, message de la dernière erreur, comme pour tout composant.String, message of the last error, as for any component.
((Integer) globalMap.get("tRSSOutput_1_NB_LINE"))

Les valeurs écritesWritten values

Type de la colonneColumn type Texte de l'élémentText of the element
String La valeur, échappée pour le XML : Café <b>crème</b> est écrit Café &lt;b&gt;crème&lt;/b&gt;, ce que les lecteurs de flux affichent comme du HTML. null : élément vide.The value, escaped for XML: Café <b>crème</b> is written Café &lt;b&gt;crème&lt;/b&gt;, which feed readers display as HTML. null: empty element.
Date En RSS, au format des dates RSS, en anglais et en heure GMT, quel que soit le motif de la colonne : le 20 novembre 2026 à 18:30 (heure de Paris) donne Fri, 20 Nov 2026 17:30:00 GMT. null : élément vide.In RSS, in the format of RSS dates, in English and in GMT time, whatever the pattern of the column: 20 November 2026 at 18:30 (Paris time) gives Fri, 20 Nov 2026 17:30:00 GMT. null: empty element.
Autres (Integer, Double…)Others (Integer, Double…) La valeur convertie en texte par Java ; null s'écrit null (lu dans le modèle du composant).The value converted to text by Java; null is written null (read in the template of the component).

Les éléments facultatifsOptional elements

  • Le Nom s'écrit entre guillemets ("language") et sert aussi de nom de variable dans le code généré : il doit être un identifiant Java. "dc:creator" a fait échouer la compilation du job (error: ';' expected sur org.dom4j.Element dc:creator_Element_tRSSOutput_1 = null;). Un tiret ou un point ne passent pas davantage. The Name is written in quotes ("language") and also serves as a variable name in the generated code: it must be a Java identifier. "dc:creator" made the compilation of the job fail (error: ';' expected on org.dom4j.Element dc:creator_Element_tRSSOutput_1 = null;). A dash or a dot do not pass either.
  • "parent/enfant" crée un élément dans un élément déclaré sur une ligne précédente : "image" (valeur ""), puis "image/url" et "image/title". Un seul niveau : "a/b/c" ne compile pas. "parent/child" creates an element in an element declared on an earlier row: "image" (value ""), then "image/url" and "image/title". One level only: "a/b/c" does not compile.
  • La Valeur est une expression Java ; elle n'est écrite que si son texte dans la table fait plus de deux caractères : "" laisse l'élément vide. The Value is a Java expression; it is only written when its text in the table is longer than two characters: "" leaves the element empty.
  • Ils ne sont écrits que dans un nouveau fichier, pas lors d'un ajout à un fichier existant. They are only written in a new file, not when adding to an existing file.

ExemplesExamples

Les sorties sont copiées depuis des exécutions du job de Utilisation (lancé depuis Talaxie, Java 21, sur un poste à l'heure de Paris). Fichiers sous C:/data/rss (chemin raccourci). Le tJava relié par On Subjob Ok affiche le fichier écrit puis NB_LINE : The outputs are copied from runs of the job of Usage (started from Talaxie, Java 21, on a machine on Paris time). Files under C:/data/rss (shortened path). The tJava connected with On Subjob Ok prints the written file then NB_LINE:

System.out.print(new String(java.nio.file.Files.readAllBytes(java.nio.file.Paths.get("C:/data/rss/news.xml")),
    java.nio.charset.StandardCharsets.UTF_8));
System.out.println("NB_LINE = " + globalMap.get("tRSSOutput_1_NB_LINE"));

Un flux RSSAn RSS feed

Schéma title, description, pubDate (Date, motif "yyyy-MM-dd HH:mm"), link ; trois lignes, la dernière n'ayant qu'un titre. Canal : "Example News", "Daily news of the example site", "Fri, 20 Nov 2026 18:00:00 GMT", "https://news.example.com/". Éléments facultatifs : "language" = "en-us", "image" = "", "image/url" = "https://news.example.com/logo.png", "image/title" = "Example News". Schema title, description, pubDate (Date, pattern "yyyy-MM-dd HH:mm"), link; three rows, the last one with only a title. Channel: "Example News", "Daily news of the example site", "Fri, 20 Nov 2026 18:00:00 GMT", "https://news.example.com/". Optional elements: "language" = "en-us", "image" = "", "image/url" = "https://news.example.com/logo.png", "image/title" = "Example News".

title                     description                             pubDate             link
"Release 2.4 is out"      "Faster loading & a new export."       TalendDate.parseDate("yyyy-MM-dd HH:mm", "2026-11-20 18:30")   "https://news.example.com/2026/11/release-2-4"
"Maintenance on Saturday" "Servers offline from 22:00 to 23:00."  TalendDate.parseDate("yyyy-MM-dd HH:mm", "2026-11-19 09:15")   "https://news.example.com/2026/11/maintenance"
"Café <b>crème</b>"     null                                    null                                                          null
<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0">
  <channel>
    <title>Example News</title>
    <description>Daily news of the example site</description>
    <pubdate>Fri, 20 Nov 2026 18:00:00 GMT</pubdate>
    <link>https://news.example.com/</link>
    <language>en-us</language>
    <image>
      <url>https://news.example.com/logo.png</url>
      <title>Example News</title>
    </image>
    <item>
      <title>Release 2.4 is out</title>
      <description>Faster loading &amp; a new export.</description>
      <pubdate>Fri, 20 Nov 2026 17:30:00 GMT</pubdate>
      <link>https://news.example.com/2026/11/release-2-4</link>
    </item>
    <item>
      <title>Maintenance on Saturday</title>
      <description>Servers offline from 22:00 to 23:00.</description>
      <pubdate>Thu, 19 Nov 2026 08:15:00 GMT</pubdate>
      <link>https://news.example.com/2026/11/maintenance</link>
    </item>
    <item>
      <title>Café &lt;b&gt;crème&lt;/b&gt;</title>
      <description></description>
      <pubdate></pubdate>
      <link></link>
    </item>
  </channel>
</rss>
NB_LINE = 3

Les dates sont passées en GMT (18:30 à Paris = 17:30 GMT). Les éléments de date s'appellent pubdate et non pubDate : relu par un tRSSInput, ce fichier a donné deux lignes, sans date, la troisième (lien vide) étant écartée. The dates were turned into GMT (18:30 in Paris = 17:30 GMT). The date elements are called pubdate and not pubDate: read back by a tRSSInput, this file gave two rows, without dates, the third one (empty link) being left out.

Un flux AtomAn Atom feed

Mode ATOM. Flux : "Example Blog", "https://blog.example.com/", "urn:uuid:60a76c80-d399-11d9-b93c-0003939e0af6", "2026-11-20T18:00:00Z", "Demo". Deux lignes dans les colonnes imposées id, title, link, updated, summary. Mode ATOM. Feed: "Example Blog", "https://blog.example.com/", "urn:uuid:60a76c80-d399-11d9-b93c-0003939e0af6", "2026-11-20T18:00:00Z", "Demo". Two rows in the imposed columns id, title, link, updated, summary.

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

<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Example Blog</title>
  <id>urn:uuid:60a76c80-d399-11d9-b93c-0003939e0af6</id>
  <updated>2026-11-20T18:00:00Z</updated>
  <link href="https://blog.example.com/"/>
  <author>
    <name>Demo</name>
  </author>
  <entry>
    <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
    <title>First post</title>
    <link href="https://blog.example.com/first"/>
    <updated>2026-11-19T08:30:00Z</updated>
    <summary>A short summary.</summary>
  </entry>
  <entry>
    <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6b</id>
    <title>Second post</title>
    <link href="https://blog.example.com/second"/>
    <updated>2026-11-20T17:00:00+01:00</updated>
    <summary>Another summary.</summary>
  </entry>
</feed>
NB_LINE = 2

Les textes de updated sont écrits tels quels. Un tRSSInput relit les deux entrées, mais sans date : il ne lit que published. The texts of updated are written as is. A tRSSInput reads the two entries back, but without dates: it only reads published.

Dossier absentMissing folder

Nom de fichier dans un dossier qui n'existe pas, une ligne. Nom du job remplacé par MyJob, chemin raccourci, pile abrégée : File Name in a folder that does not exist, one row. Job name replaced with MyJob, shortened path, shortened stack:

Exception in component tRSSOutput_1 (MyJob)
java.io.FileNotFoundException: C:\data\rss\missing-folder\news.xml (Le chemin d’accès spécifié est introuvable)
	at java.base/java.io.FileOutputStream.open0(Native Method)
	…
	at demo.myjob_0_1.MyJob.tFixedFlowInput_1Process(MyJob.java:1115)
	…

L'erreur arrive à la fin du sous-job, une fois toutes les lignes lues (la fin du message vient de Windows, dans sa langue) ; le job s'est terminé avec le code 1. Créez le dossier avant, par exemple avec un tJava (new java.io.File("C:/data/rss").mkdirs();). The error comes at the end of the subjob, once all the rows are read (the end of the message comes from Windows, in its language); the job ended with code 1. Create the folder beforehand, for example with a tJava (new java.io.File("C:/data/rss").mkdirs();).

Écrire à la suiteAppend

Un job, deux sous-jobs qui écrivent le même fichier avec Écrire à la suite de cochée ; le fichier n'existe pas au départ. Le second composant a un autre titre de canal (ou de flux). Le tJava affiche le fichier à la fin. One job, two subjobs that write the same file with Append checked; the file does not exist at the start. The second component has another channel (or feed) title. The tJava prints the file at the end.

row1 (Main) OnSubjobOk row2 (Main) OnSubjobOk tFixedFlowInput_1 tRSSOutput_1 tFixedFlowInput_2 tRSSOutput_2 tJava_1

RSS : les articles s'ajoutentRSS: the items add up

Une ligne par sous-job ; titre du second : "Example News (2)". One row per subjob; title of the second one: "Example News (2)".

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

<rss version="2.0">
  <channel>
    <title>Example News (2)</title>
    <description>Daily news of the example site</description>
    <pubdate>Fri, 20 Nov 2026 18:00:00 GMT</pubdate>
    <link>https://news.example.com/</link>
    <item>
      <title>Release 2.4 is out</title>
      <description>Faster loading &amp; a new export.</description>
      <pubdate>Fri, 20 Nov 2026 17:30:00 GMT</pubdate>
      <link>https://news.example.com/2026/11/release-2-4</link>
    </item>
    <item>
      <title>Maintenance on Saturday</title>
      <description>Servers offline from 22:00 to 23:00.</description>
      <pubdate>Thu, 19 Nov 2026 08:15:00 GMT</pubdate>
      <link>https://news.example.com/2026/11/maintenance</link>
    </item>
  </channel>
</rss>

Le titre du canal est remplacé par celui du second composant, comme la description, la date et le lien. Les lignes déjà présentes gardent des espaces en fin de ligne : la mise en forme est ajoutée à celle du fichier relu. Le nouvel article va à la fin ; un lecteur de flux affiche en général les articles par date, mais certains les prennent dans l'ordre du fichier. The channel title is replaced with the one of the second component, as are the description, the date and the link. The lines already present keep spaces at the end of the line: the layout is added to the one of the file read again. The new item goes at the end; a feed reader usually shows the items by date, but some take them in the order of the file.

Atom : échec dès que le fichier existeAtom: failure as soon as the file exists

Le même job en mode ATOM. Le premier sous-job crée le fichier ; le second échoue. Nom du job remplacé par MyJob, pile abrégée : The same job in ATOM mode. The first subjob creates the file; the second one fails. Job name replaced with MyJob, shortened stack:

Exception in component tRSSOutput_2 (MyJob)
java.lang.IndexOutOfBoundsException: Index: 0
	at java.base/java.util.Collections$EmptyList.get(Collections.java:4808)
	at demo.myjob_0_1.MyJob.tFixedFlowInput_2Process(MyJob.java:1895)
	…

Pour retrouver l'en-tête d'un fichier existant, le composant cherche /feed sans tenir compte de l'espace de noms d'Atom, ne trouve rien et échoue ; le job s'est terminé avec le code 1. En Atom, laissez Écrire à la suite de décochée et réécrivez tout le flux à chaque exécution, à partir de la liste complète des entrées. To find the header of an existing file, the component looks for /feed without taking the Atom namespace into account, finds nothing and fails; the job ended with code 1. In Atom, leave Append unchecked and rewrite the whole feed at each run, from the full list of entries.

PiègesPitfalls

pubdate au lieu de pubDatepubdate instead of pubDate

Les noms d'éléments sont sensibles à la casse en XML. Le composant écrit la date du canal dans <pubdate>, et met en minuscules le nom de chaque colonne : aucun réglage ne produit le pubDate de RSS 2.0, et les lecteurs de flux (dont le tRSSInput) ne voient pas ces dates. Pour un flux à diffuser, écrivez plutôt le XML avec un tAdvancedFileOutputXML ou un tWriteXMLField, qui gardent la casse. Element names are case-sensitive in XML. The component writes the channel date in <pubdate>, and puts the name of each column in lower case: no setting produces the RSS 2.0 pubDate, and feed readers (including the tRSSInput) do not see these dates. For a feed to publish, write the XML with a tAdvancedFileOutputXML or a tWriteXMLField instead, which keep the case.

Tout est écrit à la finEverything is written at the end

Le document reste en mémoire jusqu'à la fin du sous-job : un flux de très nombreux articles occupe d'autant la mémoire du job, et un sous-job interrompu ne laisse pas de fichier partiel (l'ancien fichier reste en place). Un flux RSS se limite d'ordinaire aux derniers articles : filtrez en amont. The document stays in memory until the end of the subjob: a feed with very many items takes as much of the memory of the job, and an interrupted subjob leaves no partial file (the old file stays in place). An RSS feed is usually limited to the latest items: filter upstream.

Les dates de l'en-tête sont du texteHeader dates are text

Date de publication (RSS) et Date de mise à jour (Atom) sont écrites telles quelles. Pour la date du moment : TalendDate.formatDateLocale("EEE, d MMM yyyy HH:mm:ss Z", TalendDate.getCurrentDate(), "EN") en RSS, TalendDate.getDate("yyyy-MM-dd'T'HH:mm:ssXXX") en Atom. Lors d'un essai à Paris, elles ont donné Sat, 21 Nov 2026 16:01:40 +0100 et 2026-11-21T16:01:40+01:00. Publication date (RSS) and Update date (Atom) are written as is. For the current date: TalendDate.formatDateLocale("EEE, d MMM yyyy HH:mm:ss Z", TalendDate.getCurrentDate(), "EN") in RSS, TalendDate.getDate("yyyy-MM-dd'T'HH:mm:ssXXX") in Atom. In a run in Paris, they gave Sat, 21 Nov 2026 16:01:40 +0100 and 2026-11-21T16:01:40+01:00.

Les noms des colonnes RSSRSS column names

Un élément porte le nom de sa colonne : choisissez ceux de RSS 2.0 (title, link, description, author, category, comments, guid). Une colonne guid est écrite comme un texte, sans attribut isPermaLink. Les colonnes que l'article ne doit pas avoir sont à retirer du schéma, sinon elles donnent des éléments vides. An element bears the name of its column: choose the RSS 2.0 ones (title, link, description, author, category, comments, guid). A guid column is written as a text, without an isPermaLink attribute. The columns that the item must not have are to be removed from the schema, otherwise they give empty elements.

Voir aussiSee also

Les autres composants de la famille Internet, et ceux qui servent avec le tRSSOutput : The other components of the Internet family, and those used with the tRSSOutput: